@reckona/mreact-router 0.0.119 → 0.0.120
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/build.d.ts +2 -1
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +32 -0
- package/dist/build.js.map +1 -1
- package/dist/bundle-pipeline.d.ts +3 -3
- package/dist/bundle-pipeline.d.ts.map +1 -1
- package/dist/bundle-pipeline.js.map +1 -1
- package/package.json +11 -11
- package/src/build.ts +47 -1
- package/src/bundle-pipeline.ts +2 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type PluginOption } from "vite";
|
|
1
|
+
import { type InlineConfig, type PluginOption } from "vite";
|
|
2
2
|
export interface RouterBundleOptions {
|
|
3
3
|
base?: string | undefined;
|
|
4
4
|
cache?: Map<string, Promise<RouterBundleOutput>> | undefined;
|
|
5
5
|
cacheDir?: string | undefined;
|
|
6
6
|
cacheKey?: string | undefined;
|
|
7
7
|
code: string;
|
|
8
|
-
define?:
|
|
8
|
+
define?: InlineConfig["define"] | undefined;
|
|
9
9
|
dropConsoleFunctions?: readonly string[] | undefined;
|
|
10
10
|
externalizeAppSourceModuleDirs?: readonly string[] | undefined;
|
|
11
11
|
filename: string;
|
|
@@ -25,7 +25,7 @@ export interface RouterBundleModulesOptions {
|
|
|
25
25
|
base?: string | undefined;
|
|
26
26
|
cacheDir?: string | undefined;
|
|
27
27
|
chunkFileNames?: string | undefined;
|
|
28
|
-
define?:
|
|
28
|
+
define?: InlineConfig["define"] | undefined;
|
|
29
29
|
dropConsoleFunctions?: readonly string[] | undefined;
|
|
30
30
|
entries: readonly RouterBundleEntryOptions[];
|
|
31
31
|
entryFileNames?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle-pipeline.d.ts","sourceRoot":"","sources":["../src/bundle-pipeline.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"b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,CAAC;IACrC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAEpC,IAAI,SAAS,KAAK,CAAC,CAAC,EAAE,CAAC;QACrB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO;QACL,SAAS,EAAE,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;QACvD,IAAI,EAAE,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;KACpD,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,EAAU;IAC7B,MAAM,aAAa,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5E,MAAM,UAAU,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAE9C,OAAO,UAAU,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;AAChF,CAAC","sourcesContent":["import { builtinModules } from \"node:module\";\nimport { access } from \"node:fs/promises\";\nimport { dirname, extname, isAbsolute, join, resolve } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport {\n build as viteBuild,\n type InlineConfig,\n type PluginOption,\n type Plugin as VitePlugin,\n} from \"vite\";\nimport { workspacePackageFile } from \"./workspace-packages.js\";\n\nexport interface RouterBundleOptions {\n base?: string | undefined;\n cache?: Map<string, Promise<RouterBundleOutput>> | undefined;\n cacheDir?: string | undefined;\n cacheKey?: string | undefined;\n code: string;\n define?: Record<string, string> | undefined;\n dropConsoleFunctions?: readonly string[] | undefined;\n externalizeAppSourceModuleDirs?: readonly string[] | undefined;\n filename: string;\n minify?: boolean | undefined;\n modulePreload?: boolean | undefined;\n nodeBuiltins?: \"externalize\" | \"reject\" | undefined;\n outfile?: string | undefined;\n platform: \"browser\" | \"node\";\n preserveExports?: boolean | undefined;\n root?: string | undefined;\n plugins?: readonly RouterCompatPlugin[] | undefined;\n vitePlugins?: readonly PluginOption[] | undefined;\n sourceMap?: boolean | undefined;\n target?: string | undefined;\n}\n\nexport interface RouterBundleModulesOptions {\n base?: string | undefined;\n cacheDir?: string | undefined;\n chunkFileNames?: string | undefined;\n define?: Record<string, string> | undefined;\n dropConsoleFunctions?: readonly string[] | undefined;\n entries: readonly RouterBundleEntryOptions[];\n entryFileNames?: string | undefined;\n minify?: boolean | undefined;\n nodeBuiltins?: \"externalize\" | \"reject\" | undefined;\n platform: \"browser\" | \"node\";\n plugins?: readonly RouterCompatPlugin[] | undefined;\n root?: string | undefined;\n vitePlugins?: readonly PluginOption[] | undefined;\n sourceMap?: boolean | undefined;\n target?: string | undefined;\n}\n\nexport interface RouterBundleEntryOptions {\n code: string;\n filename: string;\n name: string;\n}\n\nexport interface RouterBundleOutput {\n assets?: RouterBundleAssetOutput[] | undefined;\n code: string;\n map?: string | undefined;\n}\n\nexport interface RouterBundleModulesOutput {\n assets?: RouterBundleAssetOutput[] | undefined;\n chunks: RouterBundleChunkOutput[];\n}\n\nexport interface RouterBundleChunkOutput {\n code: string;\n fileName: string;\n imports: string[];\n isEntry: boolean;\n map?: string | undefined;\n name: string;\n}\n\nexport interface RouterBundleAssetOutput {\n fileName: string;\n source: string | Uint8Array;\n}\n\ninterface RouterBundlerChunk {\n code: string;\n fileName: string;\n imports?: string[] | undefined;\n isEntry?: boolean | undefined;\n name?: string | undefined;\n type: \"chunk\";\n}\n\ninterface RouterBundlerAsset {\n fileName: string;\n source: string | Uint8Array;\n type: \"asset\";\n}\n\ninterface RouterBundlerOutput {\n output: Array<RouterBundlerAsset | RouterBundlerChunk>;\n}\n\nexport interface RouterCompatPlugin {\n name: string;\n setup(buildApi: RouterCompatBuildApi): void;\n}\n\nexport interface RouterCompatBuildApi {\n onLoad(\n options: { filter: RegExp; namespace?: string | undefined },\n callback: (args: { path: string }) => RouterCompatLoadResult | Promise<RouterCompatLoadResult>,\n ): void;\n onResolve(\n options: { filter: RegExp },\n callback: (args: {\n importer?: string | undefined;\n path: string;\n resolveDir: string;\n }) => RouterCompatResolveResult | Promise<RouterCompatResolveResult>,\n ): void;\n}\n\nexport type RouterCompatLoadResult =\n | {\n contents: string;\n loader?: string | undefined;\n resolveDir?: string | undefined;\n }\n | undefined;\n\nexport type RouterCompatResolveResult =\n | {\n errors?: Array<{ text: string }> | undefined;\n external?: boolean | undefined;\n namespace?: string | undefined;\n path?: string | undefined;\n }\n | undefined;\n\nconst nodeBuiltinSpecifiers = new Set(builtinModules.flatMap((name) => [name, `node:${name}`]));\nconst mreactJsxRuntimeAliasPaths = new Map([\n [\n \"react\",\n workspacePackageFile({\n currentFileUrl: import.meta.url,\n entry: \"index\",\n monorepoDir: \"react-compat\",\n packageName: \"@reckona/mreact-compat\",\n }),\n ],\n [\n \"react-dom\",\n workspacePackageFile({\n currentFileUrl: import.meta.url,\n entry: \"index\",\n monorepoDir: \"react-compat\",\n packageName: \"@reckona/mreact-compat\",\n }),\n ],\n [\n \"react-dom/client\",\n workspacePackageFile({\n currentFileUrl: import.meta.url,\n entry: \"index\",\n monorepoDir: \"react-compat\",\n packageName: \"@reckona/mreact-compat\",\n }),\n ],\n [\n \"react-dom/server\",\n workspacePackageFile({\n currentFileUrl: import.meta.url,\n entry: \"index\",\n monorepoDir: \"react-compat\",\n packageName: \"@reckona/mreact-compat\",\n }),\n ],\n [\n \"react/jsx-dev-runtime\",\n workspacePackageFile({\n currentFileUrl: import.meta.url,\n entry: \"jsx-dev-runtime\",\n monorepoDir: \"react-compat\",\n packageName: \"@reckona/mreact-compat\",\n }),\n ],\n [\n \"react/jsx-runtime\",\n workspacePackageFile({\n currentFileUrl: import.meta.url,\n entry: \"jsx-runtime\",\n monorepoDir: \"react-compat\",\n packageName: \"@reckona/mreact-compat\",\n }),\n ],\n [\n \"@reckona/mreact/jsx-dev-runtime\",\n workspacePackageFile({\n currentFileUrl: import.meta.url,\n entry: \"jsx-dev-runtime\",\n monorepoDir: \"react\",\n packageName: \"@reckona/mreact\",\n }),\n ],\n [\n \"@reckona/mreact/jsx-runtime\",\n workspacePackageFile({\n currentFileUrl: import.meta.url,\n entry: \"jsx-runtime\",\n monorepoDir: \"react\",\n packageName: \"@reckona/mreact\",\n }),\n ],\n [\n \"@reckona/mreact-compat/hooks\",\n workspacePackageFile({\n currentFileUrl: import.meta.url,\n entry: \"hooks-entry\",\n monorepoDir: \"react-compat\",\n packageName: \"@reckona/mreact-compat\",\n }),\n ],\n]);\n\nexport async function bundleRouterModule(\n options: RouterBundleOptions,\n): Promise<RouterBundleOutput> {\n if (options.cache !== undefined && options.cacheKey !== undefined) {\n const cached = options.cache.get(options.cacheKey);\n\n if (cached !== undefined) {\n return cloneRouterBundleOutput(await cached);\n }\n\n const pending = bundleRouterModuleUncached(options);\n options.cache.set(options.cacheKey, pending);\n\n try {\n return cloneRouterBundleOutput(await pending);\n } catch (error) {\n options.cache.delete(options.cacheKey);\n throw error;\n }\n }\n\n return await bundleRouterModuleUncached(options);\n}\n\nasync function bundleRouterModuleUncached(\n options: RouterBundleOptions,\n): Promise<RouterBundleOutput> {\n const entryId = `${options.filename}?mreact-router-entry`;\n const outfile = options.outfile ?? \"entry.js\";\n const config = {\n base: options.base ?? \"/\",\n ...(options.cacheDir === undefined ? {} : { cacheDir: options.cacheDir }),\n configFile: false,\n ...(options.define === undefined ? {} : { define: options.define }),\n logLevel: \"silent\",\n plugins: [\n nodeBuiltinsForBrowserPlugin(options.platform, options.nodeBuiltins ?? \"reject\"),\n mreactJsxRuntimeAliasPlugin(),\n ...(options.vitePlugins ?? []),\n virtualEntryPlugin(entryId, options.code),\n ...(options.externalizeAppSourceModuleDirs === undefined\n ? []\n : [\n externalizeAppSourceModulesPlugin(\n options.filename,\n options.externalizeAppSourceModuleDirs,\n ),\n ]),\n ...(options.plugins ?? []).map(routerCompatPlugin),\n ],\n publicDir: false,\n root: options.root ?? dirname(options.filename),\n ssr: {\n noExternal: true,\n },\n build: {\n emptyOutDir: false,\n lib:\n options.preserveExports === true\n ? {\n entry: entryId,\n fileName: () => outfile,\n formats: [\"es\"],\n }\n : false,\n minify: options.minify === true,\n modulePreload: options.modulePreload ?? true,\n sourcemap: options.sourceMap === true,\n ssr: options.platform === \"node\",\n target: options.target ?? \"es2022\",\n write: false,\n rolldownOptions: {\n input: entryId,\n ...routerBundleTreeshakeOptions(options.dropConsoleFunctions),\n output: {\n codeSplitting: false,\n entryFileNames: outfile,\n format: \"es\",\n },\n },\n },\n } satisfies InlineConfig;\n const result = await viteBuild(config);\n const output = (Array.isArray(result) ? result[0] : result) as RouterBundlerOutput | undefined;\n\n if (output === undefined || !(\"output\" in output)) {\n throw new Error(`Failed to bundle ${options.filename}: Vite/Rolldown produced no output.`);\n }\n\n const chunk = output.output.find((item): item is RouterBundlerChunk => item.type === \"chunk\");\n const map = output.output.find(\n (item): item is RouterBundlerAsset =>\n item.type === \"asset\" && item.fileName === `${chunk?.fileName ?? outfile}.map`,\n );\n const assets = output.output\n .filter(\n (item): item is RouterBundlerAsset =>\n item.type === \"asset\" && item.fileName !== `${chunk?.fileName ?? outfile}.map`,\n )\n .map((asset) => ({ fileName: asset.fileName, source: asset.source }));\n\n if (chunk === undefined) {\n throw new Error(`Failed to bundle ${options.filename}: Vite/Rolldown produced no chunk.`);\n }\n\n return {\n ...(assets.length === 0 ? {} : { assets }),\n code: stripSourceMappingUrl(chunk.code),\n ...(map !== undefined && typeof map.source === \"string\" ? { map: map.source } : {}),\n };\n}\n\nfunction cloneRouterBundleOutput(output: RouterBundleOutput): RouterBundleOutput {\n return {\n ...(output.assets === undefined\n ? {}\n : {\n assets: output.assets.map((asset) => ({\n fileName: asset.fileName,\n source:\n typeof asset.source === \"string\" ? asset.source : new Uint8Array(asset.source),\n })),\n }),\n code: output.code,\n ...(output.map === undefined ? {} : { map: output.map }),\n };\n}\n\nexport async function bundleRouterModules(\n options: RouterBundleModulesOptions,\n): Promise<RouterBundleModulesOutput> {\n if (options.entries.length === 0) {\n return { chunks: [] };\n }\n\n const entries = new Map(\n options.entries.map((entry) => [\n `${entry.filename}?mreact-router-entry=${encodeURIComponent(entry.name)}`,\n entry,\n ]),\n );\n const input = Object.fromEntries(\n Array.from(entries, ([entryId, entry]) => [entry.name, entryId]),\n );\n const config = {\n base: options.base ?? \"/\",\n ...(options.cacheDir === undefined ? {} : { cacheDir: options.cacheDir }),\n configFile: false,\n ...(options.define === undefined ? {} : { define: options.define }),\n logLevel: \"silent\",\n plugins: [\n nodeBuiltinsForBrowserPlugin(options.platform, options.nodeBuiltins ?? \"reject\"),\n mreactJsxRuntimeAliasPlugin(),\n ...(options.vitePlugins ?? []),\n virtualEntriesPlugin(entries),\n ...(options.plugins ?? []).map(routerCompatPlugin),\n ],\n publicDir: false,\n root: options.root ?? dirname(options.entries[0]?.filename ?? process.cwd()),\n ssr: {\n noExternal: true,\n },\n build: {\n emptyOutDir: false,\n minify: options.minify === true,\n sourcemap: options.sourceMap === true,\n ssr: options.platform === \"node\",\n target: options.target ?? \"es2022\",\n write: false,\n rolldownOptions: {\n input,\n ...routerBundleTreeshakeOptions(options.dropConsoleFunctions),\n output: {\n chunkFileNames: options.chunkFileNames ?? \"assets/chunks/[name].[hash].js\",\n entryFileNames: options.entryFileNames ?? \"assets/routes/[name].[hash].js\",\n format: \"es\",\n hashCharacters: \"hex\",\n },\n },\n },\n } satisfies InlineConfig;\n const result = await viteBuild(config);\n const output = (Array.isArray(result) ? result[0] : result) as RouterBundlerOutput | undefined;\n\n if (output === undefined || !(\"output\" in output)) {\n throw new Error(\"Failed to bundle client routes: Vite/Rolldown produced no output.\");\n }\n\n const mapAssets = new Map(\n output.output\n .filter(\n (item): item is RouterBundlerAsset =>\n item.type === \"asset\" && item.fileName.endsWith(\".map\"),\n )\n .flatMap((asset) =>\n typeof asset.source === \"string\" ? [[asset.fileName, asset.source] as const] : [],\n ),\n );\n const chunks = output.output\n .filter((item): item is RouterBundlerChunk => item.type === \"chunk\")\n .map((chunk) => {\n const map = mapAssets.get(`${chunk.fileName}.map`);\n\n return {\n code: stripSourceMappingUrl(chunk.code),\n fileName: chunk.fileName,\n imports: chunk.imports ?? [],\n isEntry: chunk.isEntry === true,\n ...(map === undefined ? {} : { map }),\n name: chunk.name ?? chunk.fileName,\n };\n });\n const assets = output.output\n .filter(\n (item): item is RouterBundlerAsset =>\n item.type === \"asset\" && !item.fileName.endsWith(\".map\"),\n )\n .map((asset) => ({ fileName: asset.fileName, source: asset.source }));\n\n return {\n ...(assets.length === 0 ? {} : { assets }),\n chunks,\n };\n}\n\nfunction mreactJsxRuntimeAliasPlugin(): VitePlugin {\n return {\n name: \"mreact-router-jsx-runtime-alias\",\n enforce: \"pre\",\n resolveId(id) {\n return mreactJsxRuntimeAliasPaths.get(id);\n },\n };\n}\n\nfunction externalizeAppSourceModulesPlugin(\n entryFilename: string,\n sourceDirs: readonly string[],\n): VitePlugin {\n const normalizedSourceDirs = sourceDirs.map((directory) => resolve(directory));\n\n return {\n name: \"mreact-router-externalize-app-source-modules\",\n enforce: \"pre\",\n async resolveId(id, importer) {\n if (importer === undefined || !isAppSourceImport(id)) {\n return undefined;\n }\n\n const importerPath = cleanViteId(importer);\n const resolved = await resolveAppSourceImport(id, dirname(importerPath));\n\n if (\n resolved === undefined ||\n resolved === entryFilename ||\n !isExternalizableAppSourceModule(resolved) ||\n !isInsideAnyDirectory(normalizedSourceDirs, resolved)\n ) {\n return undefined;\n }\n\n return {\n external: true,\n id: pathToFileURL(resolved).href,\n };\n },\n };\n}\n\nfunction isInsideAnyDirectory(directories: readonly string[], path: string): boolean {\n return directories.some((directory) => path === directory || path.startsWith(`${directory}/`));\n}\n\nfunction isAppSourceImport(id: string): boolean {\n return id.startsWith(\".\") || id.startsWith(\"/\") || isAbsolute(id);\n}\n\nfunction isExternalizableAppSourceModule(path: string): boolean {\n return /\\.(?:[cm]?ts|[cm]?js)$/u.test(path);\n}\n\nasync function resolveAppSourceImport(id: string, resolveDir: string): Promise<string | undefined> {\n const base = isAbsolute(id) ? id : resolve(resolveDir, id);\n const extension = extname(base);\n const candidates =\n extension === \"\"\n ? [\n base,\n `${base}.ts`,\n `${base}.mts`,\n `${base}.cts`,\n `${base}.js`,\n `${base}.mjs`,\n `${base}.cjs`,\n join(base, \"index.ts\"),\n join(base, \"index.mts\"),\n join(base, \"index.cts\"),\n join(base, \"index.js\"),\n join(base, \"index.mjs\"),\n join(base, \"index.cjs\"),\n ]\n : [base];\n\n for (const candidate of candidates) {\n try {\n await access(candidate);\n return candidate;\n } catch {\n continue;\n }\n }\n\n return undefined;\n}\n\nfunction routerBundleTreeshakeOptions(\n dropConsoleFunctions: readonly string[] | undefined,\n): { treeshake: { manualPureFunctions: readonly string[] } } | {} {\n return dropConsoleFunctions === undefined || dropConsoleFunctions.length === 0\n ? {}\n : { treeshake: { manualPureFunctions: dropConsoleFunctions } };\n}\n\nfunction stripSourceMappingUrl(code: string): string {\n return code.replace(/\\n?\\/\\/# sourceMappingURL=[^\\n]+\\.map\\s*$/u, \"\");\n}\n\nfunction virtualEntryPlugin(entryId: string, code: string): VitePlugin {\n return {\n name: \"mreact-router-virtual-entry\",\n enforce: \"pre\",\n resolveId(id) {\n return id === entryId ? entryId : undefined;\n },\n load(id) {\n return id === entryId ? { code, moduleType: moduleTypeForFilename(entryId) } : undefined;\n },\n };\n}\n\nfunction virtualEntriesPlugin(entries: ReadonlyMap<string, RouterBundleEntryOptions>): VitePlugin {\n return {\n name: \"mreact-router-virtual-entries\",\n enforce: \"pre\",\n resolveId(id) {\n return entries.has(id) ? id : undefined;\n },\n load(id) {\n const entry = entries.get(id);\n\n return entry === undefined\n ? undefined\n : { code: entry.code, moduleType: moduleTypeForFilename(id) };\n },\n };\n}\n\nfunction moduleTypeForFilename(filename: string): \"js\" | \"jsx\" | \"ts\" | \"tsx\" {\n const clean = cleanViteId(filename);\n\n if (/\\.(?:mreact\\.)?[cm]?tsx$/u.test(clean) || clean.endsWith(\".jsx\")) {\n return \"tsx\";\n }\n\n if (/\\.(?:mreact\\.)?[cm]?ts$/u.test(clean)) {\n return \"ts\";\n }\n\n return \"js\";\n}\n\nfunction nodeBuiltinsForBrowserPlugin(\n platform: RouterBundleOptions[\"platform\"],\n policy: NonNullable<RouterBundleOptions[\"nodeBuiltins\"]>,\n): VitePlugin {\n const nodeModuleShimId = \"\\0mreact-router-node-module-shim\";\n\n return {\n name: \"mreact-router-browser-node-builtins\",\n enforce: \"pre\",\n resolveId(id) {\n if (platform === \"browser\" && nodeBuiltinSpecifiers.has(id)) {\n if (policy === \"externalize\") {\n if (id === \"node:module\" || id === \"module\") {\n return nodeModuleShimId;\n }\n\n return { external: true, id: id.startsWith(\"node:\") ? id : `node:${id}` };\n }\n\n this.error(`Browser build cannot import Node builtin ${JSON.stringify(id)}.`);\n }\n\n return undefined;\n },\n load(id) {\n if (id !== nodeModuleShimId) {\n return undefined;\n }\n\n return `export const builtinModules = [];\n\nexport function createRequire() {\n return function cloudflareRequire() {\n throw new Error(\"CommonJS require is not available in browser worker bundles.\");\n };\n}\n\nexport default { builtinModules, createRequire };\n`;\n },\n };\n}\n\nfunction routerCompatPlugin(plugin: RouterCompatPlugin): VitePlugin {\n const resolvers: Array<{\n filter: RegExp;\n callback: Parameters<RouterCompatBuildApi[\"onResolve\"]>[1];\n }> = [];\n const loaders: Array<{\n filter: RegExp;\n namespace?: string | undefined;\n callback: Parameters<RouterCompatBuildApi[\"onLoad\"]>[1];\n }> = [];\n\n plugin.setup({\n onLoad(options, callback) {\n loaders.push({ ...options, callback });\n },\n onResolve(options, callback) {\n resolvers.push({ ...options, callback });\n },\n });\n\n return {\n name: plugin.name,\n enforce: \"pre\",\n async resolveId(source, importer) {\n for (const resolver of resolvers) {\n if (!resolver.filter.test(source)) {\n continue;\n }\n\n const resolved = await resolver.callback({\n importer: importer === undefined ? undefined : cleanViteId(importer),\n path: source,\n resolveDir: importer === undefined ? \"\" : dirname(cleanViteId(importer)),\n });\n\n if (resolved === undefined) {\n continue;\n }\n\n if (resolved.errors !== undefined && resolved.errors.length > 0) {\n this.error(resolved.errors.map((error) => error.text).join(\"\\n\"));\n }\n\n if (resolved.path === undefined) {\n continue;\n }\n\n if (resolved.external === true) {\n return { external: true, id: resolved.path };\n }\n\n return resolved.namespace === undefined\n ? resolved.path\n : compatVirtualId(resolved.namespace, resolved.path);\n }\n\n return undefined;\n },\n async load(id) {\n const virtual = parseCompatVirtualId(id);\n const path = virtual?.path ?? cleanViteId(id);\n const namespace = virtual?.namespace;\n\n for (const loader of loaders) {\n if (loader.namespace !== namespace || !loader.filter.test(path)) {\n continue;\n }\n\n const loaded = await loader.callback({ path });\n\n if (loaded !== undefined) {\n return loaded.contents;\n }\n }\n\n return undefined;\n },\n };\n}\n\nfunction compatVirtualId(namespace: string, path: string): string {\n return `\\0mreact-router-compat:${encodeURIComponent(namespace)}:${encodeURIComponent(path)}`;\n}\n\nfunction parseCompatVirtualId(id: string): { namespace: string; path: string } | undefined {\n const prefix = \"\\0mreact-router-compat:\";\n\n if (!id.startsWith(prefix)) {\n return undefined;\n }\n\n const rest = id.slice(prefix.length);\n const separator = rest.indexOf(\":\");\n\n if (separator === -1) {\n return undefined;\n }\n\n return {\n namespace: decodeURIComponent(rest.slice(0, separator)),\n path: decodeURIComponent(rest.slice(separator + 1)),\n };\n}\n\nfunction cleanViteId(id: string): string {\n const withoutPrefix = id.startsWith(\"/@fs/\") ? id.slice(\"/@fs\".length) : id;\n const queryIndex = withoutPrefix.indexOf(\"?\");\n\n return queryIndex === -1 ? withoutPrefix : withoutPrefix.slice(0, queryIndex);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"bundle-pipeline.js","sourceRoot":"","sources":["../src/bundle-pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,MAAM,E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C,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;AAChF,CAAC","sourcesContent":["import { builtinModules } from \"node:module\";\nimport { access } from \"node:fs/promises\";\nimport { dirname, extname, isAbsolute, join, resolve } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport {\n build as viteBuild,\n type InlineConfig,\n type PluginOption,\n type Plugin as VitePlugin,\n} from \"vite\";\nimport { workspacePackageFile } from \"./workspace-packages.js\";\n\nexport interface RouterBundleOptions {\n base?: string | undefined;\n cache?: Map<string, Promise<RouterBundleOutput>> | undefined;\n cacheDir?: string | undefined;\n cacheKey?: string | undefined;\n code: string;\n define?: InlineConfig[\"define\"] | undefined;\n dropConsoleFunctions?: readonly string[] | undefined;\n externalizeAppSourceModuleDirs?: readonly string[] | undefined;\n filename: string;\n minify?: boolean | undefined;\n modulePreload?: boolean | undefined;\n nodeBuiltins?: \"externalize\" | \"reject\" | undefined;\n outfile?: string | undefined;\n platform: \"browser\" | \"node\";\n preserveExports?: boolean | undefined;\n root?: string | undefined;\n plugins?: readonly RouterCompatPlugin[] | undefined;\n vitePlugins?: readonly PluginOption[] | undefined;\n sourceMap?: boolean | undefined;\n target?: string | undefined;\n}\n\nexport interface RouterBundleModulesOptions {\n base?: string | undefined;\n cacheDir?: string | undefined;\n chunkFileNames?: string | undefined;\n define?: InlineConfig[\"define\"] | undefined;\n dropConsoleFunctions?: readonly string[] | undefined;\n entries: readonly RouterBundleEntryOptions[];\n entryFileNames?: string | undefined;\n minify?: boolean | undefined;\n nodeBuiltins?: \"externalize\" | \"reject\" | undefined;\n platform: \"browser\" | \"node\";\n plugins?: readonly RouterCompatPlugin[] | undefined;\n root?: string | undefined;\n vitePlugins?: readonly PluginOption[] | undefined;\n sourceMap?: boolean | undefined;\n target?: string | undefined;\n}\n\nexport interface RouterBundleEntryOptions {\n code: string;\n filename: string;\n name: string;\n}\n\nexport interface RouterBundleOutput {\n assets?: RouterBundleAssetOutput[] | undefined;\n code: string;\n map?: string | undefined;\n}\n\nexport interface RouterBundleModulesOutput {\n assets?: RouterBundleAssetOutput[] | undefined;\n chunks: RouterBundleChunkOutput[];\n}\n\nexport interface RouterBundleChunkOutput {\n code: string;\n fileName: string;\n imports: string[];\n isEntry: boolean;\n map?: string | undefined;\n name: string;\n}\n\nexport interface RouterBundleAssetOutput {\n fileName: string;\n source: string | Uint8Array;\n}\n\ninterface RouterBundlerChunk {\n code: string;\n fileName: string;\n imports?: string[] | undefined;\n isEntry?: boolean | undefined;\n name?: string | undefined;\n type: \"chunk\";\n}\n\ninterface RouterBundlerAsset {\n fileName: string;\n source: string | Uint8Array;\n type: \"asset\";\n}\n\ninterface RouterBundlerOutput {\n output: Array<RouterBundlerAsset | RouterBundlerChunk>;\n}\n\nexport interface RouterCompatPlugin {\n name: string;\n setup(buildApi: RouterCompatBuildApi): void;\n}\n\nexport interface RouterCompatBuildApi {\n onLoad(\n options: { filter: RegExp; namespace?: string | undefined },\n callback: (args: { path: string }) => RouterCompatLoadResult | Promise<RouterCompatLoadResult>,\n ): void;\n onResolve(\n options: { filter: RegExp },\n callback: (args: {\n importer?: string | undefined;\n path: string;\n resolveDir: string;\n }) => RouterCompatResolveResult | Promise<RouterCompatResolveResult>,\n ): void;\n}\n\nexport type RouterCompatLoadResult =\n | {\n contents: string;\n loader?: string | undefined;\n resolveDir?: string | undefined;\n }\n | undefined;\n\nexport type RouterCompatResolveResult =\n | {\n errors?: Array<{ text: string }> | undefined;\n external?: boolean | undefined;\n namespace?: string | undefined;\n path?: string | undefined;\n }\n | undefined;\n\nconst nodeBuiltinSpecifiers = new Set(builtinModules.flatMap((name) => [name, `node:${name}`]));\nconst mreactJsxRuntimeAliasPaths = new Map([\n [\n \"react\",\n workspacePackageFile({\n currentFileUrl: import.meta.url,\n entry: \"index\",\n monorepoDir: \"react-compat\",\n packageName: \"@reckona/mreact-compat\",\n }),\n ],\n [\n \"react-dom\",\n workspacePackageFile({\n currentFileUrl: import.meta.url,\n entry: \"index\",\n monorepoDir: \"react-compat\",\n packageName: \"@reckona/mreact-compat\",\n }),\n ],\n [\n \"react-dom/client\",\n workspacePackageFile({\n currentFileUrl: import.meta.url,\n entry: \"index\",\n monorepoDir: \"react-compat\",\n packageName: \"@reckona/mreact-compat\",\n }),\n ],\n [\n \"react-dom/server\",\n workspacePackageFile({\n currentFileUrl: import.meta.url,\n entry: \"index\",\n monorepoDir: \"react-compat\",\n packageName: \"@reckona/mreact-compat\",\n }),\n ],\n [\n \"react/jsx-dev-runtime\",\n workspacePackageFile({\n currentFileUrl: import.meta.url,\n entry: \"jsx-dev-runtime\",\n monorepoDir: \"react-compat\",\n packageName: \"@reckona/mreact-compat\",\n }),\n ],\n [\n \"react/jsx-runtime\",\n workspacePackageFile({\n currentFileUrl: import.meta.url,\n entry: \"jsx-runtime\",\n monorepoDir: \"react-compat\",\n packageName: \"@reckona/mreact-compat\",\n }),\n ],\n [\n \"@reckona/mreact/jsx-dev-runtime\",\n workspacePackageFile({\n currentFileUrl: import.meta.url,\n entry: \"jsx-dev-runtime\",\n monorepoDir: \"react\",\n packageName: \"@reckona/mreact\",\n }),\n ],\n [\n \"@reckona/mreact/jsx-runtime\",\n workspacePackageFile({\n currentFileUrl: import.meta.url,\n entry: \"jsx-runtime\",\n monorepoDir: \"react\",\n packageName: \"@reckona/mreact\",\n }),\n ],\n [\n \"@reckona/mreact-compat/hooks\",\n workspacePackageFile({\n currentFileUrl: import.meta.url,\n entry: \"hooks-entry\",\n monorepoDir: \"react-compat\",\n packageName: \"@reckona/mreact-compat\",\n }),\n ],\n]);\n\nexport async function bundleRouterModule(\n options: RouterBundleOptions,\n): Promise<RouterBundleOutput> {\n if (options.cache !== undefined && options.cacheKey !== undefined) {\n const cached = options.cache.get(options.cacheKey);\n\n if (cached !== undefined) {\n return cloneRouterBundleOutput(await cached);\n }\n\n const pending = bundleRouterModuleUncached(options);\n options.cache.set(options.cacheKey, pending);\n\n try {\n return cloneRouterBundleOutput(await pending);\n } catch (error) {\n options.cache.delete(options.cacheKey);\n throw error;\n }\n }\n\n return await bundleRouterModuleUncached(options);\n}\n\nasync function bundleRouterModuleUncached(\n options: RouterBundleOptions,\n): Promise<RouterBundleOutput> {\n const entryId = `${options.filename}?mreact-router-entry`;\n const outfile = options.outfile ?? \"entry.js\";\n const config = {\n base: options.base ?? \"/\",\n ...(options.cacheDir === undefined ? {} : { cacheDir: options.cacheDir }),\n configFile: false,\n ...(options.define === undefined ? {} : { define: options.define }),\n logLevel: \"silent\",\n plugins: [\n nodeBuiltinsForBrowserPlugin(options.platform, options.nodeBuiltins ?? \"reject\"),\n mreactJsxRuntimeAliasPlugin(),\n ...(options.vitePlugins ?? []),\n virtualEntryPlugin(entryId, options.code),\n ...(options.externalizeAppSourceModuleDirs === undefined\n ? []\n : [\n externalizeAppSourceModulesPlugin(\n options.filename,\n options.externalizeAppSourceModuleDirs,\n ),\n ]),\n ...(options.plugins ?? []).map(routerCompatPlugin),\n ],\n publicDir: false,\n root: options.root ?? dirname(options.filename),\n ssr: {\n noExternal: true,\n },\n build: {\n emptyOutDir: false,\n lib:\n options.preserveExports === true\n ? {\n entry: entryId,\n fileName: () => outfile,\n formats: [\"es\"],\n }\n : false,\n minify: options.minify === true,\n modulePreload: options.modulePreload ?? true,\n sourcemap: options.sourceMap === true,\n ssr: options.platform === \"node\",\n target: options.target ?? \"es2022\",\n write: false,\n rolldownOptions: {\n input: entryId,\n ...routerBundleTreeshakeOptions(options.dropConsoleFunctions),\n output: {\n codeSplitting: false,\n entryFileNames: outfile,\n format: \"es\",\n },\n },\n },\n } satisfies InlineConfig;\n const result = await viteBuild(config);\n const output = (Array.isArray(result) ? result[0] : result) as RouterBundlerOutput | undefined;\n\n if (output === undefined || !(\"output\" in output)) {\n throw new Error(`Failed to bundle ${options.filename}: Vite/Rolldown produced no output.`);\n }\n\n const chunk = output.output.find((item): item is RouterBundlerChunk => item.type === \"chunk\");\n const map = output.output.find(\n (item): item is RouterBundlerAsset =>\n item.type === \"asset\" && item.fileName === `${chunk?.fileName ?? outfile}.map`,\n );\n const assets = output.output\n .filter(\n (item): item is RouterBundlerAsset =>\n item.type === \"asset\" && item.fileName !== `${chunk?.fileName ?? outfile}.map`,\n )\n .map((asset) => ({ fileName: asset.fileName, source: asset.source }));\n\n if (chunk === undefined) {\n throw new Error(`Failed to bundle ${options.filename}: Vite/Rolldown produced no chunk.`);\n }\n\n return {\n ...(assets.length === 0 ? {} : { assets }),\n code: stripSourceMappingUrl(chunk.code),\n ...(map !== undefined && typeof map.source === \"string\" ? { map: map.source } : {}),\n };\n}\n\nfunction cloneRouterBundleOutput(output: RouterBundleOutput): RouterBundleOutput {\n return {\n ...(output.assets === undefined\n ? {}\n : {\n assets: output.assets.map((asset) => ({\n fileName: asset.fileName,\n source:\n typeof asset.source === \"string\" ? asset.source : new Uint8Array(asset.source),\n })),\n }),\n code: output.code,\n ...(output.map === undefined ? {} : { map: output.map }),\n };\n}\n\nexport async function bundleRouterModules(\n options: RouterBundleModulesOptions,\n): Promise<RouterBundleModulesOutput> {\n if (options.entries.length === 0) {\n return { chunks: [] };\n }\n\n const entries = new Map(\n options.entries.map((entry) => [\n `${entry.filename}?mreact-router-entry=${encodeURIComponent(entry.name)}`,\n entry,\n ]),\n );\n const input = Object.fromEntries(\n Array.from(entries, ([entryId, entry]) => [entry.name, entryId]),\n );\n const config = {\n base: options.base ?? \"/\",\n ...(options.cacheDir === undefined ? {} : { cacheDir: options.cacheDir }),\n configFile: false,\n ...(options.define === undefined ? {} : { define: options.define }),\n logLevel: \"silent\",\n plugins: [\n nodeBuiltinsForBrowserPlugin(options.platform, options.nodeBuiltins ?? \"reject\"),\n mreactJsxRuntimeAliasPlugin(),\n ...(options.vitePlugins ?? []),\n virtualEntriesPlugin(entries),\n ...(options.plugins ?? []).map(routerCompatPlugin),\n ],\n publicDir: false,\n root: options.root ?? dirname(options.entries[0]?.filename ?? process.cwd()),\n ssr: {\n noExternal: true,\n },\n build: {\n emptyOutDir: false,\n minify: options.minify === true,\n sourcemap: options.sourceMap === true,\n ssr: options.platform === \"node\",\n target: options.target ?? \"es2022\",\n write: false,\n rolldownOptions: {\n input,\n ...routerBundleTreeshakeOptions(options.dropConsoleFunctions),\n output: {\n chunkFileNames: options.chunkFileNames ?? \"assets/chunks/[name].[hash].js\",\n entryFileNames: options.entryFileNames ?? \"assets/routes/[name].[hash].js\",\n format: \"es\",\n hashCharacters: \"hex\",\n },\n },\n },\n } satisfies InlineConfig;\n const result = await viteBuild(config);\n const output = (Array.isArray(result) ? result[0] : result) as RouterBundlerOutput | undefined;\n\n if (output === undefined || !(\"output\" in output)) {\n throw new Error(\"Failed to bundle client routes: Vite/Rolldown produced no output.\");\n }\n\n const mapAssets = new Map(\n output.output\n .filter(\n (item): item is RouterBundlerAsset =>\n item.type === \"asset\" && item.fileName.endsWith(\".map\"),\n )\n .flatMap((asset) =>\n typeof asset.source === \"string\" ? [[asset.fileName, asset.source] as const] : [],\n ),\n );\n const chunks = output.output\n .filter((item): item is RouterBundlerChunk => item.type === \"chunk\")\n .map((chunk) => {\n const map = mapAssets.get(`${chunk.fileName}.map`);\n\n return {\n code: stripSourceMappingUrl(chunk.code),\n fileName: chunk.fileName,\n imports: chunk.imports ?? [],\n isEntry: chunk.isEntry === true,\n ...(map === undefined ? {} : { map }),\n name: chunk.name ?? chunk.fileName,\n };\n });\n const assets = output.output\n .filter(\n (item): item is RouterBundlerAsset =>\n item.type === \"asset\" && !item.fileName.endsWith(\".map\"),\n )\n .map((asset) => ({ fileName: asset.fileName, source: asset.source }));\n\n return {\n ...(assets.length === 0 ? {} : { assets }),\n chunks,\n };\n}\n\nfunction mreactJsxRuntimeAliasPlugin(): VitePlugin {\n return {\n name: \"mreact-router-jsx-runtime-alias\",\n enforce: \"pre\",\n resolveId(id) {\n return mreactJsxRuntimeAliasPaths.get(id);\n },\n };\n}\n\nfunction externalizeAppSourceModulesPlugin(\n entryFilename: string,\n sourceDirs: readonly string[],\n): VitePlugin {\n const normalizedSourceDirs = sourceDirs.map((directory) => resolve(directory));\n\n return {\n name: \"mreact-router-externalize-app-source-modules\",\n enforce: \"pre\",\n async resolveId(id, importer) {\n if (importer === undefined || !isAppSourceImport(id)) {\n return undefined;\n }\n\n const importerPath = cleanViteId(importer);\n const resolved = await resolveAppSourceImport(id, dirname(importerPath));\n\n if (\n resolved === undefined ||\n resolved === entryFilename ||\n !isExternalizableAppSourceModule(resolved) ||\n !isInsideAnyDirectory(normalizedSourceDirs, resolved)\n ) {\n return undefined;\n }\n\n return {\n external: true,\n id: pathToFileURL(resolved).href,\n };\n },\n };\n}\n\nfunction isInsideAnyDirectory(directories: readonly string[], path: string): boolean {\n return directories.some((directory) => path === directory || path.startsWith(`${directory}/`));\n}\n\nfunction isAppSourceImport(id: string): boolean {\n return id.startsWith(\".\") || id.startsWith(\"/\") || isAbsolute(id);\n}\n\nfunction isExternalizableAppSourceModule(path: string): boolean {\n return /\\.(?:[cm]?ts|[cm]?js)$/u.test(path);\n}\n\nasync function resolveAppSourceImport(id: string, resolveDir: string): Promise<string | undefined> {\n const base = isAbsolute(id) ? id : resolve(resolveDir, id);\n const extension = extname(base);\n const candidates =\n extension === \"\"\n ? [\n base,\n `${base}.ts`,\n `${base}.mts`,\n `${base}.cts`,\n `${base}.js`,\n `${base}.mjs`,\n `${base}.cjs`,\n join(base, \"index.ts\"),\n join(base, \"index.mts\"),\n join(base, \"index.cts\"),\n join(base, \"index.js\"),\n join(base, \"index.mjs\"),\n join(base, \"index.cjs\"),\n ]\n : [base];\n\n for (const candidate of candidates) {\n try {\n await access(candidate);\n return candidate;\n } catch {\n continue;\n }\n }\n\n return undefined;\n}\n\nfunction routerBundleTreeshakeOptions(\n dropConsoleFunctions: readonly string[] | undefined,\n): { treeshake: { manualPureFunctions: readonly string[] } } | {} {\n return dropConsoleFunctions === undefined || dropConsoleFunctions.length === 0\n ? {}\n : { treeshake: { manualPureFunctions: dropConsoleFunctions } };\n}\n\nfunction stripSourceMappingUrl(code: string): string {\n return code.replace(/\\n?\\/\\/# sourceMappingURL=[^\\n]+\\.map\\s*$/u, \"\");\n}\n\nfunction virtualEntryPlugin(entryId: string, code: string): VitePlugin {\n return {\n name: \"mreact-router-virtual-entry\",\n enforce: \"pre\",\n resolveId(id) {\n return id === entryId ? entryId : undefined;\n },\n load(id) {\n return id === entryId ? { code, moduleType: moduleTypeForFilename(entryId) } : undefined;\n },\n };\n}\n\nfunction virtualEntriesPlugin(entries: ReadonlyMap<string, RouterBundleEntryOptions>): VitePlugin {\n return {\n name: \"mreact-router-virtual-entries\",\n enforce: \"pre\",\n resolveId(id) {\n return entries.has(id) ? id : undefined;\n },\n load(id) {\n const entry = entries.get(id);\n\n return entry === undefined\n ? undefined\n : { code: entry.code, moduleType: moduleTypeForFilename(id) };\n },\n };\n}\n\nfunction moduleTypeForFilename(filename: string): \"js\" | \"jsx\" | \"ts\" | \"tsx\" {\n const clean = cleanViteId(filename);\n\n if (/\\.(?:mreact\\.)?[cm]?tsx$/u.test(clean) || clean.endsWith(\".jsx\")) {\n return \"tsx\";\n }\n\n if (/\\.(?:mreact\\.)?[cm]?ts$/u.test(clean)) {\n return \"ts\";\n }\n\n return \"js\";\n}\n\nfunction nodeBuiltinsForBrowserPlugin(\n platform: RouterBundleOptions[\"platform\"],\n policy: NonNullable<RouterBundleOptions[\"nodeBuiltins\"]>,\n): VitePlugin {\n const nodeModuleShimId = \"\\0mreact-router-node-module-shim\";\n\n return {\n name: \"mreact-router-browser-node-builtins\",\n enforce: \"pre\",\n resolveId(id) {\n if (platform === \"browser\" && nodeBuiltinSpecifiers.has(id)) {\n if (policy === \"externalize\") {\n if (id === \"node:module\" || id === \"module\") {\n return nodeModuleShimId;\n }\n\n return { external: true, id: id.startsWith(\"node:\") ? id : `node:${id}` };\n }\n\n this.error(`Browser build cannot import Node builtin ${JSON.stringify(id)}.`);\n }\n\n return undefined;\n },\n load(id) {\n if (id !== nodeModuleShimId) {\n return undefined;\n }\n\n return `export const builtinModules = [];\n\nexport function createRequire() {\n return function cloudflareRequire() {\n throw new Error(\"CommonJS require is not available in browser worker bundles.\");\n };\n}\n\nexport default { builtinModules, createRequire };\n`;\n },\n };\n}\n\nfunction routerCompatPlugin(plugin: RouterCompatPlugin): VitePlugin {\n const resolvers: Array<{\n filter: RegExp;\n callback: Parameters<RouterCompatBuildApi[\"onResolve\"]>[1];\n }> = [];\n const loaders: Array<{\n filter: RegExp;\n namespace?: string | undefined;\n callback: Parameters<RouterCompatBuildApi[\"onLoad\"]>[1];\n }> = [];\n\n plugin.setup({\n onLoad(options, callback) {\n loaders.push({ ...options, callback });\n },\n onResolve(options, callback) {\n resolvers.push({ ...options, callback });\n },\n });\n\n return {\n name: plugin.name,\n enforce: \"pre\",\n async resolveId(source, importer) {\n for (const resolver of resolvers) {\n if (!resolver.filter.test(source)) {\n continue;\n }\n\n const resolved = await resolver.callback({\n importer: importer === undefined ? undefined : cleanViteId(importer),\n path: source,\n resolveDir: importer === undefined ? \"\" : dirname(cleanViteId(importer)),\n });\n\n if (resolved === undefined) {\n continue;\n }\n\n if (resolved.errors !== undefined && resolved.errors.length > 0) {\n this.error(resolved.errors.map((error) => error.text).join(\"\\n\"));\n }\n\n if (resolved.path === undefined) {\n continue;\n }\n\n if (resolved.external === true) {\n return { external: true, id: resolved.path };\n }\n\n return resolved.namespace === undefined\n ? resolved.path\n : compatVirtualId(resolved.namespace, resolved.path);\n }\n\n return undefined;\n },\n async load(id) {\n const virtual = parseCompatVirtualId(id);\n const path = virtual?.path ?? cleanViteId(id);\n const namespace = virtual?.namespace;\n\n for (const loader of loaders) {\n if (loader.namespace !== namespace || !loader.filter.test(path)) {\n continue;\n }\n\n const loaded = await loader.callback({ path });\n\n if (loaded !== undefined) {\n return loaded.contents;\n }\n }\n\n return undefined;\n },\n };\n}\n\nfunction compatVirtualId(namespace: string, path: string): string {\n return `\\0mreact-router-compat:${encodeURIComponent(namespace)}:${encodeURIComponent(path)}`;\n}\n\nfunction parseCompatVirtualId(id: string): { namespace: string; path: string } | undefined {\n const prefix = \"\\0mreact-router-compat:\";\n\n if (!id.startsWith(prefix)) {\n return undefined;\n }\n\n const rest = id.slice(prefix.length);\n const separator = rest.indexOf(\":\");\n\n if (separator === -1) {\n return undefined;\n }\n\n return {\n namespace: decodeURIComponent(rest.slice(0, separator)),\n path: decodeURIComponent(rest.slice(separator + 1)),\n };\n}\n\nfunction cleanViteId(id: string): string {\n const withoutPrefix = id.startsWith(\"/@fs/\") ? id.slice(\"/@fs\".length) : id;\n const queryIndex = withoutPrefix.indexOf(\"?\");\n\n return queryIndex === -1 ? withoutPrefix : withoutPrefix.slice(0, queryIndex);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reckona/mreact-router",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.120",
|
|
4
4
|
"description": "File-system app router, SSR, actions, and deployment adapters for mreact.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jsx",
|
|
@@ -105,20 +105,20 @@
|
|
|
105
105
|
},
|
|
106
106
|
"dependencies": {
|
|
107
107
|
"typescript": "^6.0.3",
|
|
108
|
-
"@reckona/mreact": "0.0.
|
|
109
|
-
"@reckona/mreact-compat": "0.0.
|
|
110
|
-
"@reckona/mreact-
|
|
111
|
-
"@reckona/mreact-
|
|
112
|
-
"@reckona/mreact-
|
|
113
|
-
"@reckona/mreact-
|
|
114
|
-
"@reckona/mreact-
|
|
115
|
-
"@reckona/mreact-
|
|
116
|
-
"@reckona/mreact-
|
|
108
|
+
"@reckona/mreact": "0.0.120",
|
|
109
|
+
"@reckona/mreact-compat": "0.0.120",
|
|
110
|
+
"@reckona/mreact-reactive-core": "0.0.120",
|
|
111
|
+
"@reckona/mreact-query": "0.0.120",
|
|
112
|
+
"@reckona/mreact-devtools": "0.0.120",
|
|
113
|
+
"@reckona/mreact-compiler": "0.0.120",
|
|
114
|
+
"@reckona/mreact-reactive-dom": "0.0.120",
|
|
115
|
+
"@reckona/mreact-server": "0.0.120",
|
|
116
|
+
"@reckona/mreact-shared": "0.0.120"
|
|
117
117
|
},
|
|
118
118
|
"peerDependencies": {
|
|
119
119
|
"vite": ">=8 <9"
|
|
120
120
|
},
|
|
121
121
|
"optionalDependencies": {
|
|
122
|
-
"@reckona/mreact-router-native": "0.0.
|
|
122
|
+
"@reckona/mreact-router-native": "0.0.120"
|
|
123
123
|
}
|
|
124
124
|
}
|
package/src/build.ts
CHANGED
|
@@ -98,7 +98,7 @@ export interface BuildAppOptions extends AppRouterProjectOptions {
|
|
|
98
98
|
onBuildPhaseTiming?: ((timing: BuildAppPhaseTiming) => void) | undefined;
|
|
99
99
|
outDir: string;
|
|
100
100
|
targets?: readonly AppRouterBuildTarget[] | undefined;
|
|
101
|
-
viteConfig?: Pick<UserConfig, "plugins"> | undefined;
|
|
101
|
+
viteConfig?: Pick<UserConfig, "define" | "plugins"> | undefined;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
export type BuildAppPhase =
|
|
@@ -273,6 +273,7 @@ export async function buildApp(options: BuildAppOptions): Promise<BuildAppResult
|
|
|
273
273
|
: await timeBuildPhase(timingSink, "scan", () =>
|
|
274
274
|
scanAppRoutes({ appDir: project.routesDir }),
|
|
275
275
|
);
|
|
276
|
+
const viteDefine = options.viteConfig?.define;
|
|
276
277
|
const vitePlugins = options.viteConfig?.plugins;
|
|
277
278
|
const files =
|
|
278
279
|
timingSink === undefined
|
|
@@ -519,6 +520,7 @@ export async function buildApp(options: BuildAppOptions): Promise<BuildAppResult
|
|
|
519
520
|
timingSink === undefined
|
|
520
521
|
? await writeCloudflareRouteModules({
|
|
521
522
|
cloudflareDir,
|
|
523
|
+
define: viteDefine,
|
|
522
524
|
files,
|
|
523
525
|
prerenderedRoutes,
|
|
524
526
|
projectRoot: project.projectRoot,
|
|
@@ -531,6 +533,7 @@ export async function buildApp(options: BuildAppOptions): Promise<BuildAppResult
|
|
|
531
533
|
: await timeBuildPhase(timingSink, "cloudflare", () =>
|
|
532
534
|
writeCloudflareRouteModules({
|
|
533
535
|
cloudflareDir,
|
|
536
|
+
define: viteDefine,
|
|
534
537
|
files,
|
|
535
538
|
prerenderedRoutes,
|
|
536
539
|
projectRoot: project.projectRoot,
|
|
@@ -2409,6 +2412,7 @@ interface RouteRequestModuleBatchEntry {
|
|
|
2409
2412
|
async function writeCloudflareRouteModules(options: {
|
|
2410
2413
|
cacheDir?: string | undefined;
|
|
2411
2414
|
cloudflareDir: string;
|
|
2415
|
+
define?: UserConfig["define"] | undefined;
|
|
2412
2416
|
files: Record<string, string>;
|
|
2413
2417
|
prerenderedRoutes: Record<string, BuiltPrerenderedRoute>;
|
|
2414
2418
|
projectRoot: string;
|
|
@@ -2440,6 +2444,7 @@ async function writeCloudflareRouteModules(options: {
|
|
|
2440
2444
|
|
|
2441
2445
|
const serverRouteModules = await buildCloudflareServerRouteModuleBatch({
|
|
2442
2446
|
cacheDir: options.cacheDir,
|
|
2447
|
+
define: options.define,
|
|
2443
2448
|
routes: requiredRoutes
|
|
2444
2449
|
.filter(({ route }) => route.kind === "server" || route.kind === "metadata")
|
|
2445
2450
|
.map(({ route, routeId }) => ({ filename: route.file, routeId })),
|
|
@@ -2448,6 +2453,7 @@ async function writeCloudflareRouteModules(options: {
|
|
|
2448
2453
|
});
|
|
2449
2454
|
const loaderRouteModules = await buildCloudflareRouteLoaderModuleBatch({
|
|
2450
2455
|
cacheDir: options.cacheDir,
|
|
2456
|
+
define: options.define,
|
|
2451
2457
|
routes: requiredRoutes
|
|
2452
2458
|
.filter(({ route, routeFile }) =>
|
|
2453
2459
|
route.kind === "page" && options.sourceAnalysis.byRouteFile.get(routeFile)?.hasLoader === true
|
|
@@ -2474,6 +2480,7 @@ async function writeCloudflareRouteModules(options: {
|
|
|
2474
2480
|
);
|
|
2475
2481
|
const directComponentModules = await buildCloudflareServerComponentModuleBatch({
|
|
2476
2482
|
cacheDir: options.cacheDir,
|
|
2483
|
+
define: options.define,
|
|
2477
2484
|
projectRoot: options.projectRoot,
|
|
2478
2485
|
routes: directComponentRoutes,
|
|
2479
2486
|
serverModules: options.serverModules,
|
|
@@ -2482,6 +2489,7 @@ async function writeCloudflareRouteModules(options: {
|
|
|
2482
2489
|
});
|
|
2483
2490
|
const stringShellComponentModules = await buildCloudflareStringRouteComponentModuleBatch({
|
|
2484
2491
|
cacheDir: options.cacheDir,
|
|
2492
|
+
define: options.define,
|
|
2485
2493
|
projectRoot: options.projectRoot,
|
|
2486
2494
|
routes: stringShellComponentRoutes,
|
|
2487
2495
|
serverModules: options.serverModules,
|
|
@@ -2546,6 +2554,7 @@ async function writeCloudflareRouteModules(options: {
|
|
|
2546
2554
|
serverOutput === "stream"
|
|
2547
2555
|
? await buildCloudflareStreamRouteComponentModule({
|
|
2548
2556
|
cacheDir: options.cacheDir,
|
|
2557
|
+
define: options.define,
|
|
2549
2558
|
filename: route.file,
|
|
2550
2559
|
projectRoot: options.projectRoot,
|
|
2551
2560
|
routesDir: options.routesDir,
|
|
@@ -2555,6 +2564,7 @@ async function writeCloudflareRouteModules(options: {
|
|
|
2555
2564
|
})
|
|
2556
2565
|
: await buildCloudflareStringRouteComponentModule({
|
|
2557
2566
|
cacheDir: options.cacheDir,
|
|
2567
|
+
define: options.define,
|
|
2558
2568
|
filename: route.file,
|
|
2559
2569
|
projectRoot: options.projectRoot,
|
|
2560
2570
|
routesDir: options.routesDir,
|
|
@@ -2754,6 +2764,7 @@ interface CloudflareShellFile {
|
|
|
2754
2764
|
|
|
2755
2765
|
async function buildCloudflareServerComponentModuleBatch(options: {
|
|
2756
2766
|
cacheDir?: string | undefined;
|
|
2767
|
+
define?: UserConfig["define"] | undefined;
|
|
2757
2768
|
projectRoot: string;
|
|
2758
2769
|
routes: readonly CloudflareBatchedComponentRoute[];
|
|
2759
2770
|
serverModules: Record<string, BuiltServerModuleArtifact>;
|
|
@@ -2769,6 +2780,7 @@ async function buildCloudflareServerComponentModuleBatch(options: {
|
|
|
2769
2780
|
options.routes.map(async (route) => {
|
|
2770
2781
|
const metadataModule = await buildCloudflareRouteMetadataExportModule({
|
|
2771
2782
|
cacheDir: options.cacheDir,
|
|
2783
|
+
define: options.define,
|
|
2772
2784
|
filename: route.filename,
|
|
2773
2785
|
hasMetadata: buildSourceAnalysisForFile(
|
|
2774
2786
|
options.sourceAnalysis,
|
|
@@ -2801,6 +2813,7 @@ async function buildCloudflareServerComponentModuleBatch(options: {
|
|
|
2801
2813
|
const output = await bundleRouterModules({
|
|
2802
2814
|
cacheDir: options.cacheDir,
|
|
2803
2815
|
chunkFileNames: "routes/chunks/[name].[hash].mjs",
|
|
2816
|
+
define: options.define,
|
|
2804
2817
|
entries: bundleEntries,
|
|
2805
2818
|
entryFileNames: "routes/[name].[hash].mjs",
|
|
2806
2819
|
minify: true,
|
|
@@ -2844,6 +2857,7 @@ async function buildCloudflareServerComponentModuleBatch(options: {
|
|
|
2844
2857
|
|
|
2845
2858
|
async function buildCloudflareStringRouteComponentModuleBatch(options: {
|
|
2846
2859
|
cacheDir?: string | undefined;
|
|
2860
|
+
define?: UserConfig["define"] | undefined;
|
|
2847
2861
|
projectRoot: string;
|
|
2848
2862
|
routes: readonly CloudflareBatchedStringRoute[];
|
|
2849
2863
|
serverModules: Record<string, BuiltServerModuleArtifact>;
|
|
@@ -2861,6 +2875,7 @@ async function buildCloudflareStringRouteComponentModuleBatch(options: {
|
|
|
2861
2875
|
const pageMetadataId = `mreact:metadata:${route.routeId}:page`;
|
|
2862
2876
|
const pageMetadataModule = await buildCloudflareRouteMetadataExportModule({
|
|
2863
2877
|
cacheDir: options.cacheDir,
|
|
2878
|
+
define: options.define,
|
|
2864
2879
|
filename: route.filename,
|
|
2865
2880
|
hasMetadata: buildSourceAnalysisForFile(
|
|
2866
2881
|
options.sourceAnalysis,
|
|
@@ -2886,6 +2901,7 @@ async function buildCloudflareStringRouteComponentModuleBatch(options: {
|
|
|
2886
2901
|
const shellMetadataId = `mreact:metadata:${route.routeId}:shell:${index}`;
|
|
2887
2902
|
const shellMetadataModule = await buildCloudflareRouteMetadataExportModule({
|
|
2888
2903
|
cacheDir: options.cacheDir,
|
|
2904
|
+
define: options.define,
|
|
2889
2905
|
filename: shell.file,
|
|
2890
2906
|
hasMetadata: buildSourceAnalysisForFile(
|
|
2891
2907
|
options.sourceAnalysis,
|
|
@@ -2926,6 +2942,7 @@ async function buildCloudflareStringRouteComponentModuleBatch(options: {
|
|
|
2926
2942
|
const output = await bundleRouterModules({
|
|
2927
2943
|
cacheDir: options.cacheDir,
|
|
2928
2944
|
chunkFileNames: "routes/chunks/[name].[hash].mjs",
|
|
2945
|
+
define: options.define,
|
|
2929
2946
|
entries: bundleEntries,
|
|
2930
2947
|
entryFileNames: "routes/[name].[hash].mjs",
|
|
2931
2948
|
minify: true,
|
|
@@ -3055,6 +3072,7 @@ ${cloudflareShellRuntimeSource()}`;
|
|
|
3055
3072
|
|
|
3056
3073
|
async function buildCloudflareServerComponentModule(options: {
|
|
3057
3074
|
cacheDir?: string | undefined;
|
|
3075
|
+
define?: UserConfig["define"] | undefined;
|
|
3058
3076
|
filename: string;
|
|
3059
3077
|
projectRoot: string;
|
|
3060
3078
|
serverOutput: ServerOutputMode;
|
|
@@ -3064,6 +3082,7 @@ async function buildCloudflareServerComponentModule(options: {
|
|
|
3064
3082
|
}): Promise<string> {
|
|
3065
3083
|
const metadataModule = await buildCloudflareRouteMetadataExportModule({
|
|
3066
3084
|
cacheDir: options.cacheDir,
|
|
3085
|
+
define: options.define,
|
|
3067
3086
|
filename: options.filename,
|
|
3068
3087
|
hasMetadata: buildSourceAnalysisForFile(options.sourceAnalysis, options.projectRoot, options.filename)?.hasMetadata,
|
|
3069
3088
|
root: options.projectRoot,
|
|
@@ -3078,6 +3097,7 @@ async function buildCloudflareServerComponentModule(options: {
|
|
|
3078
3097
|
entry,
|
|
3079
3098
|
filename: `${options.filename}.mreact-cloudflare-component.js`,
|
|
3080
3099
|
cacheDir: options.cacheDir,
|
|
3100
|
+
define: options.define,
|
|
3081
3101
|
modules: metadataModule === undefined
|
|
3082
3102
|
? new Map()
|
|
3083
3103
|
: new Map([["mreact:metadata", metadataModule]]),
|
|
@@ -3113,6 +3133,7 @@ export const slots = routeModule.slots;`;
|
|
|
3113
3133
|
|
|
3114
3134
|
async function buildCloudflareStringRouteComponentModule(options: {
|
|
3115
3135
|
cacheDir?: string | undefined;
|
|
3136
|
+
define?: UserConfig["define"] | undefined;
|
|
3116
3137
|
filename: string;
|
|
3117
3138
|
projectRoot: string;
|
|
3118
3139
|
routesDir: string;
|
|
@@ -3125,6 +3146,7 @@ async function buildCloudflareStringRouteComponentModule(options: {
|
|
|
3125
3146
|
if (shellFiles.length === 0) {
|
|
3126
3147
|
return buildCloudflareServerComponentModule({
|
|
3127
3148
|
cacheDir: options.cacheDir,
|
|
3149
|
+
define: options.define,
|
|
3128
3150
|
filename: options.filename,
|
|
3129
3151
|
projectRoot: options.projectRoot,
|
|
3130
3152
|
serverModules: options.serverModules,
|
|
@@ -3136,6 +3158,7 @@ async function buildCloudflareStringRouteComponentModule(options: {
|
|
|
3136
3158
|
|
|
3137
3159
|
const pageModule = await buildCloudflareComponentExportModule({
|
|
3138
3160
|
cacheDir: options.cacheDir,
|
|
3161
|
+
define: options.define,
|
|
3139
3162
|
filename: options.filename,
|
|
3140
3163
|
projectRoot: options.projectRoot,
|
|
3141
3164
|
serverModules: options.serverModules,
|
|
@@ -3147,6 +3170,7 @@ async function buildCloudflareStringRouteComponentModule(options: {
|
|
|
3147
3170
|
shellFiles.map((shell) =>
|
|
3148
3171
|
buildCloudflareComponentExportModule({
|
|
3149
3172
|
cacheDir: options.cacheDir,
|
|
3173
|
+
define: options.define,
|
|
3150
3174
|
filename: shell.file,
|
|
3151
3175
|
projectRoot: options.projectRoot,
|
|
3152
3176
|
serverModules: options.serverModules,
|
|
@@ -3215,6 +3239,7 @@ ${cloudflareShellRuntimeSource()}`;
|
|
|
3215
3239
|
return bundleCloudflareVirtualModule({
|
|
3216
3240
|
entry,
|
|
3217
3241
|
cacheDir: options.cacheDir,
|
|
3242
|
+
define: options.define,
|
|
3218
3243
|
filename: `${options.filename}.mreact-cloudflare-string-route.js`,
|
|
3219
3244
|
modules: new Map([
|
|
3220
3245
|
["mreact:page", pageModule],
|
|
@@ -3229,6 +3254,7 @@ ${cloudflareShellRuntimeSource()}`;
|
|
|
3229
3254
|
|
|
3230
3255
|
async function buildCloudflareStreamRouteComponentModule(options: {
|
|
3231
3256
|
cacheDir?: string | undefined;
|
|
3257
|
+
define?: UserConfig["define"] | undefined;
|
|
3232
3258
|
filename: string;
|
|
3233
3259
|
projectRoot: string;
|
|
3234
3260
|
routesDir: string;
|
|
@@ -3238,6 +3264,7 @@ async function buildCloudflareStreamRouteComponentModule(options: {
|
|
|
3238
3264
|
}): Promise<string> {
|
|
3239
3265
|
const pageModule = await buildCloudflareComponentExportModule({
|
|
3240
3266
|
cacheDir: options.cacheDir,
|
|
3267
|
+
define: options.define,
|
|
3241
3268
|
filename: options.filename,
|
|
3242
3269
|
projectRoot: options.projectRoot,
|
|
3243
3270
|
serverModules: options.serverModules,
|
|
@@ -3250,6 +3277,7 @@ async function buildCloudflareStreamRouteComponentModule(options: {
|
|
|
3250
3277
|
shellFiles.map((shell) =>
|
|
3251
3278
|
buildCloudflareComponentExportModule({
|
|
3252
3279
|
cacheDir: options.cacheDir,
|
|
3280
|
+
define: options.define,
|
|
3253
3281
|
filename: shell.file,
|
|
3254
3282
|
projectRoot: options.projectRoot,
|
|
3255
3283
|
serverModules: options.serverModules,
|
|
@@ -3336,6 +3364,7 @@ ${cloudflareShellRuntimeSource()}`;
|
|
|
3336
3364
|
return bundleCloudflareVirtualModule({
|
|
3337
3365
|
entry,
|
|
3338
3366
|
cacheDir: options.cacheDir,
|
|
3367
|
+
define: options.define,
|
|
3339
3368
|
filename: `${options.filename}.mreact-cloudflare-stream-route.js`,
|
|
3340
3369
|
modules: new Map([
|
|
3341
3370
|
["mreact:page", pageModule],
|
|
@@ -3646,6 +3675,7 @@ function escapeHtml(value) {
|
|
|
3646
3675
|
|
|
3647
3676
|
async function buildCloudflareComponentExportModule(options: {
|
|
3648
3677
|
cacheDir?: string | undefined;
|
|
3678
|
+
define?: UserConfig["define"] | undefined;
|
|
3649
3679
|
filename: string;
|
|
3650
3680
|
projectRoot: string;
|
|
3651
3681
|
serverModules: Record<string, BuiltServerModuleArtifact>;
|
|
@@ -3655,6 +3685,7 @@ async function buildCloudflareComponentExportModule(options: {
|
|
|
3655
3685
|
}): Promise<string> {
|
|
3656
3686
|
const metadataModule = await buildCloudflareRouteMetadataExportModule({
|
|
3657
3687
|
cacheDir: options.cacheDir,
|
|
3688
|
+
define: options.define,
|
|
3658
3689
|
filename: options.filename,
|
|
3659
3690
|
hasMetadata: buildSourceAnalysisForFile(options.sourceAnalysis, options.projectRoot, options.filename)?.hasMetadata,
|
|
3660
3691
|
root: options.projectRoot,
|
|
@@ -3673,6 +3704,7 @@ export const slots = routeModule.slots;`;
|
|
|
3673
3704
|
return bundleCloudflareVirtualModule({
|
|
3674
3705
|
entry,
|
|
3675
3706
|
cacheDir: options.cacheDir,
|
|
3707
|
+
define: options.define,
|
|
3676
3708
|
filename: `${options.filename}.mreact-cloudflare-${options.serverOutput}-component.js`,
|
|
3677
3709
|
modules: metadataModule === undefined
|
|
3678
3710
|
? new Map()
|
|
@@ -3707,12 +3739,14 @@ async function writeCloudflareBatchedRouteModuleChunks(
|
|
|
3707
3739
|
|
|
3708
3740
|
async function buildCloudflareRouteLoaderModuleBatch(options: {
|
|
3709
3741
|
cacheDir?: string | undefined;
|
|
3742
|
+
define?: UserConfig["define"] | undefined;
|
|
3710
3743
|
routes: readonly { filename: string; routeId: string }[];
|
|
3711
3744
|
root: string;
|
|
3712
3745
|
vitePlugins?: readonly PluginOption[] | undefined;
|
|
3713
3746
|
}): Promise<CloudflareBatchedRouteModules> {
|
|
3714
3747
|
return await bundleCloudflareModuleBatch({
|
|
3715
3748
|
cacheDir: options.cacheDir,
|
|
3749
|
+
define: options.define,
|
|
3716
3750
|
entries: options.routes.map((route) => ({
|
|
3717
3751
|
code: cloudflareRouteLoaderModuleEntry(route.filename),
|
|
3718
3752
|
filename: `${route.filename}.mreact-cloudflare-loader.js`,
|
|
@@ -3726,12 +3760,14 @@ async function buildCloudflareRouteLoaderModuleBatch(options: {
|
|
|
3726
3760
|
|
|
3727
3761
|
export async function __buildCloudflareRouteLoaderModuleBatchForTests(options: {
|
|
3728
3762
|
cacheDir?: string | undefined;
|
|
3763
|
+
define?: UserConfig["define"] | undefined;
|
|
3729
3764
|
projectRoot: string;
|
|
3730
3765
|
routes: readonly { filename: string; routeId: string }[];
|
|
3731
3766
|
vitePlugins?: readonly PluginOption[] | undefined;
|
|
3732
3767
|
}): Promise<Record<string, string>> {
|
|
3733
3768
|
const output = await buildCloudflareRouteLoaderModuleBatch({
|
|
3734
3769
|
cacheDir: options.cacheDir,
|
|
3770
|
+
define: options.define,
|
|
3735
3771
|
root: options.projectRoot,
|
|
3736
3772
|
routes: options.routes,
|
|
3737
3773
|
vitePlugins: options.vitePlugins,
|
|
@@ -3744,12 +3780,14 @@ export async function __buildCloudflareRouteLoaderModuleBatchForTests(options: {
|
|
|
3744
3780
|
|
|
3745
3781
|
async function buildCloudflareServerRouteModuleBatch(options: {
|
|
3746
3782
|
cacheDir?: string | undefined;
|
|
3783
|
+
define?: UserConfig["define"] | undefined;
|
|
3747
3784
|
routes: readonly { filename: string; routeId: string }[];
|
|
3748
3785
|
root: string;
|
|
3749
3786
|
vitePlugins?: readonly PluginOption[] | undefined;
|
|
3750
3787
|
}): Promise<CloudflareBatchedRouteModules> {
|
|
3751
3788
|
return await bundleCloudflareModuleBatch({
|
|
3752
3789
|
cacheDir: options.cacheDir,
|
|
3790
|
+
define: options.define,
|
|
3753
3791
|
entries: options.routes.map((route) => ({
|
|
3754
3792
|
code: cloudflareServerRouteModuleEntry(route.filename),
|
|
3755
3793
|
filename: `${route.filename}.mreact-cloudflare-server-route.js`,
|
|
@@ -3763,6 +3801,7 @@ async function buildCloudflareServerRouteModuleBatch(options: {
|
|
|
3763
3801
|
|
|
3764
3802
|
async function bundleCloudflareModuleBatch(options: {
|
|
3765
3803
|
cacheDir?: string | undefined;
|
|
3804
|
+
define?: UserConfig["define"] | undefined;
|
|
3766
3805
|
entries: readonly {
|
|
3767
3806
|
code: string;
|
|
3768
3807
|
filename: string;
|
|
@@ -3779,6 +3818,7 @@ async function bundleCloudflareModuleBatch(options: {
|
|
|
3779
3818
|
const output = await bundleRouterModules({
|
|
3780
3819
|
cacheDir: options.cacheDir,
|
|
3781
3820
|
chunkFileNames: "routes/chunks/[name].[hash].mjs",
|
|
3821
|
+
define: options.define,
|
|
3782
3822
|
entries: options.entries,
|
|
3783
3823
|
entryFileNames: "routes/[name].[hash].mjs",
|
|
3784
3824
|
minify: true,
|
|
@@ -3817,6 +3857,7 @@ function cloudflareRouteLoaderModuleEntry(filename: string): string {
|
|
|
3817
3857
|
|
|
3818
3858
|
async function buildCloudflareRouteMetadataExportModule(options: {
|
|
3819
3859
|
cacheDir?: string | undefined;
|
|
3860
|
+
define?: UserConfig["define"] | undefined;
|
|
3820
3861
|
filename: string;
|
|
3821
3862
|
hasMetadata?: boolean | undefined;
|
|
3822
3863
|
root?: string | undefined;
|
|
@@ -3833,6 +3874,7 @@ export const metadata = routeMetadataModule.metadata;`;
|
|
|
3833
3874
|
return bundleCloudflareModule({
|
|
3834
3875
|
entry,
|
|
3835
3876
|
cacheDir: options.cacheDir,
|
|
3877
|
+
define: options.define,
|
|
3836
3878
|
filename: `${options.filename}.mreact-cloudflare-metadata.js`,
|
|
3837
3879
|
plugins: [cloudflareWorkspaceRuntimePlugin()],
|
|
3838
3880
|
resolveDir: dirname(options.filename),
|
|
@@ -3858,6 +3900,7 @@ export default defaultHandler;`;
|
|
|
3858
3900
|
|
|
3859
3901
|
async function bundleCloudflareModule(options: {
|
|
3860
3902
|
cacheDir?: string | undefined;
|
|
3903
|
+
define?: UserConfig["define"] | undefined;
|
|
3861
3904
|
entry: string;
|
|
3862
3905
|
filename: string;
|
|
3863
3906
|
plugins: RouterCompatPlugin[];
|
|
@@ -3868,6 +3911,7 @@ async function bundleCloudflareModule(options: {
|
|
|
3868
3911
|
const output = await bundleRouterModule({
|
|
3869
3912
|
cacheDir: options.cacheDir,
|
|
3870
3913
|
code: options.entry,
|
|
3914
|
+
define: options.define,
|
|
3871
3915
|
filename: options.filename,
|
|
3872
3916
|
minify: true,
|
|
3873
3917
|
platform: "node",
|
|
@@ -3888,6 +3932,7 @@ async function bundleCloudflareModule(options: {
|
|
|
3888
3932
|
|
|
3889
3933
|
async function bundleCloudflareVirtualModule(options: {
|
|
3890
3934
|
cacheDir?: string | undefined;
|
|
3935
|
+
define?: UserConfig["define"] | undefined;
|
|
3891
3936
|
entry: string;
|
|
3892
3937
|
filename: string;
|
|
3893
3938
|
modules: ReadonlyMap<string, string>;
|
|
@@ -3898,6 +3943,7 @@ async function bundleCloudflareVirtualModule(options: {
|
|
|
3898
3943
|
}): Promise<string> {
|
|
3899
3944
|
return bundleCloudflareModule({
|
|
3900
3945
|
cacheDir: options.cacheDir,
|
|
3946
|
+
define: options.define,
|
|
3901
3947
|
entry: options.entry,
|
|
3902
3948
|
filename: options.filename,
|
|
3903
3949
|
plugins: [
|