diff --git a/.changeset/pre.json b/.changeset/pre.json index 9532184e9..571088fc2 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -9,7 +9,6 @@ "@example/my-component": "0.0.1", "@example/docs": "0.0.1", "@example/env-vars": "0.0.1", - "@example/fast-build": "0.0.1", "@example/framework-alpine": "0.0.1", "@example/framework-lit": "0.0.1", "@example/framework-multiple": "0.0.1", diff --git a/examples/fast-build/.npmrc b/examples/fast-build/.npmrc deleted file mode 100644 index ef83021af..000000000 --- a/examples/fast-build/.npmrc +++ /dev/null @@ -1,2 +0,0 @@ -# Expose Astro dependencies for `pnpm` users -shamefully-hoist=true diff --git a/examples/fast-build/package.json b/examples/fast-build/package.json deleted file mode 100644 index 0a7bd74ff..000000000 --- a/examples/fast-build/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "@example/fast-build", - "version": "0.0.1", - "private": true, - "scripts": { - "dev": "astro dev --experimental-static-build", - "start": "astro dev --experimental-static-build", - "build": "astro build --experimental-static-build", - "scan-build": "astro build", - "preview": "astro preview" - }, - "devDependencies": { - "@astrojs/renderer-vue": "^0.4.0", - "@astrojs/renderer-preact": "^0.5.0", - "sass": "^1.49.8", - "astro": "^0.24.0-next.0", - "preact": "~10.6.5", - "unocss": "^0.15.5", - "vite-imagetools": "^4.0.1" - } -} diff --git a/examples/fast-build/src/components/ExternalHoisted.astro b/examples/fast-build/src/components/ExternalHoisted.astro deleted file mode 100644 index a9e7d2ae2..000000000 --- a/examples/fast-build/src/components/ExternalHoisted.astro +++ /dev/null @@ -1,2 +0,0 @@ -
- diff --git a/examples/fast-build/src/images/penguin.jpg b/examples/fast-build/src/images/penguin.jpg deleted file mode 100644 index 6c5dcd37a..000000000 Binary files a/examples/fast-build/src/images/penguin.jpg and /dev/null differ diff --git a/examples/fast-build/src/images/random.jpg b/examples/fast-build/src/images/random.jpg deleted file mode 100644 index 291883837..000000000 Binary files a/examples/fast-build/src/images/random.jpg and /dev/null differ diff --git a/packages/astro/src/core/config.ts b/packages/astro/src/core/config.ts index e2cccff41..5f5ca042e 100644 --- a/packages/astro/src/core/config.ts +++ b/packages/astro/src/core/config.ts @@ -117,7 +117,6 @@ function resolveFlags(flags: Partial): CLIFlags { // eslint-disable-next-line no-console console.warn(`Passing --experimental-static-build is no longer necessary and is now the default. The flag will be removed in a future version of Astro.`); } - return { projectRoot: typeof flags.projectRoot === 'string' ? flags.projectRoot : undefined, site: typeof flags.site === 'string' ? flags.site : undefined, @@ -126,7 +125,6 @@ function resolveFlags(flags: Partial): CLIFlags { config: typeof flags.config === 'string' ? flags.config : undefined, hostname: typeof flags.hostname === 'string' ? flags.hostname : undefined, legacyBuild: typeof flags.legacyBuild === 'boolean' ? flags.legacyBuild : false, - experimentalStaticBuild: typeof flags.experimentalStaticBuild === 'boolean' ? flags.experimentalStaticBuild : true, experimentalSsr: typeof flags.experimentalSsr === 'boolean' ? flags.experimentalSsr : false, drafts: typeof flags.drafts === 'boolean' ? flags.drafts : false, }; @@ -140,11 +138,10 @@ function mergeCLIFlags(astroConfig: AstroUserConfig, flags: CLIFlags) { if (typeof flags.site === 'string') astroConfig.buildOptions.site = flags.site; if (typeof flags.port === 'number') astroConfig.devOptions.port = flags.port; if (typeof flags.hostname === 'string') astroConfig.devOptions.hostname = flags.hostname; - if (typeof flags.experimentalStaticBuild === 'boolean') astroConfig.buildOptions.experimentalStaticBuild = flags.experimentalStaticBuild; + if (typeof flags.legacyBuild === 'boolean') astroConfig.buildOptions.legacyBuild = flags.legacyBuild; if (typeof flags.experimentalSsr === 'boolean') { astroConfig.buildOptions.experimentalSsr = flags.experimentalSsr; if (flags.experimentalSsr) { - astroConfig.buildOptions.experimentalStaticBuild = true; astroConfig.buildOptions.legacyBuild = false; } } diff --git a/examples/fast-build/astro.config.mjs b/packages/astro/test/fixtures/legacy-build/astro.config.mjs similarity index 58% rename from examples/fast-build/astro.config.mjs rename to packages/astro/test/fixtures/legacy-build/astro.config.mjs index f40bc1cca..72cd77587 100644 --- a/examples/fast-build/astro.config.mjs +++ b/packages/astro/test/fixtures/legacy-build/astro.config.mjs @@ -1,9 +1,4 @@ -import { imagetools } from 'vite-imagetools'; - // @ts-check export default /** @type {import('astro').AstroUserConfig} */ ({ renderers: ['@astrojs/renderer-vue'], - vite: { - plugins: [imagetools()], - }, }); diff --git a/packages/astro/test/fixtures/legacy-build/package.json b/packages/astro/test/fixtures/legacy-build/package.json new file mode 100644 index 000000000..77f85d531 --- /dev/null +++ b/packages/astro/test/fixtures/legacy-build/package.json @@ -0,0 +1,10 @@ +{ + "name": "@astrojs/legacy-build", + "version": "0.0.0", + "private": true, + "dependencies": { + "@astrojs/renderer-vue": "^0.4.0", + "astro": "workspace:*", + "preact": "~10.6.5" + } +} diff --git a/examples/fast-build/src/components/Counter.vue b/packages/astro/test/fixtures/legacy-build/src/components/Counter.vue similarity index 100% rename from examples/fast-build/src/components/Counter.vue rename to packages/astro/test/fixtures/legacy-build/src/components/Counter.vue diff --git a/examples/fast-build/src/components/Greeting.vue b/packages/astro/test/fixtures/legacy-build/src/components/Greeting.vue similarity index 100% rename from examples/fast-build/src/components/Greeting.vue rename to packages/astro/test/fixtures/legacy-build/src/components/Greeting.vue diff --git a/examples/fast-build/src/components/InlineHoisted.astro b/packages/astro/test/fixtures/legacy-build/src/components/InlineHoisted.astro similarity index 100% rename from examples/fast-build/src/components/InlineHoisted.astro rename to packages/astro/test/fixtures/legacy-build/src/components/InlineHoisted.astro diff --git a/examples/fast-build/src/pages/[pokemon].astro b/packages/astro/test/fixtures/legacy-build/src/pages/[pokemon].astro similarity index 69% rename from examples/fast-build/src/pages/[pokemon].astro rename to packages/astro/test/fixtures/legacy-build/src/pages/[pokemon].astro index ea01cc4f7..bb3372123 100644 --- a/examples/fast-build/src/pages/[pokemon].astro +++ b/packages/astro/test/fixtures/legacy-build/src/pages/[pokemon].astro @@ -2,9 +2,7 @@ import Greeting from '../components/Greeting.vue'; export async function getStaticPaths() { - const response = await fetch(`https://pokeapi.co/api/v2/pokemon?limit=2000`); - const result = await response.json(); - const allPokemon = result.results; + const allPokemon = [{name: 'Charmander'}, {name: 'Charmander'}, {name: 'Charizard'}]; return allPokemon.map(pokemon => ({params: {pokemon: pokemon.name}, props: {pokemon}})); } --- diff --git a/examples/fast-build/src/pages/index.astro b/packages/astro/test/fixtures/legacy-build/src/pages/index.astro similarity index 70% rename from examples/fast-build/src/pages/index.astro rename to packages/astro/test/fixtures/legacy-build/src/pages/index.astro index 1ae672da6..ef93bf553 100644 --- a/examples/fast-build/src/pages/index.astro +++ b/packages/astro/test/fixtures/legacy-build/src/pages/index.astro @@ -1,11 +1,7 @@ --- -import imgUrl from '../images/penguin.jpg'; -import grayscaleUrl from '../images/random.jpg?grayscale=true'; import Greeting from '../components/Greeting.vue'; import Counter from '../components/Counter.vue'; -// import { Code } from 'astro/components'; import InlineHoisted from '../components/InlineHoisted.astro'; -import ExternalHoisted from '../components/ExternalHoisted.astro'; --- @@ -29,12 +25,6 @@ import ExternalHoisted from '../components/ExternalHoisted.astro'; -
-

Images

- -

Imported in JS

- -

Component CSS

@@ -43,14 +33,10 @@ import ExternalHoisted from '../components/ExternalHoisted.astro';

ImageTools

-

Astro components

-
@@ -61,7 +47,6 @@ import ExternalHoisted from '../components/ExternalHoisted.astro';

Hoisted scripts

-
diff --git a/examples/fast-build/src/scripts/external-hoist.ts b/packages/astro/test/fixtures/legacy-build/src/scripts/external-hoist.ts similarity index 100% rename from examples/fast-build/src/scripts/external-hoist.ts rename to packages/astro/test/fixtures/legacy-build/src/scripts/external-hoist.ts diff --git a/examples/fast-build/src/styles/_global.scss b/packages/astro/test/fixtures/legacy-build/src/styles/_global.scss similarity index 100% rename from examples/fast-build/src/styles/_global.scss rename to packages/astro/test/fixtures/legacy-build/src/styles/_global.scss diff --git a/examples/fast-build/src/styles/global.css b/packages/astro/test/fixtures/legacy-build/src/styles/global.css similarity index 100% rename from examples/fast-build/src/styles/global.css rename to packages/astro/test/fixtures/legacy-build/src/styles/global.css diff --git a/packages/astro/test/legacy-build.test.js b/packages/astro/test/legacy-build.test.js new file mode 100644 index 000000000..1b3224493 --- /dev/null +++ b/packages/astro/test/legacy-build.test.js @@ -0,0 +1,23 @@ +import { expect } from 'chai'; +import cheerio from 'cheerio'; +import { loadFixture } from './test-utils.js'; + +describe('Legacy Build', () => { + let fixture; + + before(async () => { + fixture = await loadFixture({ + projectRoot: './fixtures/legacy-build/', + }); + await fixture.build({buildOptions: {legacyBuild: true}}); + }); + + describe('build', () => { + it('is successful', async () => { + const html = await fixture.readFile(`/index.html`); + const $ = cheerio.load(html); + expect($('title').text()).to.equal('Demo app'); + }); + + }); +}); diff --git a/packages/astro/test/static-build-code-component.test.js b/packages/astro/test/static-build-code-component.test.js index c81a686e4..4c712f2ab 100644 --- a/packages/astro/test/static-build-code-component.test.js +++ b/packages/astro/test/static-build-code-component.test.js @@ -9,9 +9,7 @@ describe('Code component inside static build', () => { fixture = await loadFixture({ projectRoot: './fixtures/static-build-code-component/', renderers: [], - buildOptions: { - experimentalStaticBuild: true, - }, + buildOptions: {}, }); await fixture.build(); }); diff --git a/packages/astro/test/static-build-frameworks.test.js b/packages/astro/test/static-build-frameworks.test.js index aea427898..bea8fb11b 100644 --- a/packages/astro/test/static-build-frameworks.test.js +++ b/packages/astro/test/static-build-frameworks.test.js @@ -13,9 +13,7 @@ describe('Static build - frameworks', () => { fixture = await loadFixture({ projectRoot: './fixtures/static-build-frameworks/', renderers: ['@astrojs/renderer-preact', '@astrojs/renderer-react'], - buildOptions: { - experimentalStaticBuild: true, - }, + buildOptions: {}, }); await fixture.build(); }); diff --git a/packages/astro/test/static-build-page-url-format.test.js b/packages/astro/test/static-build-page-url-format.test.js index 6e36ba61d..6f43a441b 100644 --- a/packages/astro/test/static-build-page-url-format.test.js +++ b/packages/astro/test/static-build-page-url-format.test.js @@ -14,7 +14,6 @@ describe("Static build - pageUrlFormat: 'file'", () => { projectRoot: './fixtures/static-build-page-url-format/', renderers: [], buildOptions: { - experimentalStaticBuild: true, site: 'http://example.com/subpath/', pageUrlFormat: 'file', }, diff --git a/packages/astro/test/static-build.test.js b/packages/astro/test/static-build.test.js index 81473bd0e..6ca4fd8c7 100644 --- a/packages/astro/test/static-build.test.js +++ b/packages/astro/test/static-build.test.js @@ -14,7 +14,6 @@ describe('Static build', () => { projectRoot: './fixtures/static build/', renderers: ['@astrojs/renderer-preact'], buildOptions: { - experimentalStaticBuild: true, site: 'http://example.com/subpath/', }, ssr: { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 97ea5446f..f66275bda 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -105,24 +105,6 @@ importers: devDependencies: astro: link:../../packages/astro - examples/fast-build: - specifiers: - '@astrojs/renderer-preact': ^0.5.0 - '@astrojs/renderer-vue': ^0.4.0 - astro: ^0.24.0-next.0 - preact: ~10.6.5 - sass: ^1.49.8 - unocss: ^0.15.5 - vite-imagetools: ^4.0.1 - devDependencies: - '@astrojs/renderer-preact': link:../../packages/renderers/renderer-preact - '@astrojs/renderer-vue': link:../../packages/renderers/renderer-vue - astro: link:../../packages/astro - preact: 10.6.6 - sass: 1.49.9 - unocss: 0.15.6 - vite-imagetools: 4.0.3 - examples/framework-alpine: specifiers: astro: ^0.24.0-next.0 @@ -815,6 +797,16 @@ importers: dependencies: astro: link:../../.. + packages/astro/test/fixtures/legacy-build: + specifiers: + '@astrojs/renderer-vue': ^0.4.0 + astro: workspace:* + preact: ~10.6.5 + dependencies: + '@astrojs/renderer-vue': link:../../../../renderers/renderer-vue + astro: link:../../.. + preact: 10.6.6 + packages/astro/test/fixtures/lit-element: specifiers: '@astrojs/renderer-lit': workspace:* @@ -8005,6 +7997,7 @@ packages: /preact/10.6.6: resolution: {integrity: sha512-dgxpTFV2vs4vizwKohYKkk7g7rmp1wOOcfd4Tz3IB3Wi+ivZzsn/SpeKJhRENSE+n8sUfsAl4S3HiCVT923ABw==} + dev: false /prebuild-install/7.0.1: resolution: {integrity: sha512-QBSab31WqkyxpnMWQxubYAHR5S9B2+r81ucocew34Fkl98FhvKIF50jIJnNOBmAZfyNV7vE5T6gd3hTVWgY6tg==}