From 0a7ba5bdbc6f7e3da20d220940996b493ec421d6 Mon Sep 17 00:00:00 2001 From: Paul Barry Date: Mon, 4 Dec 2023 11:07:22 -0500 Subject: [PATCH 01/17] Issue-1118: Refactor rollup config generation for APIs --- packages/cli/src/config/rollup.config.js | 43 +++++++++++------------- packages/cli/src/lifecycles/bundle.js | 10 +++--- 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/packages/cli/src/config/rollup.config.js b/packages/cli/src/config/rollup.config.js index 53fa89845..3a1450eda 100644 --- a/packages/cli/src/config/rollup.config.js +++ b/packages/cli/src/config/rollup.config.js @@ -336,36 +336,31 @@ const getRollupConfigForScriptResources = async (compilation) => { const getRollupConfigForApis = async (compilation) => { const { outputDir, userWorkspace } = compilation.context; - const input = [...compilation.manifest.apis.values()] - .map(api => normalizePathnameForWindows(new URL(`.${api.path}`, userWorkspace))); // why is this needed? await fs.promises.mkdir(new URL('./api/assets/', outputDir), { recursive: true }); - // TODO should routes and APIs have chunks? - // https://github.com/ProjectEvergreen/greenwood/issues/1118 - return [{ - input, - output: { - dir: `${normalizePathnameForWindows(outputDir)}/api`, - entryFileNames: '[name].js', - chunkFileNames: '[name].[hash].js' - }, - plugins: [ - greenwoodResourceLoader(compilation), - // support node export conditions for API routes - // https://github.com/ProjectEvergreen/greenwood/issues/1118 - // https://github.com/rollup/plugins/issues/362#issuecomment-873448461 - nodeResolve({ - exportConditions: ['node'], - preferBuiltins: true - }), - commonjs(), - greenwoodImportMetaUrl(compilation) - ] - }]; + return [...compilation.manifest.apis.values()] + .map(api => normalizePathnameForWindows(new URL(`.${api.path}`, userWorkspace))) + .map(filepath => ({ + input: filepath, + output: { + dir: `${normalizePathnameForWindows(outputDir)}/api`, + entryFileNames: '[name].js', + chunkFileNames: '[name].[hash].js' + }, + plugins: [ + greenwoodResourceLoader(compilation), + nodeResolve({ + exportConditions: ['node'], + preferBuiltins: true + }), + commonjs(), + greenwoodImportMetaUrl(compilation) + ] + })); }; const getRollupConfigForSsr = async (compilation, input) => { diff --git a/packages/cli/src/lifecycles/bundle.js b/packages/cli/src/lifecycles/bundle.js index 22f96cca4..a96998d98 100644 --- a/packages/cli/src/lifecycles/bundle.js +++ b/packages/cli/src/lifecycles/bundle.js @@ -185,11 +185,13 @@ async function bundleStyleResources(compilation, resourcePlugins) { async function bundleApiRoutes(compilation) { // https://rollupjs.org/guide/en/#differences-to-the-javascript-api - const [rollupConfig] = await getRollupConfigForApis(compilation); + const apiConfigs = await getRollupConfigForApis(compilation); - if (rollupConfig.input.length !== 0) { - const bundle = await rollup(rollupConfig); - await bundle.write(rollupConfig.output); + if (apiConfigs.length > 0 && apiConfigs[0].input.length !== 0) { + apiConfigs.forEach(async rollupConfig => { + const bundle = await rollup(rollupConfig); + await bundle.write(rollupConfig.output); + }); } } From 0be9153bcbd29de4bd4ad62b51dfd3a7425e60d9 Mon Sep 17 00:00:00 2001 From: Paul Barry Date: Mon, 4 Dec 2023 11:58:52 -0500 Subject: [PATCH 02/17] Issue-1118: Refactor rollup config generation for SSR --- packages/cli/src/config/rollup.config.js | 8 +++----- packages/cli/src/lifecycles/bundle.js | 10 ++++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/cli/src/config/rollup.config.js b/packages/cli/src/config/rollup.config.js index 3a1450eda..a2955e113 100644 --- a/packages/cli/src/config/rollup.config.js +++ b/packages/cli/src/config/rollup.config.js @@ -366,10 +366,8 @@ const getRollupConfigForApis = async (compilation) => { const getRollupConfigForSsr = async (compilation, input) => { const { outputDir } = compilation.context; - // TODO should routes and APIs have chunks? - // https://github.com/ProjectEvergreen/greenwood/issues/1118 - return [{ - input, + return input.map(filepath => ({ + input: filepath, output: { dir: normalizePathnameForWindows(outputDir), entryFileNames: '_[name].js', @@ -406,7 +404,7 @@ const getRollupConfigForSsr = async (compilation, input) => { } } - }]; + })); }; export { diff --git a/packages/cli/src/lifecycles/bundle.js b/packages/cli/src/lifecycles/bundle.js index a96998d98..bf3a123c7 100644 --- a/packages/cli/src/lifecycles/bundle.js +++ b/packages/cli/src/lifecycles/bundle.js @@ -258,11 +258,13 @@ async function bundleSsrPages(compilation) { } } - const [rollupConfig] = await getRollupConfigForSsr(compilation, input); + const ssrConfigs = await getRollupConfigForSsr(compilation, input); - if (rollupConfig.input.length > 0) { - const bundle = await rollup(rollupConfig); - await bundle.write(rollupConfig.output); + if (ssrConfigs.length > 0 && ssrConfigs[0].input.length > 0) { + ssrConfigs.forEach(async rollupConfig => { + const bundle = await rollup(rollupConfig); + await bundle.write(rollupConfig.output); + }); } } } From dff0649619f6aa7d6f559e105eb9f352389033d8 Mon Sep 17 00:00:00 2001 From: Paul Barry Date: Wed, 6 Dec 2023 11:45:25 -0500 Subject: [PATCH 03/17] Issue-1118: Refactor forEach to use for-in for the ssr config generation --- packages/cli/src/lifecycles/bundle.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/lifecycles/bundle.js b/packages/cli/src/lifecycles/bundle.js index bf3a123c7..572bdf73e 100644 --- a/packages/cli/src/lifecycles/bundle.js +++ b/packages/cli/src/lifecycles/bundle.js @@ -260,11 +260,12 @@ async function bundleSsrPages(compilation) { const ssrConfigs = await getRollupConfigForSsr(compilation, input); - if (ssrConfigs.length > 0 && ssrConfigs[0].input.length > 0) { - ssrConfigs.forEach(async rollupConfig => { + if (ssrConfigs.length > 0 && ssrConfigs[0].input !== '') { + for (const configIndex in ssrConfigs) { + const rollupConfig = ssrConfigs[configIndex]; const bundle = await rollup(rollupConfig); await bundle.write(rollupConfig.output); - }); + } } } } From a2430d52c25f3ee31f9051b0ceabb21b5c3f2c0f Mon Sep 17 00:00:00 2001 From: Paul Barry Date: Mon, 11 Dec 2023 09:35:46 -0500 Subject: [PATCH 04/17] Issue-1118: Convert forEach to for..in --- packages/cli/src/lifecycles/bundle.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/lifecycles/bundle.js b/packages/cli/src/lifecycles/bundle.js index 572bdf73e..e32c8d14f 100644 --- a/packages/cli/src/lifecycles/bundle.js +++ b/packages/cli/src/lifecycles/bundle.js @@ -188,10 +188,14 @@ async function bundleApiRoutes(compilation) { const apiConfigs = await getRollupConfigForApis(compilation); if (apiConfigs.length > 0 && apiConfigs[0].input.length !== 0) { - apiConfigs.forEach(async rollupConfig => { + for (const configIndex in apiConfigs) { + const rollupConfig = apiConfigs[configIndex]; const bundle = await rollup(rollupConfig); await bundle.write(rollupConfig.output); - }); + + } + // apiConfigs.forEach(async rollupConfig => { + // }); } } From 163fc05bd37e052310ed65f675410e67f9cb0244 Mon Sep 17 00:00:00 2001 From: Paul Barry Date: Mon, 11 Dec 2023 12:10:17 -0500 Subject: [PATCH 05/17] Issue-1118: Remove unused code --- packages/cli/src/lifecycles/bundle.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/cli/src/lifecycles/bundle.js b/packages/cli/src/lifecycles/bundle.js index e32c8d14f..9bd0c3726 100644 --- a/packages/cli/src/lifecycles/bundle.js +++ b/packages/cli/src/lifecycles/bundle.js @@ -194,8 +194,6 @@ async function bundleApiRoutes(compilation) { await bundle.write(rollupConfig.output); } - // apiConfigs.forEach(async rollupConfig => { - // }); } } From 674a7ce3bedb300fba2abdc1ca1bf8c70f240946 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Fri, 16 Feb 2024 20:05:25 -0500 Subject: [PATCH 06/17] refactor away bundling work arounds and add comments --- packages/plugin-adapter-netlify/src/index.js | 32 ++++----------- packages/plugin-adapter-vercel/src/index.js | 43 ++------------------ 2 files changed, 11 insertions(+), 64 deletions(-) diff --git a/packages/plugin-adapter-netlify/src/index.js b/packages/plugin-adapter-netlify/src/index.js index e028bcf1f..4e1b47b1b 100644 --- a/packages/plugin-adapter-netlify/src/index.js +++ b/packages/plugin-adapter-netlify/src/index.js @@ -92,9 +92,6 @@ async function netlifyAdapter(compilation) { await fs.mkdir(adapterOutputUrl, { recursive: true }); } - const files = await fs.readdir(outputDir); - const isExecuteRouteModule = files.find(file => file.startsWith('execute-route-module')); - await fs.mkdir(new URL('./netlify/functions/', projectDirectory), { recursive: true }); for (const page of ssrPages) { @@ -104,29 +101,22 @@ async function netlifyAdapter(compilation) { await setupOutputDirectory(id, outputRoot, outputType); + // one for the user's actual file await fs.cp( new URL(`./_${id}.js`, outputDir), new URL(`./_${id}.js`, outputRoot), { recursive: true } ); + + // and one to act as the entry point into it (as produced by Greenwood CLI) await fs.cp( new URL(`./__${id}.js`, outputDir), new URL(`./__${id}.js`, outputRoot), { recursive: true } ); - // TODO quick hack to make serverless pages are fully self-contained - // for example, execute-route-module.js will only get code split if there are more than one SSR pages - // https://github.com/ProjectEvergreen/greenwood/issues/1118 - if (isExecuteRouteModule) { - await fs.cp( - new URL(`./${isExecuteRouteModule}`, outputDir), - new URL(`./${isExecuteRouteModule}`, outputRoot) - ); - } - - // TODO how to track SSR resources that get dumped out in the public directory? - // https://github.com/ProjectEvergreen/greenwood/issues/1118 + // need this for URL referenced chunks + // ideally we would map bundles to pages to avoid copying the same files into every function const ssrPageAssets = (await fs.readdir(outputDir)) .filter(file => !path.basename(file).startsWith('_') && !path.basename(file).startsWith('execute') @@ -158,22 +148,14 @@ async function netlifyAdapter(compilation) { await setupOutputDirectory(id, outputRoot, outputType); - // TODO ideally all functions would be self contained - // https://github.com/ProjectEvergreen/greenwood/issues/1118 await fs.cp( new URL(`./api/${id}.js`, outputDir), new URL(`./__${id}.js`, outputRoot), { recursive: true } ); - if (await checkResourceExists(new URL('./api/assets/', outputDir))) { - await fs.cp( - new URL('./api/assets/', outputDir), - new URL('./assets/', outputRoot), - { recursive: true } - ); - } - + // need this for URL referenced chunks + // ideally we would map bundles to pages to avoid copying the same files into every function const ssrApiAssets = (await fs.readdir(new URL('./api/', outputDir))) .filter(file => new RegExp(/^[\w][\w-]*\.[a-zA-Z0-9]{4,20}\.[\w]{2,4}$/).test(path.basename(file))); diff --git a/packages/plugin-adapter-vercel/src/index.js b/packages/plugin-adapter-vercel/src/index.js index 77602ae88..163e81035 100644 --- a/packages/plugin-adapter-vercel/src/index.js +++ b/packages/plugin-adapter-vercel/src/index.js @@ -82,9 +82,6 @@ async function vercelAdapter(compilation) { 'version': 3 })); - const files = await fs.readdir(outputDir); - const isExecuteRouteModule = files.find(file => file.startsWith('execute-route-module')); - for (const page of ssrPages) { const outputType = 'page'; const { id } = page; @@ -92,43 +89,19 @@ async function vercelAdapter(compilation) { await setupFunctionBuildFolder(id, outputType, outputRoot); + // one for the user's actual file await fs.cp( new URL(`./_${id}.js`, outputDir), new URL(`./_${id}.js`, outputRoot), { recursive: true } ); + // and one to act as the entry point into it (as produced by Greenwood CLI) await fs.cp( new URL(`./__${id}.js`, outputDir), new URL(`./__${id}.js`, outputRoot), { recursive: true } ); - - // TODO quick hack to make serverless pages are fully self-contained - // for example, execute-route-module.js will only get code split if there are more than one SSR pages - // https://github.com/ProjectEvergreen/greenwood/issues/1118 - if (isExecuteRouteModule) { - await fs.cp( - new URL(`./${isExecuteRouteModule}`, outputDir), - new URL(`./${isExecuteRouteModule}`, outputRoot) - ); - } - - // TODO how to track SSR resources that get dumped out in the public directory? - // https://github.com/ProjectEvergreen/greenwood/issues/1118 - const ssrPageAssets = (await fs.readdir(outputDir)) - .filter(file => !path.basename(file).startsWith('_') - && !path.basename(file).startsWith('execute') - && path.basename(file).endsWith('.js') - ); - - for (const asset of ssrPageAssets) { - await fs.cp( - new URL(`./${asset}`, outputDir), - new URL(`./${asset}`, outputRoot), - { recursive: true } - ); - } } for (const [key] of apiRoutes) { @@ -138,22 +111,14 @@ async function vercelAdapter(compilation) { await setupFunctionBuildFolder(id, outputType, outputRoot); - // TODO ideally all functions would be self contained - // https://github.com/ProjectEvergreen/greenwood/issues/1118 await fs.cp( new URL(`./api/${id}.js`, outputDir), new URL(`./${id}.js`, outputRoot), { recursive: true } ); - if (await checkResourceExists(new URL('./api/assets/', outputDir))) { - await fs.cp( - new URL('./api/assets/', outputDir), - new URL('./assets/', outputRoot), - { recursive: true } - ); - } - + // need this for URL referenced chunks + // ideally we would map bundles to pages to avoid copying the same files into every function const ssrApiAssets = (await fs.readdir(new URL('./api/', outputDir))) .filter(file => new RegExp(/^[\w][\w-]*\.[a-zA-Z0-9]{4,20}\.[\w]{2,4}$/).test(path.basename(file))); From 07b6630ddda5e447daf55e2a48e3638c7d1cc079 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sat, 17 Feb 2024 18:16:14 -0500 Subject: [PATCH 07/17] refactor SSR page bundling to avoid hacky entry point placeholder hack --- .gitignore | 2 +- packages/cli/src/config/rollup.config.js | 31 ++----------- packages/cli/src/lifecycles/bundle.js | 10 +++-- packages/cli/src/lifecycles/serve.js | 2 +- .../build.plugins.adapter/generic-adapter.js | 2 +- .../serve.default.ssr.spec.js | 15 +++---- packages/plugin-adapter-netlify/src/index.js | 45 +++++++------------ packages/plugin-adapter-vercel/src/index.js | 26 ++++++----- 8 files changed, 50 insertions(+), 83 deletions(-) diff --git a/.gitignore b/.gitignore index a56ab6ff6..eaa6b83a2 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,4 @@ packages/**/test/**/netlify packages/**/test/**/.netlify packages/**/test/**/.vercel public/ -adapter-outlet/ \ No newline at end of file +adapter-output/ \ No newline at end of file diff --git a/packages/cli/src/config/rollup.config.js b/packages/cli/src/config/rollup.config.js index a2955e113..8cb5166f1 100644 --- a/packages/cli/src/config/rollup.config.js +++ b/packages/cli/src/config/rollup.config.js @@ -252,30 +252,6 @@ function greenwoodImportMetaUrl(compilation) { }; } -// TODO could we use this instead? -// https://github.com/rollup/rollup/blob/v2.79.1/docs/05-plugin-development.md#resolveimportmeta -// https://github.com/ProjectEvergreen/greenwood/issues/1087 -function greenwoodPatchSsrPagesEntryPointRuntimeImport() { - return { - name: 'greenwood-patch-ssr-pages-entry-point-runtime-import', - generateBundle(options, bundle) { - Object.keys(bundle).forEach((key) => { - if (key.startsWith('__')) { - // ___GWD_ENTRY_FILE_URL=${filename}___ - const needle = bundle[key].code.match(/___GWD_ENTRY_FILE_URL=(.*.)___/); - if (needle) { - const entryPathMatch = needle[1]; - - bundle[key].code = bundle[key].code.replace(/'___GWD_ENTRY_FILE_URL=(.*.)___'/, `new URL('./_${entryPathMatch}', import.meta.url)`); - } else { - console.warn(`Could not find entry path match for bundle => ${key}`); - } - } - }); - } - }; -} - const getRollupConfigForScriptResources = async (compilation) => { const { outputDir } = compilation.context; const input = [...compilation.resources.values()] @@ -370,8 +346,8 @@ const getRollupConfigForSsr = async (compilation, input) => { input: filepath, output: { dir: normalizePathnameForWindows(outputDir), - entryFileNames: '_[name].js', - chunkFileNames: '[name].[hash].js' + entryFileNames: '[name].entry.js', + chunkFileNames: '[name].chunk.[hash].js' }, plugins: [ greenwoodResourceLoader(compilation), @@ -383,8 +359,7 @@ const getRollupConfigForSsr = async (compilation, input) => { preferBuiltins: true }), commonjs(), - greenwoodImportMetaUrl(compilation), - greenwoodPatchSsrPagesEntryPointRuntimeImport() // TODO a little hacky but works for now + greenwoodImportMetaUrl(compilation) ], onwarn: (errorObj) => { const { code, message } = errorObj; diff --git a/packages/cli/src/lifecycles/bundle.js b/packages/cli/src/lifecycles/bundle.js index 9bd0c3726..ea226bedc 100644 --- a/packages/cli/src/lifecycles/bundle.js +++ b/packages/cli/src/lifecycles/bundle.js @@ -217,12 +217,14 @@ async function bundleSsrPages(compilation) { for (const page of compilation.graph) { if (page.isSSR && !page.prerender) { const { filename, imports, route, template, title } = page; - const entryFileUrl = new URL(`./_${filename}`, scratchDir); + const entryFileUrl = new URL(`./${filename}`, scratchDir); const moduleUrl = new URL(`./${filename}`, pagesDir); const request = new Request(moduleUrl); // TODO not really sure how to best no-op this? // TODO getTemplate has to be static (for now?) // https://github.com/ProjectEvergreen/greenwood/issues/955 const data = await executeRouteModule({ moduleUrl, compilation, page, prerender: false, htmlContents: null, scripts: [], request }); + const pagesPathDiff = compilation.context.pagesDir.pathname.replace(compilation.context.projectDirectory.pathname, ''); + let staticHtml = ''; staticHtml = data.template ? data.template : await getPageTemplate(staticHtml, compilation.context, template, []); @@ -233,13 +235,16 @@ async function bundleSsrPages(compilation) { staticHtml = staticHtml.replace(/[`\\$]/g, '\\$&'); // https://stackoverflow.com/a/75688937/417806 // better way to write out this inline code? + // using a URL here produces a bundled chunk, but at leasts its bundled await fs.writeFile(entryFileUrl, ` import { executeRouteModule } from '${normalizePathnameForWindows(executeModuleUrl)}'; + const moduleUrl = new URL('../${pagesPathDiff}/${filename}', import.meta.url); + export async function handler(request) { const compilation = JSON.parse('${JSON.stringify(compilation)}'); const page = JSON.parse('${JSON.stringify(page)}'); - const moduleUrl = '___GWD_ENTRY_FILE_URL=${filename}___'; + // const moduleUrl = '___GWD_ENTRY_FILE_URL=${filename}___'; const data = await executeRouteModule({ moduleUrl, compilation, page, request }); let staticHtml = \`${staticHtml}\`; @@ -255,7 +260,6 @@ async function bundleSsrPages(compilation) { } `); - input.push(normalizePathnameForWindows(moduleUrl)); input.push(normalizePathnameForWindows(entryFileUrl)); } } diff --git a/packages/cli/src/lifecycles/serve.js b/packages/cli/src/lifecycles/serve.js index 903af038c..6a583c779 100644 --- a/packages/cli/src/lifecycles/serve.js +++ b/packages/cli/src/lifecycles/serve.js @@ -317,7 +317,7 @@ async function getHybridServer(compilation) { }); worker.postMessage({ - routeModuleUrl: new URL(`./__${matchingRoute.filename}`, outputDir).href, + routeModuleUrl: new URL(`./${matchingRoute.id}.entry.js`, outputDir).href, request, compilation: JSON.stringify(compilation) }); diff --git a/packages/cli/test/cases/build.plugins.adapter/generic-adapter.js b/packages/cli/test/cases/build.plugins.adapter/generic-adapter.js index dbf07037f..a6752411b 100644 --- a/packages/cli/test/cases/build.plugins.adapter/generic-adapter.js +++ b/packages/cli/test/cases/build.plugins.adapter/generic-adapter.js @@ -3,7 +3,7 @@ import { checkResourceExists } from '../../../../cli/src/lib/resource-utils.js'; function generateOutputFormat(id, type) { const path = type === 'page' - ? `__${id}` + ? `${id}.entry` : `api/${id}`; return ` diff --git a/packages/cli/test/cases/serve.default.ssr/serve.default.ssr.spec.js b/packages/cli/test/cases/serve.default.ssr/serve.default.ssr.spec.js index d19428e48..3a2a20b79 100644 --- a/packages/cli/test/cases/serve.default.ssr/serve.default.ssr.spec.js +++ b/packages/cli/test/cases/serve.default.ssr/serve.default.ssr.spec.js @@ -90,9 +90,8 @@ describe('Serve Greenwood With: ', function() { expect(headings[0].textContent).to.equal('Hello from the server rendered home page!'); }); - it('should have the expected bundled SSR output for the page', async function() { - const scriptFiles = (await glob.promise(path.join(this.context.publicDir, '*.js'))) - .filter(file => file.indexOf('index.js') >= 0); + it('should have the expected bundled SSR output for the page entry point and chunk file', async function() { + const scriptFiles = await glob.promise(path.join(this.context.publicDir, 'index*.js')); expect(scriptFiles.length).to.equal(2); }); @@ -226,9 +225,8 @@ describe('Serve Greenwood With: ', function() { expect(resources.find(resource => resource.endsWith('/header.js'))).to.not.be.undefined; }); - it('should have the expected bundled SSR output for the page', async function() { - const scriptFiles = (await glob.promise(path.join(this.context.publicDir, '*.js'))) - .filter(file => file.indexOf('artists.js') >= 0); + it('should have the expected bundled SSR output for the page entry point and chunk file', async function() { + const scriptFiles = await glob.promise(path.join(this.context.publicDir, 'artists*.js')); expect(scriptFiles.length).to.equal(2); }); @@ -264,9 +262,8 @@ describe('Serve Greenwood With: ', function() { expect(cards.length).to.be.greaterThan(0); }); - it('should have the expected bundled SSR output for the page', async function() { - const scriptFiles = (await glob.promise(path.join(this.context.publicDir, '*.js'))) - .filter(file => file.indexOf('users.js') >= 0); + it('should have the expected bundled SSR output for the page entry point and chunk file', async function() { + const scriptFiles = await glob.promise(path.join(this.context.publicDir, 'users*.js')); expect(scriptFiles.length).to.equal(2); }); diff --git a/packages/plugin-adapter-netlify/src/index.js b/packages/plugin-adapter-netlify/src/index.js index 4e1b47b1b..d695198dc 100644 --- a/packages/plugin-adapter-netlify/src/index.js +++ b/packages/plugin-adapter-netlify/src/index.js @@ -8,7 +8,7 @@ function generateOutputFormat(id) { const handlerAlias = '$handler'; return ` - import { handler as ${handlerAlias} } from './__${id}.js'; + import { handler as ${handlerAlias} } from './${id}.js'; export async function handler (event, context = {}) { const { rawUrl, body, headers = {}, httpMethod } = event; @@ -52,10 +52,9 @@ function generateOutputFormat(id) { } async function setupOutputDirectory(id, outputRoot, outputType) { - const outputFormat = generateOutputFormat(id, outputType); - const filename = outputType === 'api' - ? `api-${id}` - : `${id}`; + const entryPoint = outputType === 'api' ? id : `${id}.entry`; + const filename = outputType === 'api' ? `api-${id}` : id; + const outputFormat = generateOutputFormat(entryPoint, outputType); await fs.mkdir(outputRoot, { recursive: true }); await fs.writeFile(new URL(`./${filename}.js`, outputRoot), outputFormat); @@ -64,7 +63,7 @@ async function setupOutputDirectory(id, outputRoot, outputType) { })); } -// TODO manifest options, like node version? +// TODO do we need more manifest options, like node version? // https://github.com/netlify/zip-it-and-ship-it#options async function createOutputZip(id, outputType, outputRootUrl, projectDirectory) { const filename = outputType === 'api' @@ -98,35 +97,23 @@ async function netlifyAdapter(compilation) { const { id } = page; const outputType = 'page'; const outputRoot = new URL(`./${id}/`, adapterOutputUrl); + const files = (await fs.readdir(outputDir)) + .filter(file => file.startsWith(`${id}.chunk.`) && file.endsWith('.js')); await setupOutputDirectory(id, outputRoot, outputType); - // one for the user's actual file + // handle user's actual route entry file await fs.cp( - new URL(`./_${id}.js`, outputDir), - new URL(`./_${id}.js`, outputRoot), + new URL(`./${id}.entry.js`, outputDir), + new URL(`./${id}.entry.js`, outputRoot), { recursive: true } ); - // and one to act as the entry point into it (as produced by Greenwood CLI) - await fs.cp( - new URL(`./__${id}.js`, outputDir), - new URL(`./__${id}.js`, outputRoot), - { recursive: true } - ); - - // need this for URL referenced chunks - // ideally we would map bundles to pages to avoid copying the same files into every function - const ssrPageAssets = (await fs.readdir(outputDir)) - .filter(file => !path.basename(file).startsWith('_') - && !path.basename(file).startsWith('execute') - && path.basename(file).endsWith('.js') - ); - - for (const asset of ssrPageAssets) { + // and the URL chunk for renderer plugin and executeRouteModule + for (const file of files) { await fs.cp( - new URL(`./${asset}`, outputDir), - new URL(`./${asset}`, outputRoot), + new URL(`./${file}`, outputDir), + new URL(`./${file}`, outputRoot), { recursive: true } ); } @@ -150,12 +137,12 @@ async function netlifyAdapter(compilation) { await fs.cp( new URL(`./api/${id}.js`, outputDir), - new URL(`./__${id}.js`, outputRoot), + new URL(`./${id}.js`, outputRoot), { recursive: true } ); // need this for URL referenced chunks - // ideally we would map bundles to pages to avoid copying the same files into every function + // TODO ideally we would map bundles to specific API routes instead of copying all files just in case const ssrApiAssets = (await fs.readdir(new URL('./api/', outputDir))) .filter(file => new RegExp(/^[\w][\w-]*\.[a-zA-Z0-9]{4,20}\.[\w]{2,4}$/).test(path.basename(file))); diff --git a/packages/plugin-adapter-vercel/src/index.js b/packages/plugin-adapter-vercel/src/index.js index 163e81035..e10de9aca 100644 --- a/packages/plugin-adapter-vercel/src/index.js +++ b/packages/plugin-adapter-vercel/src/index.js @@ -6,7 +6,7 @@ import { checkResourceExists } from '@greenwood/cli/src/lib/resource-utils.js'; function generateOutputFormat(id, type) { const handlerAlias = '$handler'; const path = type === 'page' - ? `__${id}` + ? `${id}.entry` : id; return ` @@ -86,22 +86,26 @@ async function vercelAdapter(compilation) { const outputType = 'page'; const { id } = page; const outputRoot = new URL(`./${basePath}/${id}.func/`, adapterOutputUrl); + const files = (await fs.readdir(outputDir)) + .filter(file => file.startsWith(`${id}.chunk.`) && file.endsWith('.js')); await setupFunctionBuildFolder(id, outputType, outputRoot); - // one for the user's actual file + // handle user's actual route entry file await fs.cp( - new URL(`./_${id}.js`, outputDir), - new URL(`./_${id}.js`, outputRoot), + new URL(`./${id}.entry.js`, outputDir), + new URL(`./${id}.entry.js`, outputRoot), { recursive: true } ); - // and one to act as the entry point into it (as produced by Greenwood CLI) - await fs.cp( - new URL(`./__${id}.js`, outputDir), - new URL(`./__${id}.js`, outputRoot), - { recursive: true } - ); + // and the URL chunk for renderer plugin and executeRouteModule + for (const file of files) { + await fs.cp( + new URL(`./${file}`, outputDir), + new URL(`./${file}`, outputRoot), + { recursive: true } + ); + } } for (const [key] of apiRoutes) { @@ -118,7 +122,7 @@ async function vercelAdapter(compilation) { ); // need this for URL referenced chunks - // ideally we would map bundles to pages to avoid copying the same files into every function + // TODO ideally we would map bundles to specific API routes instead of copying all files just in case const ssrApiAssets = (await fs.readdir(new URL('./api/', outputDir))) .filter(file => new RegExp(/^[\w][\w-]*\.[a-zA-Z0-9]{4,20}\.[\w]{2,4}$/).test(path.basename(file))); From 1cb8855c7a91c9269ed599ac0a2b24f5cf5cdcf8 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sat, 17 Feb 2024 19:56:31 -0500 Subject: [PATCH 08/17] patch custom element registry check from wcc --- package.json | 4 +- patches/wc-compiler+0.10.0.patch | 82 +++++++++++++ yarn.lock | 195 ++++++++++++++++++++++++++++++- 3 files changed, 279 insertions(+), 2 deletions(-) create mode 100644 patches/wc-compiler+0.10.0.patch diff --git a/package.json b/package.json index fe99893d8..b9bc39c88 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,8 @@ "lint:js": "eslint \"*.{js,md}\" \"./packages/**/**/*.{js,md}\" \"./test/*.js\" \"./www/**/**/*.{js,md}\"", "lint:ts": "eslint \"./packages/**/**/*.ts\"", "lint:css": "stylelint \"./www/**/*.js\", \"./www/**/*.css\"", - "lint": "ls-lint && yarn lint:js && yarn lint:ts && yarn lint:css" + "lint": "ls-lint && yarn lint:js && yarn lint:ts && yarn lint:css", + "postinstall": "patch-package" }, "resolutions": { "lit": "^3.1.0" @@ -48,6 +49,7 @@ "jsdom": "^16.5.0", "lerna": "^3.16.4", "mocha": "^9.1.3", + "patch-package": "^8.0.0", "rimraf": "^2.6.3", "stylelint": "^13.8.0", "stylelint-a11y": "^1.2.3", diff --git a/patches/wc-compiler+0.10.0.patch b/patches/wc-compiler+0.10.0.patch new file mode 100644 index 000000000..d66725d9a --- /dev/null +++ b/patches/wc-compiler+0.10.0.patch @@ -0,0 +1,82 @@ +diff --git a/node_modules/wc-compiler/src/dom-shim.js b/node_modules/wc-compiler/src/dom-shim.js +index 389b996..645b884 100644 +--- a/node_modules/wc-compiler/src/dom-shim.js ++++ b/node_modules/wc-compiler/src/dom-shim.js +@@ -31,6 +31,18 @@ class Element extends Node { + this.attributes = {}; + } + ++ attachShadow(options) { ++ this.shadowRoot = new ShadowRoot(options); ++ ++ return this.shadowRoot; ++ } ++ ++ // https://github.com/mfreed7/declarative-shadow-dom/blob/master/README.md#serialization ++ // eslint-disable-next-line ++ getInnerHTML() { ++ return this.shadowRoot ? this.shadowRoot.innerHTML : this.innerHTML; ++ } ++ + setAttribute(name, value) { + this.attributes[name] = value; + } +@@ -68,19 +80,7 @@ class Document extends Node { + // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement + // EventTarget <- Node <- Element <- HTMLElement + class HTMLElement extends Element { +- attachShadow(options) { +- this.shadowRoot = new ShadowRoot(options); +- +- return this.shadowRoot; +- } +- + connectedCallback() { } +- +- // https://github.com/mfreed7/declarative-shadow-dom/blob/master/README.md#serialization +- // eslint-disable-next-line +- getInnerHTML(options = {}) { +- return this.shadowRoot.innerHTML; +- } + } + + // https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment +@@ -123,15 +123,20 @@ class HTMLTemplateElement extends HTMLElement { + // https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry + class CustomElementsRegistry { + constructor() { +- this.customElementsRegistry = {}; ++ // TODO this should probably be a set ++ this.customElementsRegistry = new Map(); + } + + define(tagName, BaseClass) { +- this.customElementsRegistry[tagName] = BaseClass; ++ this.customElementsRegistry.set(tagName, BaseClass); + } + + get(tagName) { +- return this.customElementsRegistry[tagName]; ++ if(this.customElementsRegistry.get(tagName)) { ++ return this.customElementsRegistry.get(tagName) ++ } else { ++ // uh oh... ++ } + } + } + +diff --git a/node_modules/wc-compiler/src/wcc.js b/node_modules/wc-compiler/src/wcc.js +index 887e0b6..9bad926 100644 +--- a/node_modules/wc-compiler/src/wcc.js ++++ b/node_modules/wc-compiler/src/wcc.js +@@ -134,9 +134,7 @@ async function initializeCustomElement(elementURL, tagName, attrs = [], definiti + + // https://github.com/ProjectEvergreen/wcc/pull/67/files#r902061804 + const { pathname } = elementURL; +- const element = tagName +- ? customElements.get(tagName) +- : (await import(pathname)).default; ++ const element = customElements.get(tagName) ?? (await import(pathname)).default; + const dataLoader = (await import(pathname)).getData; + const data = props + ? props diff --git a/yarn.lock b/yarn.lock index e09df1dad..4f3289d57 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4466,6 +4466,11 @@ merge-options "^3.0.4" p-event "^5.0.1" +"@yarnpkg/lockfile@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31" + integrity sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ== + "@zkochan/cmd-shim@^3.1.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@zkochan/cmd-shim/-/cmd-shim-3.1.0.tgz#2ab8ed81f5bb5452a85f25758eb9b8681982fd2e" @@ -5175,6 +5180,11 @@ asynckit@^0.4.0: resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= +at-least-node@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2" + integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg== + atob-lite@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/atob-lite/-/atob-lite-2.0.0.tgz#0fef5ad46f1bd7a8502c65727f0367d5ee43d696" @@ -5707,6 +5717,17 @@ call-bind@^1.0.0, call-bind@^1.0.2: function-bind "^1.1.1" get-intrinsic "^1.0.2" +call-bind@^1.0.5: + version "1.0.7" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.7.tgz#06016599c40c56498c18769d2730be242b6fa3b9" + integrity sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w== + dependencies: + es-define-property "^1.0.0" + es-errors "^1.3.0" + function-bind "^1.1.2" + get-intrinsic "^1.2.4" + set-function-length "^1.2.1" + call-me-maybe@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/call-me-maybe/-/call-me-maybe-1.0.1.tgz#26d208ea89e37b5cbde60250a15f031c16a4d66b" @@ -5967,6 +5988,11 @@ ci-info@^2.0.0: resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== +ci-info@^3.7.0: + version "3.9.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4" + integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== + cjs-module-lexer@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.0.0.tgz#c125ff0f4ab2c898dda909352f254d55e2213261" @@ -6942,6 +6968,15 @@ defer-to-connect@^2.0.1: resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-2.0.1.tgz#8016bdb4143e4632b77a3449c6236277de520587" integrity sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg== +define-data-property@^1.1.2: + version "1.1.4" + resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.4.tgz#894dc141bb7d3060ae4366f6a0107e68fbe48c5e" + integrity sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A== + dependencies: + es-define-property "^1.0.0" + es-errors "^1.3.0" + gopd "^1.0.1" + define-lazy-prop@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz#3f7ae421129bcaaac9bc74905c98a0009ec9ee7f" @@ -7476,6 +7511,18 @@ es-abstract@^1.18.0-next.2: string.prototype.trimstart "^1.0.4" unbox-primitive "^1.0.0" +es-define-property@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.0.tgz#c7faefbdff8b2696cf5f46921edfb77cc4ba3845" + integrity sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ== + dependencies: + get-intrinsic "^1.2.4" + +es-errors@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" + integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== + es-module-lexer@^1.0.0: version "1.3.0" resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.3.0.tgz#6be9c9e0b4543a60cd166ff6f8b4e9dae0b0c16f" @@ -8289,6 +8336,13 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" +find-yarn-workspace-root@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz#f47fb8d239c900eb78179aa81b66673eac88f7bd" + integrity sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ== + dependencies: + micromatch "^4.0.2" + flat-cache@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" @@ -8473,6 +8527,16 @@ fs-extra@^8.1.0: jsonfile "^4.0.0" universalify "^0.1.0" +fs-extra@^9.0.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" + integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== + dependencies: + at-least-node "^1.0.0" + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" + fs-minipass@^1.2.5: version "1.2.7" resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7" @@ -8517,6 +8581,11 @@ function-bind@^1.1.1: resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== +function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== + fuzzy@0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/fuzzy/-/fuzzy-0.1.3.tgz#4c76ec2ff0ac1a36a9dccf9a00df8623078d4ed8" @@ -8602,6 +8671,17 @@ get-intrinsic@^1.1.1: has "^1.0.3" has-symbols "^1.0.1" +get-intrinsic@^1.1.3, get-intrinsic@^1.2.3, get-intrinsic@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.4.tgz#e385f5a4b5227d449c3eabbad05494ef0abbeadd" + integrity sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ== + dependencies: + es-errors "^1.3.0" + function-bind "^1.1.2" + has-proto "^1.0.1" + has-symbols "^1.0.3" + hasown "^2.0.0" + get-pkg-repo@^1.0.0: version "1.4.0" resolved "https://registry.yarnpkg.com/get-pkg-repo/-/get-pkg-repo-1.4.0.tgz#c73b489c06d80cc5536c2c853f9e05232056972d" @@ -8950,6 +9030,13 @@ good-listener@^1.2.2: dependencies: delegate "^3.1.2" +gopd@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" + integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA== + dependencies: + get-intrinsic "^1.1.3" + got@^12.0.0, got@^12.1.0, got@^12.3.1, got@^12.6.1: version "12.6.1" resolved "https://registry.yarnpkg.com/got/-/got-12.6.1.tgz#8869560d1383353204b5a9435f782df9c091f549" @@ -9113,6 +9200,18 @@ has-own-prop@^2.0.0: resolved "https://registry.yarnpkg.com/has-own-prop/-/has-own-prop-2.0.0.tgz#f0f95d58f65804f5d218db32563bb85b8e0417af" integrity sha512-Pq0h+hvsVm6dDEa8x82GnLSYHOzNDt7f0ddFa3FqcQlgzEiptPqL+XrOJNavjOzSYiYWIrgeVYYgGlLmnxwilQ== +has-property-descriptors@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz#963ed7d071dc7bf5f084c5bfbe0d1b6222586854" + integrity sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg== + dependencies: + es-define-property "^1.0.0" + +has-proto@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.1.tgz#1885c1305538958aff469fef37937c22795408e0" + integrity sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg== + has-symbols@^1.0.0, has-symbols@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8" @@ -9191,6 +9290,13 @@ hasha@5.2.2: is-stream "^2.0.0" type-fest "^0.8.0" +hasown@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.1.tgz#26f48f039de2c0f8d3356c223fb8d50253519faa" + integrity sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA== + dependencies: + function-bind "^1.1.2" + hast-to-hyperscript@^9.0.0: version "9.0.1" resolved "https://registry.yarnpkg.com/hast-to-hyperscript/-/hast-to-hyperscript-9.0.1.tgz#9b67fd188e4c81e8ad66f803855334173920218d" @@ -10257,7 +10363,7 @@ is-word-character@^1.0.0: resolved "https://registry.yarnpkg.com/is-word-character/-/is-word-character-1.0.4.tgz#ce0e73216f98599060592f62ff31354ddbeb0230" integrity sha512-5SMO8RVennx3nZrqtKwCGyyetPE9VDba5ugvKLaD4KopPG5kR4mQ7tNt/r7feL5yt5h3lpuBbIUmCOG2eSzXHA== -is-wsl@2.2.0, is-wsl@^2.2.0: +is-wsl@2.2.0, is-wsl@^2.1.1, is-wsl@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww== @@ -10274,6 +10380,11 @@ isarray@1.0.0, isarray@~1.0.0: resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= +isarray@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" + integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw== + iserror@0.0.2, iserror@^0.0.2: version "0.0.2" resolved "https://registry.yarnpkg.com/iserror/-/iserror-0.0.2.tgz#bd53451fe2f668b9f2402c1966787aaa2c7c0bf5" @@ -10471,6 +10582,16 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== +json-stable-stringify@^1.0.2: + version "1.1.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.1.1.tgz#52d4361b47d49168bcc4e564189a42e5a7439454" + integrity sha512-SU/971Kt5qVQfJpyDveVhQ/vya+5hvrjClFOcr8c0Fq5aODJjMwutrOfCU+eCnVD5gpx1Q3fEqkyom77zH1iIg== + dependencies: + call-bind "^1.0.5" + isarray "^2.0.5" + jsonify "^0.0.1" + object-keys "^1.1.1" + json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" @@ -10493,6 +10614,20 @@ jsonfile@^4.0.0: optionalDependencies: graceful-fs "^4.1.6" +jsonfile@^6.0.1: + version "6.1.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" + integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ== + dependencies: + universalify "^2.0.0" + optionalDependencies: + graceful-fs "^4.1.6" + +jsonify@^0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.1.tgz#2aa3111dae3d34a0f151c63f3a45d995d9420978" + integrity sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg== + jsonparse@^1.2.0: version "1.3.1" resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" @@ -10595,6 +10730,13 @@ kind-of@^6.0.0, kind-of@^6.0.2, kind-of@^6.0.3: resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== +klaw-sync@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/klaw-sync/-/klaw-sync-6.0.0.tgz#1fd2cfd56ebb6250181114f0a581167099c2b28c" + integrity sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ== + dependencies: + graceful-fs "^4.1.11" + known-css-properties@^0.20.0: version "0.20.0" resolved "https://registry.yarnpkg.com/known-css-properties/-/known-css-properties-0.20.0.tgz#0570831661b47dd835293218381166090ff60e96" @@ -12592,6 +12734,14 @@ only@~0.0.2: resolved "https://registry.yarnpkg.com/only/-/only-0.0.2.tgz#2afde84d03e50b9a8edc444e30610a70295edfb4" integrity sha1-Kv3oTQPlC5qO3EROMGEKcCle37Q= +open@^7.4.2: + version "7.4.2" + resolved "https://registry.yarnpkg.com/open/-/open-7.4.2.tgz#b8147e26dcf3e426316c730089fd71edd29c2321" + integrity sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q== + dependencies: + is-docker "^2.0.0" + is-wsl "^2.1.1" + open@^8.0.4: version "8.4.2" resolved "https://registry.yarnpkg.com/open/-/open-8.4.2.tgz#5b5ffe2a8f793dcd2aad73e550cb87b59cb084f9" @@ -13038,6 +13188,27 @@ pascalcase@^0.1.1: resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= +patch-package@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/patch-package/-/patch-package-8.0.0.tgz#d191e2f1b6e06a4624a0116bcb88edd6714ede61" + integrity sha512-da8BVIhzjtgScwDJ2TtKsfT5JFWz1hYoBl9rUQ1f38MC2HwnEIkK8VN3dKMKcP7P7bvvgzNDbfNHtx3MsQb5vA== + dependencies: + "@yarnpkg/lockfile" "^1.1.0" + chalk "^4.1.2" + ci-info "^3.7.0" + cross-spawn "^7.0.3" + find-yarn-workspace-root "^2.0.0" + fs-extra "^9.0.0" + json-stable-stringify "^1.0.2" + klaw-sync "^6.0.0" + minimist "^1.2.6" + open "^7.4.2" + rimraf "^2.6.3" + semver "^7.5.3" + slash "^2.0.0" + tmp "^0.0.33" + yaml "^2.2.2" + path-dirname@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0" @@ -14921,6 +15092,18 @@ set-cookie-parser@^2.4.1: resolved "https://registry.yarnpkg.com/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz#131921e50f62ff1a66a461d7d62d7b21d5d15a51" integrity sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ== +set-function-length@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.1.tgz#47cc5945f2c771e2cf261c6737cf9684a2a5e425" + integrity sha512-j4t6ccc+VsKwYHso+kElc5neZpjtq9EnRICFZtWyBsLojhmeF/ZBd/elqm22WJh/BziDe/SBiOeAt0m2mfLD0g== + dependencies: + define-data-property "^1.1.2" + es-errors "^1.3.0" + function-bind "^1.1.2" + get-intrinsic "^1.2.3" + gopd "^1.0.1" + has-property-descriptors "^1.0.1" + set-getter@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/set-getter/-/set-getter-0.1.0.tgz#d769c182c9d5a51f409145f2fba82e5e86e80376" @@ -16601,6 +16784,11 @@ universalify@^0.1.0, universalify@^0.1.2: resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== +universalify@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.1.tgz#168efc2180964e6386d061e094df61afe239b18d" + integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw== + unix-dgram@2.x: version "2.0.6" resolved "https://registry.yarnpkg.com/unix-dgram/-/unix-dgram-2.0.6.tgz#6d567b0eb6d7a9504e561532b598a46e34c5968b" @@ -17232,6 +17420,11 @@ yaml@^2.1.3: resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.3.1.tgz#02fe0975d23cd441242aa7204e09fc28ac2ac33b" integrity sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ== +yaml@^2.2.2: + version "2.3.4" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.3.4.tgz#53fc1d514be80aabf386dc6001eb29bf3b7523b2" + integrity sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA== + yargs-parser@20.2.4, yargs-parser@^20.2.3: version "20.2.4" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54" From 047bbfa1f203e7cca24beb13c456660513ed02d9 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sat, 17 Feb 2024 20:30:41 -0500 Subject: [PATCH 09/17] refactor SSR page output name from .entry to .route --- packages/cli/src/config/rollup.config.js | 4 ++-- packages/cli/src/lifecycles/serve.js | 2 +- .../test/cases/build.plugins.adapter/generic-adapter.js | 2 +- packages/plugin-adapter-netlify/src/index.js | 8 ++++---- packages/plugin-adapter-vercel/src/index.js | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/cli/src/config/rollup.config.js b/packages/cli/src/config/rollup.config.js index 8cb5166f1..419eb8cfd 100644 --- a/packages/cli/src/config/rollup.config.js +++ b/packages/cli/src/config/rollup.config.js @@ -346,8 +346,8 @@ const getRollupConfigForSsr = async (compilation, input) => { input: filepath, output: { dir: normalizePathnameForWindows(outputDir), - entryFileNames: '[name].entry.js', - chunkFileNames: '[name].chunk.[hash].js' + entryFileNames: '[name].route.js', + chunkFileNames: '[name].route.chunk.[hash].js' }, plugins: [ greenwoodResourceLoader(compilation), diff --git a/packages/cli/src/lifecycles/serve.js b/packages/cli/src/lifecycles/serve.js index 6a583c779..4aee8fec0 100644 --- a/packages/cli/src/lifecycles/serve.js +++ b/packages/cli/src/lifecycles/serve.js @@ -317,7 +317,7 @@ async function getHybridServer(compilation) { }); worker.postMessage({ - routeModuleUrl: new URL(`./${matchingRoute.id}.entry.js`, outputDir).href, + routeModuleUrl: new URL(`./${matchingRoute.id}.route.js`, outputDir).href, request, compilation: JSON.stringify(compilation) }); diff --git a/packages/cli/test/cases/build.plugins.adapter/generic-adapter.js b/packages/cli/test/cases/build.plugins.adapter/generic-adapter.js index a6752411b..8fc6141ba 100644 --- a/packages/cli/test/cases/build.plugins.adapter/generic-adapter.js +++ b/packages/cli/test/cases/build.plugins.adapter/generic-adapter.js @@ -3,7 +3,7 @@ import { checkResourceExists } from '../../../../cli/src/lib/resource-utils.js'; function generateOutputFormat(id, type) { const path = type === 'page' - ? `${id}.entry` + ? `${id}.route` : `api/${id}`; return ` diff --git a/packages/plugin-adapter-netlify/src/index.js b/packages/plugin-adapter-netlify/src/index.js index d695198dc..135e007cd 100644 --- a/packages/plugin-adapter-netlify/src/index.js +++ b/packages/plugin-adapter-netlify/src/index.js @@ -52,7 +52,7 @@ function generateOutputFormat(id) { } async function setupOutputDirectory(id, outputRoot, outputType) { - const entryPoint = outputType === 'api' ? id : `${id}.entry`; + const entryPoint = outputType === 'api' ? id : `${id}.route`; const filename = outputType === 'api' ? `api-${id}` : id; const outputFormat = generateOutputFormat(entryPoint, outputType); @@ -98,14 +98,14 @@ async function netlifyAdapter(compilation) { const outputType = 'page'; const outputRoot = new URL(`./${id}/`, adapterOutputUrl); const files = (await fs.readdir(outputDir)) - .filter(file => file.startsWith(`${id}.chunk.`) && file.endsWith('.js')); + .filter(file => file.startsWith(`${id}.route.chunk.`) && file.endsWith('.js')); await setupOutputDirectory(id, outputRoot, outputType); // handle user's actual route entry file await fs.cp( - new URL(`./${id}.entry.js`, outputDir), - new URL(`./${id}.entry.js`, outputRoot), + new URL(`./${id}.route.js`, outputDir), + new URL(`./${id}.route.js`, outputRoot), { recursive: true } ); diff --git a/packages/plugin-adapter-vercel/src/index.js b/packages/plugin-adapter-vercel/src/index.js index e10de9aca..2bc5b622f 100644 --- a/packages/plugin-adapter-vercel/src/index.js +++ b/packages/plugin-adapter-vercel/src/index.js @@ -6,7 +6,7 @@ import { checkResourceExists } from '@greenwood/cli/src/lib/resource-utils.js'; function generateOutputFormat(id, type) { const handlerAlias = '$handler'; const path = type === 'page' - ? `${id}.entry` + ? `${id}.route` : id; return ` @@ -87,14 +87,14 @@ async function vercelAdapter(compilation) { const { id } = page; const outputRoot = new URL(`./${basePath}/${id}.func/`, adapterOutputUrl); const files = (await fs.readdir(outputDir)) - .filter(file => file.startsWith(`${id}.chunk.`) && file.endsWith('.js')); + .filter(file => file.startsWith(`${id}.route.chunk.`) && file.endsWith('.js')); await setupFunctionBuildFolder(id, outputType, outputRoot); // handle user's actual route entry file await fs.cp( - new URL(`./${id}.entry.js`, outputDir), - new URL(`./${id}.entry.js`, outputRoot), + new URL(`./${id}.route.js`, outputDir), + new URL(`./${id}.route.js`, outputRoot), { recursive: true } ); From 96214d630167b215aca19a07e0d4bc4c9600266f Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sat, 17 Feb 2024 20:32:37 -0500 Subject: [PATCH 10/17] document breaking changes for adapter plugins --- www/pages/plugins/adapter.md | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/www/pages/plugins/adapter.md b/www/pages/plugins/adapter.md index 76bab683b..5c5a75037 100644 --- a/www/pages/plugins/adapter.md +++ b/www/pages/plugins/adapter.md @@ -46,7 +46,7 @@ import { checkResourceExists } from '../../../../cli/src/lib/resource-utils.js'; function generateOutputFormat(id, type) { const path = type === 'page' - ? `__${id}` + ? `${id}.entry` : `api/${id}`; return ` @@ -75,15 +75,29 @@ async function genericAdapter(compilation) { for (const page of ssrPages) { const { id } = page; const outputFormat = generateOutputFormat(id, 'page'); + const files = (await fs.readdir(outputDir)) + .filter(file => file.startsWith(`${id}.route.chunk.`) && file.endsWith('.js')); + + // generate a facade for all SSR pages for your particular hosting provider + await fs.writeFile(new URL('./index.js', adapterOutputUrl), outputFormat); + + // handle user's actual route entry file, appended with .route by Greenwood + await fs.cp( + new URL(`./${id}.route.js`, outputDir), + new URL(`./${id}.route.js`, outputRoot), + { recursive: true } + ); + + // and the URL chunk for renderer plugin and executeRouteModule + for (const file of files) { + await fs.cp( + new URL(`./${file}`, outputDir), + new URL(`./${file}`, outputRoot), + { recursive: true } + ); + } - // generate a shim for all SSR pages - await fs.writeFile(new URL(`./${id}.js`, adapterOutputUrl), outputFormat); - - // copy all entry points - await fs.cp(new URL(`./_${id}.js`, outputDir), new URL(`./_${id}.js`, adapterOutputUrl)); - await fs.cp(new URL(`./__${id}.js`, outputDir), new URL(`./_${id}.js`, adapterOutputUrl)); - - // generate a manifest + // generate a manifest (if hosting provider requires it, for example) await fs.writeFile(new URL('./metadata.json', adapterOutputUrl), JSON.stringify({ version: '1.0.0', runtime: 'nodejs' From a3ecafc67e60586eaa520ed2761f959420d10070 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sat, 17 Feb 2024 21:28:30 -0500 Subject: [PATCH 11/17] refactor import meta relative asset path escaping --- packages/cli/src/config/rollup.config.js | 9 ++++----- packages/cli/src/lifecycles/bundle.js | 3 +-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/cli/src/config/rollup.config.js b/packages/cli/src/config/rollup.config.js index 419eb8cfd..c225d7820 100644 --- a/packages/cli/src/config/rollup.config.js +++ b/packages/cli/src/config/rollup.config.js @@ -121,7 +121,8 @@ function greenwoodSyncPageResourceBundlesPlugin(compilation) { } function getMetaImportPath(node) { - return node.arguments[0].value.split('/').join(path.sep); + return node.arguments[0].value.split('/').join(path.sep) + .replace(/\\/g, '/') // handle Windows style paths } function isNewUrlImportMetaUrl(node) { @@ -235,13 +236,11 @@ function greenwoodImportMetaUrl(compilation) { ? { type, id: normalizePathnameForWindows(url), name } : { type, name: assetName, source: assetContents }; const ref = this.emitFile(emitConfig); - // handle Windows style paths - const normalizedRelativeAssetPath = relativeAssetPath.replace(/\\/g, '/'); const importRef = `import.meta.ROLLUP_FILE_URL_${ref}`; modifiedCode = code - .replace(`'${normalizedRelativeAssetPath}'`, importRef) - .replace(`"${normalizedRelativeAssetPath}"`, importRef); + .replace(`'${relativeAssetPath}'`, importRef) + .replace(`"${relativeAssetPath}"`, importRef); } return { diff --git a/packages/cli/src/lifecycles/bundle.js b/packages/cli/src/lifecycles/bundle.js index ea226bedc..e3a037a7e 100644 --- a/packages/cli/src/lifecycles/bundle.js +++ b/packages/cli/src/lifecycles/bundle.js @@ -239,12 +239,11 @@ async function bundleSsrPages(compilation) { await fs.writeFile(entryFileUrl, ` import { executeRouteModule } from '${normalizePathnameForWindows(executeModuleUrl)}'; - const moduleUrl = new URL('../${pagesPathDiff}/${filename}', import.meta.url); + const moduleUrl = new URL('../${pagesPathDiff}${filename}', import.meta.url); export async function handler(request) { const compilation = JSON.parse('${JSON.stringify(compilation)}'); const page = JSON.parse('${JSON.stringify(page)}'); - // const moduleUrl = '___GWD_ENTRY_FILE_URL=${filename}___'; const data = await executeRouteModule({ moduleUrl, compilation, page, request }); let staticHtml = \`${staticHtml}\`; From 6c33ecc511d89e8020d82277bb98b3ee63d7327a Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Mon, 19 Feb 2024 09:47:31 -0500 Subject: [PATCH 12/17] refactor API routes and adapters for mapped API bundles --- packages/cli/src/config/rollup.config.js | 49 ++++++++++++++++++- packages/plugin-adapter-netlify/src/index.js | 15 ++---- .../cases/build.default/build.default.spec.js | 32 ++++++++++++ packages/plugin-adapter-vercel/src/index.js | 14 ++---- .../cases/build.default/build.default.spec.js | 20 ++++++++ 5 files changed, 110 insertions(+), 20 deletions(-) diff --git a/packages/cli/src/config/rollup.config.js b/packages/cli/src/config/rollup.config.js index c225d7820..794c9714f 100644 --- a/packages/cli/src/config/rollup.config.js +++ b/packages/cli/src/config/rollup.config.js @@ -1,3 +1,4 @@ +/* eslint-disable complexity */ import fs from 'fs'; import path from 'path'; import { checkResourceExists, normalizePathnameForWindows } from '../lib/resource-utils.js'; @@ -122,7 +123,7 @@ function greenwoodSyncPageResourceBundlesPlugin(compilation) { function getMetaImportPath(node) { return node.arguments[0].value.split('/').join(path.sep) - .replace(/\\/g, '/') // handle Windows style paths + .replace(/\\/g, '/'); // handle Windows style paths } function isNewUrlImportMetaUrl(node) { @@ -238,6 +239,28 @@ function greenwoodImportMetaUrl(compilation) { const ref = this.emitFile(emitConfig); const importRef = `import.meta.ROLLUP_FILE_URL_${ref}`; + // loop through all URL bundle chunks from APIs and SSR pages + // and map to their parent file, to pick back up in generateBundle when full hashes are known + if (id.indexOf(compilation.context.apisDir.pathname) === 0) { + for (const entry of compilation.manifest.apis.keys()) { + const apiRoute = compilation.manifest.apis.get(entry); + + if (id.endsWith(apiRoute.path)) { + const assets = apiRoute.assets || []; + + assets.push(assetUrl.url.pathname); + + compilation.manifest.apis.set(entry, { + ...apiRoute, + assets + }); + } + } + } else { + // TODO figure out how to handle URL chunk from SSR pages + // https://github.com/ProjectEvergreen/greenwood/issues/1163 + } + modifiedCode = code .replace(`'${relativeAssetPath}'`, importRef) .replace(`"${relativeAssetPath}"`, importRef); @@ -247,6 +270,30 @@ function greenwoodImportMetaUrl(compilation) { code: modifiedCode ? modifiedCode : code, map: null }; + }, + + generateBundle(options, bundles) { + for (const bundle in bundles) { + const bundleExtension = bundle.split('.').pop(); + const apiKey = `/api/${bundle.replace(`.${bundleExtension}`, '')}`; + + if (compilation.manifest.apis.has(apiKey)) { + const apiManifestDetails = compilation.manifest.apis.get(apiKey); + + for (const reference of bundles[bundle].referencedFiles) { + if (bundles[reference]) { + const assets = apiManifestDetails.assets; + const assetIdx = assets.indexOf(bundles[reference].facadeModuleId); + + assets[assetIdx] = new URL(`./api/${reference}`, compilation.context.outputDir).href; + compilation.manifest.apis.set(apiKey, { + ...apiManifestDetails, + assets + }); + } + } + } + } } }; } diff --git a/packages/plugin-adapter-netlify/src/index.js b/packages/plugin-adapter-netlify/src/index.js index 135e007cd..9a784baf4 100644 --- a/packages/plugin-adapter-netlify/src/index.js +++ b/packages/plugin-adapter-netlify/src/index.js @@ -128,11 +128,11 @@ async function netlifyAdapter(compilation) { redirects += `${basePath}/api/* /.netlify/functions/api-:splat 200`; } - for (const [key] of apiRoutes) { + for (const [key, value] of apiRoutes.entries()) { const outputType = 'api'; const id = key.replace(`${basePath}/api/`, ''); const outputRoot = new URL(`./api/${id}/`, adapterOutputUrl); - + const { assets = [] } = value; await setupOutputDirectory(id, outputRoot, outputType); await fs.cp( @@ -141,15 +141,10 @@ async function netlifyAdapter(compilation) { { recursive: true } ); - // need this for URL referenced chunks - // TODO ideally we would map bundles to specific API routes instead of copying all files just in case - const ssrApiAssets = (await fs.readdir(new URL('./api/', outputDir))) - .filter(file => new RegExp(/^[\w][\w-]*\.[a-zA-Z0-9]{4,20}\.[\w]{2,4}$/).test(path.basename(file))); - - for (const asset of ssrApiAssets) { + for (const asset of assets) { await fs.cp( - new URL(`./${asset}`, new URL('./api/', outputDir)), - new URL(`./${asset}`, outputRoot), + new URL(asset), + new URL(`./${asset.split(path.sep).pop()}`, outputRoot), { recursive: true } ); } diff --git a/packages/plugin-adapter-netlify/test/cases/build.default/build.default.spec.js b/packages/plugin-adapter-netlify/test/cases/build.default/build.default.spec.js index e51a2059d..7e7d419d1 100644 --- a/packages/plugin-adapter-netlify/test/cases/build.default/build.default.spec.js +++ b/packages/plugin-adapter-netlify/test/cases/build.default/build.default.spec.js @@ -125,6 +125,22 @@ describe('Build Greenwood With: ', function() { expect(headers.get('content-type')).to.be.equal('application/json'); expect(JSON.parse(body).message).to.be.equal(`Hello ${param}!`); }); + + it('should not have a shared asset for the card component', async () => { + const name = path.basename(apiFunctions[0]).replace('.zip', ''); + + await extract(apiFunctions[0], { + dir: path.join(normalizePathnameForWindows(netlifyFunctionsOutputUrl), name) + }); + + const assets = await glob.promise(path.join(normalizePathnameForWindows(netlifyFunctionsOutputUrl), `/${name}/*`)); + const exists = assets.find((asset) => { + const name = asset.split(path.sep).pop(); + return name.startsWith('card') && name.endsWith('.js'); + }); + + expect(!!exists).to.equal(false); + }); }); describe('Fragments API Route adapter', function() { @@ -158,6 +174,22 @@ describe('Build Greenwood With: ', function() { expect(cardTags.length).to.be.equal(2); expect(headers.get('content-type')).to.be.equal('text/html'); }); + + it('should have a shared asset for the card component', async () => { + const name = path.basename(apiFunctions[0]).replace('.zip', ''); + + await extract(apiFunctions[0], { + dir: path.join(normalizePathnameForWindows(netlifyFunctionsOutputUrl), name) + }); + + const assets = await glob.promise(path.join(normalizePathnameForWindows(netlifyFunctionsOutputUrl), `/${name}/*`)); + const exists = assets.find((asset) => { + const name = asset.split(path.sep).pop(); + return name.startsWith('card') && name.endsWith('.js'); + }); + + expect(!!exists).to.equal(true); + }); }); describe('Submit JSON API Route adapter', function() { diff --git a/packages/plugin-adapter-vercel/src/index.js b/packages/plugin-adapter-vercel/src/index.js index 2bc5b622f..070136977 100644 --- a/packages/plugin-adapter-vercel/src/index.js +++ b/packages/plugin-adapter-vercel/src/index.js @@ -108,10 +108,11 @@ async function vercelAdapter(compilation) { } } - for (const [key] of apiRoutes) { + for (const [key, value] of apiRoutes.entries()) { const outputType = 'api'; const id = key.replace(`${basePath}/api/`, ''); const outputRoot = new URL(`./${basePath}/api/${id}.func/`, adapterOutputUrl); + const { assets = [] } = value; await setupFunctionBuildFolder(id, outputType, outputRoot); @@ -121,15 +122,10 @@ async function vercelAdapter(compilation) { { recursive: true } ); - // need this for URL referenced chunks - // TODO ideally we would map bundles to specific API routes instead of copying all files just in case - const ssrApiAssets = (await fs.readdir(new URL('./api/', outputDir))) - .filter(file => new RegExp(/^[\w][\w-]*\.[a-zA-Z0-9]{4,20}\.[\w]{2,4}$/).test(path.basename(file))); - - for (const asset of ssrApiAssets) { + for (const asset of assets) { await fs.cp( - new URL(`./${asset}`, new URL('./api/', outputDir)), - new URL(`./${asset}`, outputRoot), + new URL(asset), + new URL(`./${asset.split(path.sep).pop()}`, outputRoot), { recursive: true } ); } diff --git a/packages/plugin-adapter-vercel/test/cases/build.default/build.default.spec.js b/packages/plugin-adapter-vercel/test/cases/build.default/build.default.spec.js index 2c6f64239..9ce4ac027 100644 --- a/packages/plugin-adapter-vercel/test/cases/build.default/build.default.spec.js +++ b/packages/plugin-adapter-vercel/test/cases/build.default/build.default.spec.js @@ -149,6 +149,16 @@ describe('Build Greenwood With: ', function() { expect(headers.get('content-type')).to.be.equal('application/json'); expect(JSON.parse(body).message).to.be.equal(`Hello ${param}!`); }); + + it('should not have a shared asset for the card component', async () => { + const assets = await glob.promise(path.join(normalizePathnameForWindows(vercelFunctionsOutputUrl), '/api/greeting.func/*')); + const exists = assets.find((asset) => { + const name = asset.split(path.sep).pop(); + return name.startsWith('card') && name.endsWith('.js'); + }); + + expect(!!exists).to.equal(false); + }); }); describe('Fragments API Route adapter', function() { @@ -183,6 +193,16 @@ describe('Build Greenwood With: ', function() { expect(cardTags.length).to.be.equal(2); expect(headers.get('content-type')).to.be.equal('text/html'); }); + + it('should have a shared asset for the card component', async () => { + const assets = await glob.promise(path.join(normalizePathnameForWindows(vercelFunctionsOutputUrl), '/api/fragment.func/*')); + const exists = assets.find((asset) => { + const name = asset.split(path.sep).pop(); + return name.startsWith('card') && name.endsWith('.js'); + }); + + expect(!!exists).to.equal(true); + }); }); describe('Submit JSON API Route adapter', function() { From a8f9b426bdeb155b1d9b01697e6298d1808b5ff1 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Mon, 19 Feb 2024 13:27:40 -0500 Subject: [PATCH 13/17] misc refactoring and docs update --- packages/cli/src/config/rollup.config.js | 5 ----- www/pages/plugins/adapter.md | 26 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/packages/cli/src/config/rollup.config.js b/packages/cli/src/config/rollup.config.js index 794c9714f..9f938194a 100644 --- a/packages/cli/src/config/rollup.config.js +++ b/packages/cli/src/config/rollup.config.js @@ -359,11 +359,6 @@ const getRollupConfigForScriptResources = async (compilation) => { const getRollupConfigForApis = async (compilation) => { const { outputDir, userWorkspace } = compilation.context; - // why is this needed? - await fs.promises.mkdir(new URL('./api/assets/', outputDir), { - recursive: true - }); - return [...compilation.manifest.apis.values()] .map(api => normalizePathnameForWindows(new URL(`.${api.path}`, userWorkspace))) .map(filepath => ({ diff --git a/www/pages/plugins/adapter.md b/www/pages/plugins/adapter.md index 5c5a75037..53f696163 100644 --- a/www/pages/plugins/adapter.md +++ b/www/pages/plugins/adapter.md @@ -72,6 +72,7 @@ async function genericAdapter(compilation) { await fs.mkdir(adapterOutputUrl); } + // SSR pages for (const page of ssrPages) { const { id } = page; const outputFormat = generateOutputFormat(id, 'page'); @@ -97,6 +98,31 @@ async function genericAdapter(compilation) { ); } + // API routes + for (const [key, value] of apiRoutes.entries()) { + const outputType = 'api'; + const id = key.replace(`${basePath}/api/`, ''); + const outputRoot = new URL(`./${basePath}/api/${id}.func/`, adapterOutputUrl); + const { assets = [] } = value; + + await setupFunctionBuildFolder(id, outputType, outputRoot); + + await fs.cp( + new URL(`./api/${id}.js`, outputDir), + new URL(`./${id}.js`, outputRoot), + { recursive: true } + ); + + // copy any child assets, like URL bundles + for (const asset of assets) { + await fs.cp( + new URL(asset), + new URL(`./${asset.split(path.sep).pop()}`, outputRoot), + { recursive: true } + ); + } + } + // generate a manifest (if hosting provider requires it, for example) await fs.writeFile(new URL('./metadata.json', adapterOutputUrl), JSON.stringify({ version: '1.0.0', From 8d8008f6512c766e771fa2222a784c1cf6e3d71f Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Mon, 19 Feb 2024 17:25:37 -0500 Subject: [PATCH 14/17] latest WCC patches --- patches/wc-compiler+0.10.0.patch | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/patches/wc-compiler+0.10.0.patch b/patches/wc-compiler+0.10.0.patch index d66725d9a..16c866ffe 100644 --- a/patches/wc-compiler+0.10.0.patch +++ b/patches/wc-compiler+0.10.0.patch @@ -1,5 +1,5 @@ diff --git a/node_modules/wc-compiler/src/dom-shim.js b/node_modules/wc-compiler/src/dom-shim.js -index 389b996..645b884 100644 +index 389b996..9bc4c63 100644 --- a/node_modules/wc-compiler/src/dom-shim.js +++ b/node_modules/wc-compiler/src/dom-shim.js @@ -31,6 +31,18 @@ class Element extends Node { @@ -41,7 +41,7 @@ index 389b996..645b884 100644 } // https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment -@@ -123,15 +123,20 @@ class HTMLTemplateElement extends HTMLElement { +@@ -123,21 +123,26 @@ class HTMLTemplateElement extends HTMLElement { // https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry class CustomElementsRegistry { constructor() { @@ -57,7 +57,7 @@ index 389b996..645b884 100644 get(tagName) { - return this.customElementsRegistry[tagName]; -+ if(this.customElementsRegistry.get(tagName)) { ++ if(this.customElementsRegistry.has(tagName)) { + return this.customElementsRegistry.get(tagName) + } else { + // uh oh... @@ -65,6 +65,18 @@ index 389b996..645b884 100644 } } + // mock top level aliases (globalThis === window) + // https://developer.mozilla.org/en-US/docs/Web/API/Window +-globalThis.addEventListener = noop; +-globalThis.document = new Document(); +-globalThis.customElements = new CustomElementsRegistry(); +-globalThis.HTMLElement = HTMLElement; +\ No newline at end of file ++globalThis.addEventListener = globalThis.addEventListener ?? noop; ++globalThis.document = globalThis.document ?? new Document(); ++globalThis.customElements = globalThis.customElements ?? new CustomElementsRegistry(); ++globalThis.HTMLElement = globalThis.HTMLElement ?? HTMLElement; +\ No newline at end of file diff --git a/node_modules/wc-compiler/src/wcc.js b/node_modules/wc-compiler/src/wcc.js index 887e0b6..9bad926 100644 --- a/node_modules/wc-compiler/src/wcc.js From 75bebd49a2df180317d7782616b92d784859a0b1 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Mon, 19 Feb 2024 20:51:35 -0500 Subject: [PATCH 15/17] windows compatibility --- packages/cli/src/config/rollup.config.js | 18 ++++++++++++++---- packages/plugin-adapter-netlify/src/index.js | 4 +++- .../cases/build.default/build.default.spec.js | 4 ++-- packages/plugin-adapter-vercel/src/index.js | 4 +++- .../cases/build.default/build.default.spec.js | 4 ++-- 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/packages/cli/src/config/rollup.config.js b/packages/cli/src/config/rollup.config.js index 9f938194a..7476074c5 100644 --- a/packages/cli/src/config/rollup.config.js +++ b/packages/cli/src/config/rollup.config.js @@ -159,6 +159,8 @@ function greenwoodImportMetaUrl(compilation) { }).map((plugin) => { return plugin.provider(compilation); }); + const idAssetName = path.basename(id); + const normalizedId = id.replace(/\\\\/g, '/').replace(/\\/g, '/'); // windows shenanigans... const idUrl = new URL(`file://${cleanRollupId(id)}`); const { pathname } = idUrl; const extension = pathname.split('.').pop(); @@ -241,14 +243,14 @@ function greenwoodImportMetaUrl(compilation) { // loop through all URL bundle chunks from APIs and SSR pages // and map to their parent file, to pick back up in generateBundle when full hashes are known - if (id.indexOf(compilation.context.apisDir.pathname) === 0) { + if (`${compilation.context.apisDir.pathname}${idAssetName}`.indexOf(normalizedId) >= 0) { for (const entry of compilation.manifest.apis.keys()) { const apiRoute = compilation.manifest.apis.get(entry); - if (id.endsWith(apiRoute.path)) { + if (normalizedId.endsWith(apiRoute.path)) { const assets = apiRoute.assets || []; - assets.push(assetUrl.url.pathname); + assets.push(assetUrl.url.href); compilation.manifest.apis.set(entry, { ...apiRoute, @@ -283,9 +285,17 @@ function greenwoodImportMetaUrl(compilation) { for (const reference of bundles[bundle].referencedFiles) { if (bundles[reference]) { const assets = apiManifestDetails.assets; - const assetIdx = assets.indexOf(bundles[reference].facadeModuleId); + let assetIdx; + + assets.forEach((asset, idx) => { + // more windows shenanigans...) + if (asset.indexOf(bundles[reference].facadeModuleId.replace(/\\/g, '/'))) { + assetIdx = idx; + } + }); assets[assetIdx] = new URL(`./api/${reference}`, compilation.context.outputDir).href; + compilation.manifest.apis.set(apiKey, { ...apiManifestDetails, assets diff --git a/packages/plugin-adapter-netlify/src/index.js b/packages/plugin-adapter-netlify/src/index.js index 9a784baf4..15ffbf0aa 100644 --- a/packages/plugin-adapter-netlify/src/index.js +++ b/packages/plugin-adapter-netlify/src/index.js @@ -142,9 +142,11 @@ async function netlifyAdapter(compilation) { ); for (const asset of assets) { + const name = path.basename(asset); + await fs.cp( new URL(asset), - new URL(`./${asset.split(path.sep).pop()}`, outputRoot), + new URL(`./${name}`, outputRoot), { recursive: true } ); } diff --git a/packages/plugin-adapter-netlify/test/cases/build.default/build.default.spec.js b/packages/plugin-adapter-netlify/test/cases/build.default/build.default.spec.js index 7e7d419d1..612b27d6d 100644 --- a/packages/plugin-adapter-netlify/test/cases/build.default/build.default.spec.js +++ b/packages/plugin-adapter-netlify/test/cases/build.default/build.default.spec.js @@ -135,7 +135,7 @@ describe('Build Greenwood With: ', function() { const assets = await glob.promise(path.join(normalizePathnameForWindows(netlifyFunctionsOutputUrl), `/${name}/*`)); const exists = assets.find((asset) => { - const name = asset.split(path.sep).pop(); + const name = asset.split('/').pop(); return name.startsWith('card') && name.endsWith('.js'); }); @@ -184,7 +184,7 @@ describe('Build Greenwood With: ', function() { const assets = await glob.promise(path.join(normalizePathnameForWindows(netlifyFunctionsOutputUrl), `/${name}/*`)); const exists = assets.find((asset) => { - const name = asset.split(path.sep).pop(); + const name = asset.split('/').pop(); return name.startsWith('card') && name.endsWith('.js'); }); diff --git a/packages/plugin-adapter-vercel/src/index.js b/packages/plugin-adapter-vercel/src/index.js index 070136977..f37e8154c 100644 --- a/packages/plugin-adapter-vercel/src/index.js +++ b/packages/plugin-adapter-vercel/src/index.js @@ -123,9 +123,11 @@ async function vercelAdapter(compilation) { ); for (const asset of assets) { + const name = path.basename(asset); + await fs.cp( new URL(asset), - new URL(`./${asset.split(path.sep).pop()}`, outputRoot), + new URL(`./${name}`, outputRoot), { recursive: true } ); } diff --git a/packages/plugin-adapter-vercel/test/cases/build.default/build.default.spec.js b/packages/plugin-adapter-vercel/test/cases/build.default/build.default.spec.js index 9ce4ac027..e4ddf27a2 100644 --- a/packages/plugin-adapter-vercel/test/cases/build.default/build.default.spec.js +++ b/packages/plugin-adapter-vercel/test/cases/build.default/build.default.spec.js @@ -153,7 +153,7 @@ describe('Build Greenwood With: ', function() { it('should not have a shared asset for the card component', async () => { const assets = await glob.promise(path.join(normalizePathnameForWindows(vercelFunctionsOutputUrl), '/api/greeting.func/*')); const exists = assets.find((asset) => { - const name = asset.split(path.sep).pop(); + const name = asset.split('/').pop(); return name.startsWith('card') && name.endsWith('.js'); }); @@ -197,7 +197,7 @@ describe('Build Greenwood With: ', function() { it('should have a shared asset for the card component', async () => { const assets = await glob.promise(path.join(normalizePathnameForWindows(vercelFunctionsOutputUrl), '/api/fragment.func/*')); const exists = assets.find((asset) => { - const name = asset.split(path.sep).pop(); + const name = asset.split('/').pop(); return name.startsWith('card') && name.endsWith('.js'); }); From c0cd5569b8623025b2565b63455a8f7067fb89e7 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Mon, 19 Feb 2024 20:51:46 -0500 Subject: [PATCH 16/17] update adapter docs example --- www/pages/plugins/adapter.md | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/www/pages/plugins/adapter.md b/www/pages/plugins/adapter.md index 53f696163..21180b430 100644 --- a/www/pages/plugins/adapter.md +++ b/www/pages/plugins/adapter.md @@ -89,7 +89,7 @@ async function genericAdapter(compilation) { { recursive: true } ); - // and the URL chunk for renderer plugin and executeRouteModule + // and the URL generated chunk for the route for (const file of files) { await fs.cp( new URL(`./${file}`, outputDir), @@ -115,20 +115,15 @@ async function genericAdapter(compilation) { // copy any child assets, like URL bundles for (const asset of assets) { + const name = path.basename(asset); + await fs.cp( new URL(asset), - new URL(`./${asset.split(path.sep).pop()}`, outputRoot), + new URL(`./${name}`, outputRoot), { recursive: true } ); } } - - // generate a manifest (if hosting provider requires it, for example) - await fs.writeFile(new URL('./metadata.json', adapterOutputUrl), JSON.stringify({ - version: '1.0.0', - runtime: 'nodejs' - // ... - })); } } From 785394ecbe8eddc01ea9edfd666010471a55084e Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sun, 10 Mar 2024 11:07:01 -0400 Subject: [PATCH 17/17] remove patches --- package.json | 4 +- packages/cli/src/config/rollup.config.js | 5 +- packages/cli/src/lifecycles/serve.js | 10 +- patches/wc-compiler+0.10.0.patch | 94 ----------- yarn.lock | 195 +---------------------- 5 files changed, 12 insertions(+), 296 deletions(-) delete mode 100644 patches/wc-compiler+0.10.0.patch diff --git a/package.json b/package.json index b9bc39c88..fe99893d8 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,7 @@ "lint:js": "eslint \"*.{js,md}\" \"./packages/**/**/*.{js,md}\" \"./test/*.js\" \"./www/**/**/*.{js,md}\"", "lint:ts": "eslint \"./packages/**/**/*.ts\"", "lint:css": "stylelint \"./www/**/*.js\", \"./www/**/*.css\"", - "lint": "ls-lint && yarn lint:js && yarn lint:ts && yarn lint:css", - "postinstall": "patch-package" + "lint": "ls-lint && yarn lint:js && yarn lint:ts && yarn lint:css" }, "resolutions": { "lit": "^3.1.0" @@ -49,7 +48,6 @@ "jsdom": "^16.5.0", "lerna": "^3.16.4", "mocha": "^9.1.3", - "patch-package": "^8.0.0", "rimraf": "^2.6.3", "stylelint": "^13.8.0", "stylelint-a11y": "^1.2.3", diff --git a/packages/cli/src/config/rollup.config.js b/packages/cli/src/config/rollup.config.js index 7476074c5..b0ea175c9 100644 --- a/packages/cli/src/config/rollup.config.js +++ b/packages/cli/src/config/rollup.config.js @@ -289,7 +289,7 @@ function greenwoodImportMetaUrl(compilation) { assets.forEach((asset, idx) => { // more windows shenanigans...) - if (asset.indexOf(bundles[reference].facadeModuleId.replace(/\\/g, '/'))) { + if (asset.indexOf(bundles[reference]?.facadeModuleId?.replace(/\\/g, '/'))) { assetIdx = idx; } }); @@ -380,6 +380,9 @@ const getRollupConfigForApis = async (compilation) => { }, plugins: [ greenwoodResourceLoader(compilation), + // support node export conditions for SSR pages + // https://github.com/ProjectEvergreen/greenwood/issues/1118 + // https://github.com/rollup/plugins/issues/362#issuecomment-873448461 nodeResolve({ exportConditions: ['node'], preferBuiltins: true diff --git a/packages/cli/src/lifecycles/serve.js b/packages/cli/src/lifecycles/serve.js index 4aee8fec0..6ae901876 100644 --- a/packages/cli/src/lifecycles/serve.js +++ b/packages/cli/src/lifecycles/serve.js @@ -296,6 +296,7 @@ async function getHybridServer(compilation) { const request = transformKoaRequestIntoStandardRequest(url, ctx.request); if (!config.prerender && matchingRoute.isSSR && !matchingRoute.prerender) { + const entryPointUrl = new URL(`./${matchingRoute.id}.route.js`, outputDir); let html; if (matchingRoute.isolation || isolationMode) { @@ -317,13 +318,13 @@ async function getHybridServer(compilation) { }); worker.postMessage({ - routeModuleUrl: new URL(`./${matchingRoute.id}.route.js`, outputDir).href, + routeModuleUrl: entryPointUrl.href, request, compilation: JSON.stringify(compilation) }); }); } else { - const { handler } = await import(new URL(`./__${matchingRoute.filename}`, outputDir)); + const { handler } = await import(entryPointUrl); const response = await handler(request, compilation); html = Readable.from(response.body); @@ -334,6 +335,7 @@ async function getHybridServer(compilation) { ctx.status = 200; } else if (isApiRoute) { const apiRoute = manifest.apis.get(url.pathname); + const entryPointUrl = new URL(`.${apiRoute.path}`, outputDir); let body, status, headers, statusText; if (apiRoute.isolation || isolationMode) { @@ -360,12 +362,12 @@ async function getHybridServer(compilation) { }); worker.postMessage({ - href: new URL(`.${apiRoute.path}`, outputDir).href, + href: entryPointUrl.href, request: req }); }); } else { - const { handler } = await import(new URL(`.${apiRoute.path}`, outputDir)); + const { handler } = await import(entryPointUrl); const response = await handler(request); body = response.body; diff --git a/patches/wc-compiler+0.10.0.patch b/patches/wc-compiler+0.10.0.patch deleted file mode 100644 index 16c866ffe..000000000 --- a/patches/wc-compiler+0.10.0.patch +++ /dev/null @@ -1,94 +0,0 @@ -diff --git a/node_modules/wc-compiler/src/dom-shim.js b/node_modules/wc-compiler/src/dom-shim.js -index 389b996..9bc4c63 100644 ---- a/node_modules/wc-compiler/src/dom-shim.js -+++ b/node_modules/wc-compiler/src/dom-shim.js -@@ -31,6 +31,18 @@ class Element extends Node { - this.attributes = {}; - } - -+ attachShadow(options) { -+ this.shadowRoot = new ShadowRoot(options); -+ -+ return this.shadowRoot; -+ } -+ -+ // https://github.com/mfreed7/declarative-shadow-dom/blob/master/README.md#serialization -+ // eslint-disable-next-line -+ getInnerHTML() { -+ return this.shadowRoot ? this.shadowRoot.innerHTML : this.innerHTML; -+ } -+ - setAttribute(name, value) { - this.attributes[name] = value; - } -@@ -68,19 +80,7 @@ class Document extends Node { - // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement - // EventTarget <- Node <- Element <- HTMLElement - class HTMLElement extends Element { -- attachShadow(options) { -- this.shadowRoot = new ShadowRoot(options); -- -- return this.shadowRoot; -- } -- - connectedCallback() { } -- -- // https://github.com/mfreed7/declarative-shadow-dom/blob/master/README.md#serialization -- // eslint-disable-next-line -- getInnerHTML(options = {}) { -- return this.shadowRoot.innerHTML; -- } - } - - // https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment -@@ -123,21 +123,26 @@ class HTMLTemplateElement extends HTMLElement { - // https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry - class CustomElementsRegistry { - constructor() { -- this.customElementsRegistry = {}; -+ // TODO this should probably be a set -+ this.customElementsRegistry = new Map(); - } - - define(tagName, BaseClass) { -- this.customElementsRegistry[tagName] = BaseClass; -+ this.customElementsRegistry.set(tagName, BaseClass); - } - - get(tagName) { -- return this.customElementsRegistry[tagName]; -+ if(this.customElementsRegistry.has(tagName)) { -+ return this.customElementsRegistry.get(tagName) -+ } else { -+ // uh oh... -+ } - } - } - - // mock top level aliases (globalThis === window) - // https://developer.mozilla.org/en-US/docs/Web/API/Window --globalThis.addEventListener = noop; --globalThis.document = new Document(); --globalThis.customElements = new CustomElementsRegistry(); --globalThis.HTMLElement = HTMLElement; -\ No newline at end of file -+globalThis.addEventListener = globalThis.addEventListener ?? noop; -+globalThis.document = globalThis.document ?? new Document(); -+globalThis.customElements = globalThis.customElements ?? new CustomElementsRegistry(); -+globalThis.HTMLElement = globalThis.HTMLElement ?? HTMLElement; -\ No newline at end of file -diff --git a/node_modules/wc-compiler/src/wcc.js b/node_modules/wc-compiler/src/wcc.js -index 887e0b6..9bad926 100644 ---- a/node_modules/wc-compiler/src/wcc.js -+++ b/node_modules/wc-compiler/src/wcc.js -@@ -134,9 +134,7 @@ async function initializeCustomElement(elementURL, tagName, attrs = [], definiti - - // https://github.com/ProjectEvergreen/wcc/pull/67/files#r902061804 - const { pathname } = elementURL; -- const element = tagName -- ? customElements.get(tagName) -- : (await import(pathname)).default; -+ const element = customElements.get(tagName) ?? (await import(pathname)).default; - const dataLoader = (await import(pathname)).getData; - const data = props - ? props diff --git a/yarn.lock b/yarn.lock index 4f3289d57..e09df1dad 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4466,11 +4466,6 @@ merge-options "^3.0.4" p-event "^5.0.1" -"@yarnpkg/lockfile@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31" - integrity sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ== - "@zkochan/cmd-shim@^3.1.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@zkochan/cmd-shim/-/cmd-shim-3.1.0.tgz#2ab8ed81f5bb5452a85f25758eb9b8681982fd2e" @@ -5180,11 +5175,6 @@ asynckit@^0.4.0: resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= -at-least-node@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2" - integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg== - atob-lite@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/atob-lite/-/atob-lite-2.0.0.tgz#0fef5ad46f1bd7a8502c65727f0367d5ee43d696" @@ -5717,17 +5707,6 @@ call-bind@^1.0.0, call-bind@^1.0.2: function-bind "^1.1.1" get-intrinsic "^1.0.2" -call-bind@^1.0.5: - version "1.0.7" - resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.7.tgz#06016599c40c56498c18769d2730be242b6fa3b9" - integrity sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w== - dependencies: - es-define-property "^1.0.0" - es-errors "^1.3.0" - function-bind "^1.1.2" - get-intrinsic "^1.2.4" - set-function-length "^1.2.1" - call-me-maybe@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/call-me-maybe/-/call-me-maybe-1.0.1.tgz#26d208ea89e37b5cbde60250a15f031c16a4d66b" @@ -5988,11 +5967,6 @@ ci-info@^2.0.0: resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== -ci-info@^3.7.0: - version "3.9.0" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4" - integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== - cjs-module-lexer@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.0.0.tgz#c125ff0f4ab2c898dda909352f254d55e2213261" @@ -6968,15 +6942,6 @@ defer-to-connect@^2.0.1: resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-2.0.1.tgz#8016bdb4143e4632b77a3449c6236277de520587" integrity sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg== -define-data-property@^1.1.2: - version "1.1.4" - resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.4.tgz#894dc141bb7d3060ae4366f6a0107e68fbe48c5e" - integrity sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A== - dependencies: - es-define-property "^1.0.0" - es-errors "^1.3.0" - gopd "^1.0.1" - define-lazy-prop@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz#3f7ae421129bcaaac9bc74905c98a0009ec9ee7f" @@ -7511,18 +7476,6 @@ es-abstract@^1.18.0-next.2: string.prototype.trimstart "^1.0.4" unbox-primitive "^1.0.0" -es-define-property@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.0.tgz#c7faefbdff8b2696cf5f46921edfb77cc4ba3845" - integrity sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ== - dependencies: - get-intrinsic "^1.2.4" - -es-errors@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" - integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== - es-module-lexer@^1.0.0: version "1.3.0" resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.3.0.tgz#6be9c9e0b4543a60cd166ff6f8b4e9dae0b0c16f" @@ -8336,13 +8289,6 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" -find-yarn-workspace-root@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz#f47fb8d239c900eb78179aa81b66673eac88f7bd" - integrity sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ== - dependencies: - micromatch "^4.0.2" - flat-cache@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" @@ -8527,16 +8473,6 @@ fs-extra@^8.1.0: jsonfile "^4.0.0" universalify "^0.1.0" -fs-extra@^9.0.0: - version "9.1.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" - integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== - dependencies: - at-least-node "^1.0.0" - graceful-fs "^4.2.0" - jsonfile "^6.0.1" - universalify "^2.0.0" - fs-minipass@^1.2.5: version "1.2.7" resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7" @@ -8581,11 +8517,6 @@ function-bind@^1.1.1: resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== -function-bind@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" - integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== - fuzzy@0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/fuzzy/-/fuzzy-0.1.3.tgz#4c76ec2ff0ac1a36a9dccf9a00df8623078d4ed8" @@ -8671,17 +8602,6 @@ get-intrinsic@^1.1.1: has "^1.0.3" has-symbols "^1.0.1" -get-intrinsic@^1.1.3, get-intrinsic@^1.2.3, get-intrinsic@^1.2.4: - version "1.2.4" - resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.4.tgz#e385f5a4b5227d449c3eabbad05494ef0abbeadd" - integrity sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ== - dependencies: - es-errors "^1.3.0" - function-bind "^1.1.2" - has-proto "^1.0.1" - has-symbols "^1.0.3" - hasown "^2.0.0" - get-pkg-repo@^1.0.0: version "1.4.0" resolved "https://registry.yarnpkg.com/get-pkg-repo/-/get-pkg-repo-1.4.0.tgz#c73b489c06d80cc5536c2c853f9e05232056972d" @@ -9030,13 +8950,6 @@ good-listener@^1.2.2: dependencies: delegate "^3.1.2" -gopd@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" - integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA== - dependencies: - get-intrinsic "^1.1.3" - got@^12.0.0, got@^12.1.0, got@^12.3.1, got@^12.6.1: version "12.6.1" resolved "https://registry.yarnpkg.com/got/-/got-12.6.1.tgz#8869560d1383353204b5a9435f782df9c091f549" @@ -9200,18 +9113,6 @@ has-own-prop@^2.0.0: resolved "https://registry.yarnpkg.com/has-own-prop/-/has-own-prop-2.0.0.tgz#f0f95d58f65804f5d218db32563bb85b8e0417af" integrity sha512-Pq0h+hvsVm6dDEa8x82GnLSYHOzNDt7f0ddFa3FqcQlgzEiptPqL+XrOJNavjOzSYiYWIrgeVYYgGlLmnxwilQ== -has-property-descriptors@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz#963ed7d071dc7bf5f084c5bfbe0d1b6222586854" - integrity sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg== - dependencies: - es-define-property "^1.0.0" - -has-proto@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.1.tgz#1885c1305538958aff469fef37937c22795408e0" - integrity sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg== - has-symbols@^1.0.0, has-symbols@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8" @@ -9290,13 +9191,6 @@ hasha@5.2.2: is-stream "^2.0.0" type-fest "^0.8.0" -hasown@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.1.tgz#26f48f039de2c0f8d3356c223fb8d50253519faa" - integrity sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA== - dependencies: - function-bind "^1.1.2" - hast-to-hyperscript@^9.0.0: version "9.0.1" resolved "https://registry.yarnpkg.com/hast-to-hyperscript/-/hast-to-hyperscript-9.0.1.tgz#9b67fd188e4c81e8ad66f803855334173920218d" @@ -10363,7 +10257,7 @@ is-word-character@^1.0.0: resolved "https://registry.yarnpkg.com/is-word-character/-/is-word-character-1.0.4.tgz#ce0e73216f98599060592f62ff31354ddbeb0230" integrity sha512-5SMO8RVennx3nZrqtKwCGyyetPE9VDba5ugvKLaD4KopPG5kR4mQ7tNt/r7feL5yt5h3lpuBbIUmCOG2eSzXHA== -is-wsl@2.2.0, is-wsl@^2.1.1, is-wsl@^2.2.0: +is-wsl@2.2.0, is-wsl@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww== @@ -10380,11 +10274,6 @@ isarray@1.0.0, isarray@~1.0.0: resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= -isarray@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" - integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw== - iserror@0.0.2, iserror@^0.0.2: version "0.0.2" resolved "https://registry.yarnpkg.com/iserror/-/iserror-0.0.2.tgz#bd53451fe2f668b9f2402c1966787aaa2c7c0bf5" @@ -10582,16 +10471,6 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== -json-stable-stringify@^1.0.2: - version "1.1.1" - resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.1.1.tgz#52d4361b47d49168bcc4e564189a42e5a7439454" - integrity sha512-SU/971Kt5qVQfJpyDveVhQ/vya+5hvrjClFOcr8c0Fq5aODJjMwutrOfCU+eCnVD5gpx1Q3fEqkyom77zH1iIg== - dependencies: - call-bind "^1.0.5" - isarray "^2.0.5" - jsonify "^0.0.1" - object-keys "^1.1.1" - json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" @@ -10614,20 +10493,6 @@ jsonfile@^4.0.0: optionalDependencies: graceful-fs "^4.1.6" -jsonfile@^6.0.1: - version "6.1.0" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" - integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ== - dependencies: - universalify "^2.0.0" - optionalDependencies: - graceful-fs "^4.1.6" - -jsonify@^0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.1.tgz#2aa3111dae3d34a0f151c63f3a45d995d9420978" - integrity sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg== - jsonparse@^1.2.0: version "1.3.1" resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" @@ -10730,13 +10595,6 @@ kind-of@^6.0.0, kind-of@^6.0.2, kind-of@^6.0.3: resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== -klaw-sync@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/klaw-sync/-/klaw-sync-6.0.0.tgz#1fd2cfd56ebb6250181114f0a581167099c2b28c" - integrity sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ== - dependencies: - graceful-fs "^4.1.11" - known-css-properties@^0.20.0: version "0.20.0" resolved "https://registry.yarnpkg.com/known-css-properties/-/known-css-properties-0.20.0.tgz#0570831661b47dd835293218381166090ff60e96" @@ -12734,14 +12592,6 @@ only@~0.0.2: resolved "https://registry.yarnpkg.com/only/-/only-0.0.2.tgz#2afde84d03e50b9a8edc444e30610a70295edfb4" integrity sha1-Kv3oTQPlC5qO3EROMGEKcCle37Q= -open@^7.4.2: - version "7.4.2" - resolved "https://registry.yarnpkg.com/open/-/open-7.4.2.tgz#b8147e26dcf3e426316c730089fd71edd29c2321" - integrity sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q== - dependencies: - is-docker "^2.0.0" - is-wsl "^2.1.1" - open@^8.0.4: version "8.4.2" resolved "https://registry.yarnpkg.com/open/-/open-8.4.2.tgz#5b5ffe2a8f793dcd2aad73e550cb87b59cb084f9" @@ -13188,27 +13038,6 @@ pascalcase@^0.1.1: resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= -patch-package@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/patch-package/-/patch-package-8.0.0.tgz#d191e2f1b6e06a4624a0116bcb88edd6714ede61" - integrity sha512-da8BVIhzjtgScwDJ2TtKsfT5JFWz1hYoBl9rUQ1f38MC2HwnEIkK8VN3dKMKcP7P7bvvgzNDbfNHtx3MsQb5vA== - dependencies: - "@yarnpkg/lockfile" "^1.1.0" - chalk "^4.1.2" - ci-info "^3.7.0" - cross-spawn "^7.0.3" - find-yarn-workspace-root "^2.0.0" - fs-extra "^9.0.0" - json-stable-stringify "^1.0.2" - klaw-sync "^6.0.0" - minimist "^1.2.6" - open "^7.4.2" - rimraf "^2.6.3" - semver "^7.5.3" - slash "^2.0.0" - tmp "^0.0.33" - yaml "^2.2.2" - path-dirname@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0" @@ -15092,18 +14921,6 @@ set-cookie-parser@^2.4.1: resolved "https://registry.yarnpkg.com/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz#131921e50f62ff1a66a461d7d62d7b21d5d15a51" integrity sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ== -set-function-length@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.1.tgz#47cc5945f2c771e2cf261c6737cf9684a2a5e425" - integrity sha512-j4t6ccc+VsKwYHso+kElc5neZpjtq9EnRICFZtWyBsLojhmeF/ZBd/elqm22WJh/BziDe/SBiOeAt0m2mfLD0g== - dependencies: - define-data-property "^1.1.2" - es-errors "^1.3.0" - function-bind "^1.1.2" - get-intrinsic "^1.2.3" - gopd "^1.0.1" - has-property-descriptors "^1.0.1" - set-getter@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/set-getter/-/set-getter-0.1.0.tgz#d769c182c9d5a51f409145f2fba82e5e86e80376" @@ -16784,11 +16601,6 @@ universalify@^0.1.0, universalify@^0.1.2: resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== -universalify@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.1.tgz#168efc2180964e6386d061e094df61afe239b18d" - integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw== - unix-dgram@2.x: version "2.0.6" resolved "https://registry.yarnpkg.com/unix-dgram/-/unix-dgram-2.0.6.tgz#6d567b0eb6d7a9504e561532b598a46e34c5968b" @@ -17420,11 +17232,6 @@ yaml@^2.1.3: resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.3.1.tgz#02fe0975d23cd441242aa7204e09fc28ac2ac33b" integrity sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ== -yaml@^2.2.2: - version "2.3.4" - resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.3.4.tgz#53fc1d514be80aabf386dc6001eb29bf3b7523b2" - integrity sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA== - yargs-parser@20.2.4, yargs-parser@^20.2.3: version "20.2.4" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54"