@reckona/mreact-router 0.0.182 → 0.0.184
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/dist/build.d.ts +3 -0
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +271 -8
- package/dist/build.js.map +1 -1
- package/dist/bundle-pipeline.d.ts.map +1 -1
- package/dist/bundle-pipeline.js +9 -0
- package/dist/bundle-pipeline.js.map +1 -1
- package/dist/client.d.ts +1 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +193 -2
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +6 -0
- package/dist/config.js.map +1 -1
- package/dist/module-runner.d.ts.map +1 -1
- package/dist/module-runner.js +132 -1
- package/dist/module-runner.js.map +1 -1
- package/dist/render.d.ts +2 -0
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +24 -13
- package/dist/render.js.map +1 -1
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +34 -1
- package/dist/vite.js.map +1 -1
- package/package.json +11 -11
- package/src/build.ts +406 -10
- package/src/bundle-pipeline.ts +9 -0
- package/src/client.ts +195 -2
- package/src/config.ts +8 -0
- package/src/module-runner.ts +185 -1
- package/src/render.ts +37 -15
- package/src/vite.ts +39 -1
package/dist/config.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export interface AppRouterProductionOptions {
|
|
|
22
22
|
}
|
|
23
23
|
export interface AppRouterProjectOptions {
|
|
24
24
|
assetBaseUrl?: string | undefined;
|
|
25
|
+
buildConcurrency?: number | undefined;
|
|
25
26
|
buildTargets?: readonly AppRouterBuildTarget[] | undefined;
|
|
26
27
|
clientSourceMaps?: AppRouterClientSourceMapOption | undefined;
|
|
27
28
|
/**
|
|
@@ -43,6 +44,7 @@ export interface AppRouterProjectOptions {
|
|
|
43
44
|
export interface ResolvedAppRouterProject {
|
|
44
45
|
allowedSourceDirs: readonly string[];
|
|
45
46
|
assetBaseUrl?: string | undefined;
|
|
47
|
+
buildConcurrency?: number | undefined;
|
|
46
48
|
buildTargets: readonly AppRouterBuildTarget[];
|
|
47
49
|
clientSourceMaps: AppRouterClientSourceMapMode;
|
|
48
50
|
clientConsolePureFunctions?: readonly string[] | undefined;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,YAAY,GAAG,YAAY,CAAC;AACxE;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;AACjG;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;AACxE;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG,OAAO,GAAG,4BAA4B,CAAC;AAEpF;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,iBAAiB,CAAC,EAAE,OAAO,GAAG,SAAS,4BAA4B,EAAE,GAAG,SAAS,CAAC;CACnF;AAED,MAAM,WAAW,uBAAuB;IACtC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,YAAY,CAAC,EAAE,SAAS,oBAAoB,EAAE,GAAG,SAAS,CAAC;IAC3D,gBAAgB,CAAC,EAAE,8BAA8B,GAAG,SAAS,CAAC;IAC9D;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IAClD,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,UAAU,CAAC,EAAE,0BAA0B,GAAG,SAAS,CAAC;IACpD,SAAS,CAAC,EAAE,MAAM,GAAG,S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AAG,SAAS,GAChD,4BAA4B,CAgB9B;AAED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,SAAS,oBAAoB,EAAE,GAAG,SAAS,GACnD,SAAS,oBAAoB,EAAE,CAoBjC"}
|
package/dist/config.js
CHANGED
|
@@ -8,6 +8,9 @@ export function resolveAppRouterProjectOptions(options) {
|
|
|
8
8
|
return {
|
|
9
9
|
allowedSourceDirs: (options.allowedSourceDirs ?? [appDir]).map((directory) => resolveProjectPath(appDir, directory, "allowedSourceDirs")),
|
|
10
10
|
...(options.assetBaseUrl === undefined ? {} : { assetBaseUrl: options.assetBaseUrl }),
|
|
11
|
+
...(options.buildConcurrency === undefined
|
|
12
|
+
? {}
|
|
13
|
+
: { buildConcurrency: options.buildConcurrency }),
|
|
11
14
|
buildTargets: resolveBuildTargets(options.buildTargets),
|
|
12
15
|
clientSourceMaps: resolveClientSourceMapMode(options.clientSourceMaps),
|
|
13
16
|
...(clientConsolePureFunctions === undefined ? {} : { clientConsolePureFunctions }),
|
|
@@ -25,6 +28,9 @@ export function resolveAppRouterProjectOptions(options) {
|
|
|
25
28
|
return {
|
|
26
29
|
allowedSourceDirs: (options.allowedSourceDirs ?? defaultAllowedSourceDirs).map((directory) => resolveProjectPath(projectRoot, directory, "allowedSourceDirs")),
|
|
27
30
|
...(options.assetBaseUrl === undefined ? {} : { assetBaseUrl: options.assetBaseUrl }),
|
|
31
|
+
...(options.buildConcurrency === undefined
|
|
32
|
+
? {}
|
|
33
|
+
: { buildConcurrency: options.buildConcurrency }),
|
|
28
34
|
buildTargets: resolveBuildTargets(options.buildTargets),
|
|
29
35
|
clientSourceMaps: resolveClientSourceMapMode(options.clientSourceMaps),
|
|
30
36
|
...(clientConsolePureFunctions === undefined ? {} : { clientConsolePureFunctions }),
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ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AC3C,MAAM,IAAI,KAAK,CACb,gBAAgB,UAAU,kDAAkD,IAAI,KAAK,UAAU,KAAK,YAAY,EAAE,CACnH,CAAC;IACJ,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,WAAW,CAAC,IAAY,EAAE,IAAY;IAC7C,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY,EAAE,IAAY;IACnD,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAE1C,OAAO,YAAY,KAAK,EAAE,IAAI,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;AAC9F,CAAC","sourcesContent":["import { basename, dirname, isAbsolute, relative, resolve } from \"node:path\";\n\n/**\n * Selects the deployment runtime artifacts emitted by an app-router build.\n */\nexport type AppRouterBuildTarget = \"node\" | \"cloudflare\" | \"aws-lambda\";\n/**\n * Names a browser console method that can be stripped from client bundles.\n */\nexport type AppRouterClientConsoleMethod = \"debug\" | \"error\" | \"info\" | \"log\" | \"trace\" | \"warn\";\n/**\n * Controls how client bundle source maps are generated.\n */\nexport type AppRouterClientSourceMapMode = \"none\" | \"hidden\" | \"linked\";\n/**\n * Configures client source map output with a boolean shortcut or explicit mode.\n */\nexport type AppRouterClientSourceMapOption = boolean | AppRouterClientSourceMapMode;\n\n/**\n * Configures production-only app-router build behavior.\n */\nexport interface AppRouterProductionOptions {\n dropClientConsole?: boolean | readonly AppRouterClientConsoleMethod[] | undefined;\n}\n\nexport interface AppRouterProjectOptions {\n assetBaseUrl?: string | undefined;\n buildTargets?: readonly AppRouterBuildTarget[] | undefined;\n clientSourceMaps?: AppRouterClientSourceMapOption | undefined;\n /**\n * Legacy route root. When provided without routesDir/projectRoot, this keeps\n * the historical \"appDir is the whole app boundary\" behavior.\n *\n * @deprecated Use projectRoot + routesDir instead. The legacy appDir shortcut\n * is kept for direct tests and older programmatic callers and is planned for\n * removal after 0.1.0.\n */\n appDir?: string | undefined;\n allowedSourceDirs?: readonly string[] | undefined;\n projectRoot?: string | undefined;\n production?: AppRouterProductionOptions | undefined;\n publicDir?: string | undefined;\n publicAssetBaseUrl?: string | undefined;\n routesDir?: string | undefined;\n}\n\nexport interface ResolvedAppRouterProject {\n allowedSourceDirs: readonly string[];\n assetBaseUrl?: string | undefined;\n buildTargets: readonly AppRouterBuildTarget[];\n clientSourceMaps: AppRouterClientSourceMapMode;\n clientConsolePureFunctions?: readonly string[] | undefined;\n projectRoot: string;\n publicAssetBaseUrl?: string | undefined;\n publicDir: string;\n routesDir: string;\n}\n\nexport function resolveAppRouterProjectOptions(\n options: AppRouterProjectOptions,\n): ResolvedAppRouterProject {\n const clientConsolePureFunctions = resolveClientConsolePureFunctions(\n options.production?.dropClientConsole,\n );\n\n if (\n options.appDir !== undefined &&\n options.projectRoot === undefined &&\n options.routesDir === undefined\n ) {\n const appDir = resolve(options.appDir);\n\n return {\n allowedSourceDirs: (options.allowedSourceDirs ?? [appDir]).map((directory) =>\n resolveProjectPath(appDir, directory, \"allowedSourceDirs\"),\n ),\n ...(options.assetBaseUrl === undefined ? {} : { assetBaseUrl: options.assetBaseUrl }),\n buildTargets: resolveBuildTargets(options.buildTargets),\n clientSourceMaps: resolveClientSourceMapMode(options.clientSourceMaps),\n ...(clientConsolePureFunctions === undefined ? {} : { clientConsolePureFunctions }),\n projectRoot: appDir,\n ...(options.publicAssetBaseUrl === undefined\n ? {}\n : { publicAssetBaseUrl: options.publicAssetBaseUrl }),\n publicDir: resolveProjectPath(appDir, options.publicDir ?? \"public\", \"publicDir\"),\n routesDir: appDir,\n };\n }\n\n const projectRoot = resolve(options.projectRoot ?? process.cwd());\n const routesDir = resolveProjectPath(projectRoot, options.routesDir ?? \"src/app\", \"routesDir\");\n const defaultAllowedSourceDirs =\n options.routesDir === undefined ? [\"src\"] : [defaultAllowedSourceDir(projectRoot, routesDir)];\n\n return {\n allowedSourceDirs: (options.allowedSourceDirs ?? defaultAllowedSourceDirs).map((directory) =>\n resolveProjectPath(projectRoot, directory, \"allowedSourceDirs\"),\n ),\n ...(options.assetBaseUrl === undefined ? {} : { assetBaseUrl: options.assetBaseUrl }),\n buildTargets: resolveBuildTargets(options.buildTargets),\n clientSourceMaps: resolveClientSourceMapMode(options.clientSourceMaps),\n ...(clientConsolePureFunctions === undefined ? {} : { clientConsolePureFunctions }),\n projectRoot,\n ...(options.publicAssetBaseUrl === undefined\n ? {}\n : { publicAssetBaseUrl: options.publicAssetBaseUrl }),\n publicDir: resolveProjectPath(projectRoot, options.publicDir ?? \"public\", \"publicDir\"),\n routesDir,\n };\n}\n\nfunction defaultAllowedSourceDir(projectRoot: string, routesDir: string): string {\n const sourceRoot = dirname(routesDir);\n return basename(routesDir) === \"app\" && sourceRoot !== projectRoot ? sourceRoot : routesDir;\n}\n\nconst defaultDroppedClientConsoleMethods = [\"debug\", \"info\", \"log\"] as const;\nconst supportedClientConsoleMethods = new Set<AppRouterClientConsoleMethod>([\n \"debug\",\n \"error\",\n \"info\",\n \"log\",\n \"trace\",\n \"warn\",\n]);\n\nexport function resolveClientConsolePureFunctions(\n value: AppRouterProductionOptions[\"dropClientConsole\"],\n): readonly string[] | undefined {\n if (value === undefined || value === false) {\n return undefined;\n }\n\n const methods = value === true ? defaultDroppedClientConsoleMethods : value;\n const uniqueMethods = [...new Set(methods)];\n\n for (const method of uniqueMethods) {\n if (!supportedClientConsoleMethods.has(method)) {\n throw new Error(\n `Unsupported mreactRouter production.dropClientConsole method ${JSON.stringify(method)}. Expected \"debug\", \"error\", \"info\", \"log\", \"trace\", or \"warn\".`,\n );\n }\n }\n\n return uniqueMethods.length === 0\n ? undefined\n : uniqueMethods.map((method) => `console.${method}`);\n}\n\nexport function resolveClientSourceMapMode(\n value: AppRouterClientSourceMapOption | undefined,\n): AppRouterClientSourceMapMode {\n if (value === undefined || value === false || value === \"none\") {\n return \"none\";\n }\n\n if (value === true || value === \"linked\") {\n return \"linked\";\n }\n\n if (value === \"hidden\") {\n return \"hidden\";\n }\n\n throw new Error(\n `Unsupported mreactRouter clientSourceMaps value ${JSON.stringify(value)}. Expected false, true, \"none\", \"hidden\", or \"linked\".`,\n );\n}\n\nexport function resolveBuildTargets(\n targets: readonly AppRouterBuildTarget[] | undefined,\n): readonly AppRouterBuildTarget[] {\n if (targets === undefined) {\n return [\"node\"];\n }\n\n const uniqueTargets = [...new Set(targets)];\n\n if (uniqueTargets.length === 0) {\n throw new Error(\"mreactRouter buildTargets must include at least one target.\");\n }\n\n for (const target of uniqueTargets) {\n if (target !== \"node\" && target !== \"cloudflare\" && target !== \"aws-lambda\") {\n throw new Error(\n `Unsupported mreactRouter build target ${JSON.stringify(target)}. Expected \"node\", \"cloudflare\", or \"aws-lambda\".`,\n );\n }\n }\n\n return uniqueTargets;\n}\n\nfunction resolveProjectPath(root: string, path: string, optionName: string): string {\n const resolvedPath = resolvePath(root, path);\n\n if (!isInsideDirectory(root, resolvedPath)) {\n throw new Error(\n `mreactRouter ${optionName} must resolve inside projectRoot. projectRoot: ${root}; ${optionName}: ${resolvedPath}`,\n );\n }\n\n return resolvedPath;\n}\n\nfunction resolvePath(root: string, path: string): string {\n return isAbsolute(path) ? resolve(path) : resolve(root, path);\n}\n\nfunction isInsideDirectory(root: string, path: string): boolean {\n const relativePath = relative(root, path);\n\n return relativePath === \"\" || (!relativePath.startsWith(\"..\") && !isAbsolute(relativePath));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6D7E,MAAM,UAAU,8BAA8B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ED,SAAS,kBAAkB,CAAC,IAAY,EAAE,IAAY,EAAE,UAAkB;IACxE,MAAM,YAAY,GAAG,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAE7C,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,YAAY,CAAC,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CACb,gBAAgB,UAAU,kDAAkD,IAAI,KAAK,UAAU,KAAK,YAAY,EAAE,CACnH,CAAC;IACJ,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,WAAW,CAAC,IAAY,EAAE,IAAY;IAC7C,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY,EAAE,IAAY;IACnD,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAE1C,OAAO,YAAY,KAAK,EAAE,IAAI,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;AAC9F,CAAC","sourcesContent":["import { basename, dirname, isAbsolute, relative, resolve } from \"node:path\";\n\n/**\n * Selects the deployment runtime artifacts emitted by an app-router build.\n */\nexport type AppRouterBuildTarget = \"node\" | \"cloudflare\" | \"aws-lambda\";\n/**\n * Names a browser console method that can be stripped from client bundles.\n */\nexport type AppRouterClientConsoleMethod = \"debug\" | \"error\" | \"info\" | \"log\" | \"trace\" | \"warn\";\n/**\n * Controls how client bundle source maps are generated.\n */\nexport type AppRouterClientSourceMapMode = \"none\" | \"hidden\" | \"linked\";\n/**\n * Configures client source map output with a boolean shortcut or explicit mode.\n */\nexport type AppRouterClientSourceMapOption = boolean | AppRouterClientSourceMapMode;\n\n/**\n * Configures production-only app-router build behavior.\n */\nexport interface AppRouterProductionOptions {\n dropClientConsole?: boolean | readonly AppRouterClientConsoleMethod[] | undefined;\n}\n\nexport interface AppRouterProjectOptions {\n assetBaseUrl?: string | undefined;\n buildConcurrency?: number | undefined;\n buildTargets?: readonly AppRouterBuildTarget[] | undefined;\n clientSourceMaps?: AppRouterClientSourceMapOption | undefined;\n /**\n * Legacy route root. When provided without routesDir/projectRoot, this keeps\n * the historical \"appDir is the whole app boundary\" behavior.\n *\n * @deprecated Use projectRoot + routesDir instead. The legacy appDir shortcut\n * is kept for direct tests and older programmatic callers and is planned for\n * removal after 0.1.0.\n */\n appDir?: string | undefined;\n allowedSourceDirs?: readonly string[] | undefined;\n projectRoot?: string | undefined;\n production?: AppRouterProductionOptions | undefined;\n publicDir?: string | undefined;\n publicAssetBaseUrl?: string | undefined;\n routesDir?: string | undefined;\n}\n\nexport interface ResolvedAppRouterProject {\n allowedSourceDirs: readonly string[];\n assetBaseUrl?: string | undefined;\n buildConcurrency?: number | undefined;\n buildTargets: readonly AppRouterBuildTarget[];\n clientSourceMaps: AppRouterClientSourceMapMode;\n clientConsolePureFunctions?: readonly string[] | undefined;\n projectRoot: string;\n publicAssetBaseUrl?: string | undefined;\n publicDir: string;\n routesDir: string;\n}\n\nexport function resolveAppRouterProjectOptions(\n options: AppRouterProjectOptions,\n): ResolvedAppRouterProject {\n const clientConsolePureFunctions = resolveClientConsolePureFunctions(\n options.production?.dropClientConsole,\n );\n\n if (\n options.appDir !== undefined &&\n options.projectRoot === undefined &&\n options.routesDir === undefined\n ) {\n const appDir = resolve(options.appDir);\n\n return {\n allowedSourceDirs: (options.allowedSourceDirs ?? [appDir]).map((directory) =>\n resolveProjectPath(appDir, directory, \"allowedSourceDirs\"),\n ),\n ...(options.assetBaseUrl === undefined ? {} : { assetBaseUrl: options.assetBaseUrl }),\n ...(options.buildConcurrency === undefined\n ? {}\n : { buildConcurrency: options.buildConcurrency }),\n buildTargets: resolveBuildTargets(options.buildTargets),\n clientSourceMaps: resolveClientSourceMapMode(options.clientSourceMaps),\n ...(clientConsolePureFunctions === undefined ? {} : { clientConsolePureFunctions }),\n projectRoot: appDir,\n ...(options.publicAssetBaseUrl === undefined\n ? {}\n : { publicAssetBaseUrl: options.publicAssetBaseUrl }),\n publicDir: resolveProjectPath(appDir, options.publicDir ?? \"public\", \"publicDir\"),\n routesDir: appDir,\n };\n }\n\n const projectRoot = resolve(options.projectRoot ?? process.cwd());\n const routesDir = resolveProjectPath(projectRoot, options.routesDir ?? \"src/app\", \"routesDir\");\n const defaultAllowedSourceDirs =\n options.routesDir === undefined ? [\"src\"] : [defaultAllowedSourceDir(projectRoot, routesDir)];\n\n return {\n allowedSourceDirs: (options.allowedSourceDirs ?? defaultAllowedSourceDirs).map((directory) =>\n resolveProjectPath(projectRoot, directory, \"allowedSourceDirs\"),\n ),\n ...(options.assetBaseUrl === undefined ? {} : { assetBaseUrl: options.assetBaseUrl }),\n ...(options.buildConcurrency === undefined\n ? {}\n : { buildConcurrency: options.buildConcurrency }),\n buildTargets: resolveBuildTargets(options.buildTargets),\n clientSourceMaps: resolveClientSourceMapMode(options.clientSourceMaps),\n ...(clientConsolePureFunctions === undefined ? {} : { clientConsolePureFunctions }),\n projectRoot,\n ...(options.publicAssetBaseUrl === undefined\n ? {}\n : { publicAssetBaseUrl: options.publicAssetBaseUrl }),\n publicDir: resolveProjectPath(projectRoot, options.publicDir ?? \"public\", \"publicDir\"),\n routesDir,\n };\n}\n\nfunction defaultAllowedSourceDir(projectRoot: string, routesDir: string): string {\n const sourceRoot = dirname(routesDir);\n return basename(routesDir) === \"app\" && sourceRoot !== projectRoot ? sourceRoot : routesDir;\n}\n\nconst defaultDroppedClientConsoleMethods = [\"debug\", \"info\", \"log\"] as const;\nconst supportedClientConsoleMethods = new Set<AppRouterClientConsoleMethod>([\n \"debug\",\n \"error\",\n \"info\",\n \"log\",\n \"trace\",\n \"warn\",\n]);\n\nexport function resolveClientConsolePureFunctions(\n value: AppRouterProductionOptions[\"dropClientConsole\"],\n): readonly string[] | undefined {\n if (value === undefined || value === false) {\n return undefined;\n }\n\n const methods = value === true ? defaultDroppedClientConsoleMethods : value;\n const uniqueMethods = [...new Set(methods)];\n\n for (const method of uniqueMethods) {\n if (!supportedClientConsoleMethods.has(method)) {\n throw new Error(\n `Unsupported mreactRouter production.dropClientConsole method ${JSON.stringify(method)}. Expected \"debug\", \"error\", \"info\", \"log\", \"trace\", or \"warn\".`,\n );\n }\n }\n\n return uniqueMethods.length === 0\n ? undefined\n : uniqueMethods.map((method) => `console.${method}`);\n}\n\nexport function resolveClientSourceMapMode(\n value: AppRouterClientSourceMapOption | undefined,\n): AppRouterClientSourceMapMode {\n if (value === undefined || value === false || value === \"none\") {\n return \"none\";\n }\n\n if (value === true || value === \"linked\") {\n return \"linked\";\n }\n\n if (value === \"hidden\") {\n return \"hidden\";\n }\n\n throw new Error(\n `Unsupported mreactRouter clientSourceMaps value ${JSON.stringify(value)}. Expected false, true, \"none\", \"hidden\", or \"linked\".`,\n );\n}\n\nexport function resolveBuildTargets(\n targets: readonly AppRouterBuildTarget[] | undefined,\n): readonly AppRouterBuildTarget[] {\n if (targets === undefined) {\n return [\"node\"];\n }\n\n const uniqueTargets = [...new Set(targets)];\n\n if (uniqueTargets.length === 0) {\n throw new Error(\"mreactRouter buildTargets must include at least one target.\");\n }\n\n for (const target of uniqueTargets) {\n if (target !== \"node\" && target !== \"cloudflare\" && target !== \"aws-lambda\") {\n throw new Error(\n `Unsupported mreactRouter build target ${JSON.stringify(target)}. Expected \"node\", \"cloudflare\", or \"aws-lambda\".`,\n );\n }\n }\n\n return uniqueTargets;\n}\n\nfunction resolveProjectPath(root: string, path: string, optionName: string): string {\n const resolvedPath = resolvePath(root, path);\n\n if (!isInsideDirectory(root, resolvedPath)) {\n throw new Error(\n `mreactRouter ${optionName} must resolve inside projectRoot. projectRoot: ${root}; ${optionName}: ${resolvedPath}`,\n );\n }\n\n return resolvedPath;\n}\n\nfunction resolvePath(root: string, path: string): string {\n return isAbsolute(path) ? resolve(path) : resolve(root, path);\n}\n\nfunction isInsideDirectory(root: string, path: string): boolean {\n const relativePath = relative(root, path);\n\n return relativePath === \"\" || (!relativePath.startsWith(\"..\") && !isAbsolute(relativePath));\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-runner.d.ts","sourceRoot":"","sources":["../src/module-runner.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAEjF,OAAO,EAKL,KAAK,YAAY,EAEjB,KAAK,UAAU,EAChB,MAAM,MAAM,CAAC;AAEd,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAKL,KAAK,sBAAsB,EAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAKL,KAAK,yBAAyB,EAC/B,MAAM,6BAA6B,CAAC;AA0BrC,wBAAgB,mCAAmC,IAAI,sBAAsB,EAAE,CAe9E;AAED,wBAAsB,2BAA2B,CAAC,CAAC,EAAE,OAAO,EAAE;IAC5D,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;IAC1C,8BAA8B,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,kBAAkB,EAAE,GAAG,SAAS,CAAC;IACpD,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,qBAAqB,CAAC,EAAE,4BAA4B,GAAG,SAAS,CAAC;IACjE,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;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S,CAAC;IAC/D,uBAAuB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,kBAAkB,EAAE,GAAG,SAAS,CAAC;IACpD,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,qBAAqB,CAAC,EAAE,4BAA4B,GAAG,SAAS,CAAC;IACjE,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,WAAW,CAAC,EAAE,SAAS,YAAY,EAAE,GAAG,SAAS,CAAC;CACnD,GAAG,OAAO,CAAC,MAAM,CAAC,CAyBlB;AAED,wBAAgB,uBAAuB,IAAI,kBAAkB,CAwB5D;AAED,UAAU,4BAA4B;IACpC,yBAAyB,CAAC,EAAE,yBAAyB,GAAG,SAAS,CAAC;IAClE,MAAM,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;IAC1C,GAAG,EAAE,OAAO,CAAC;IACb,aAAa,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,yBAAyB,CAAC,GAAG,SAAS,CAAC;IAC3E,YAAY,EAAE,gBAAgB,CAAC;IAC/B,WAAW,CAAC,EAAE,SAAS,YAAY,EAAE,GAAG,SAAS,CAAC;CACnD"}
|
package/dist/module-runner.js
CHANGED
|
@@ -174,6 +174,7 @@ const compatVendorSpecifierEntries = new Map([
|
|
|
174
174
|
["@reckona/mreact-compat/jsx-dev-runtime", "jsx-dev-runtime"],
|
|
175
175
|
["@reckona/mreact-compat/jsx-runtime", "jsx-runtime"],
|
|
176
176
|
["@reckona/mreact-compat/scheduler", "scheduler"],
|
|
177
|
+
["@reckona/mreact-compat/server", "server"],
|
|
177
178
|
]);
|
|
178
179
|
const compatVendorEntrySpecifiers = new Map([
|
|
179
180
|
["index", "@reckona/mreact-compat"],
|
|
@@ -184,6 +185,7 @@ const compatVendorEntrySpecifiers = new Map([
|
|
|
184
185
|
["event-priority", "@reckona/mreact-compat/event-priority"],
|
|
185
186
|
["flight", "@reckona/mreact-compat/flight"],
|
|
186
187
|
["internal", "@reckona/mreact-compat/internal"],
|
|
188
|
+
["server", "@reckona/mreact-compat/server"],
|
|
187
189
|
]);
|
|
188
190
|
export function compatVendorEntryNames() {
|
|
189
191
|
return [...compatVendorEntrySpecifiers.keys()];
|
|
@@ -363,7 +365,132 @@ function withFileImportMetaUrl(source, filename) {
|
|
|
363
365
|
if (!source.includes("import.meta.url")) {
|
|
364
366
|
return source;
|
|
365
367
|
}
|
|
366
|
-
return source
|
|
368
|
+
return replaceImportMetaUrlExpressions(source, JSON.stringify(pathToFileURL(filename).href));
|
|
369
|
+
}
|
|
370
|
+
function replaceImportMetaUrlExpressions(source, replacement) {
|
|
371
|
+
return replaceImportMetaUrlInCode(source, 0, source.length, replacement, false).text;
|
|
372
|
+
}
|
|
373
|
+
function replaceImportMetaUrlInCode(source, start, end, replacement, stopAtTemplateExpressionEnd) {
|
|
374
|
+
let output = "";
|
|
375
|
+
let copyStart = start;
|
|
376
|
+
let index = start;
|
|
377
|
+
let braceDepth = 0;
|
|
378
|
+
while (index < end) {
|
|
379
|
+
const char = source[index];
|
|
380
|
+
if (stopAtTemplateExpressionEnd && char === "}") {
|
|
381
|
+
if (braceDepth === 0) {
|
|
382
|
+
break;
|
|
383
|
+
}
|
|
384
|
+
braceDepth -= 1;
|
|
385
|
+
index += 1;
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
if (isImportMetaUrlToken(source, index)) {
|
|
389
|
+
output += source.slice(copyStart, index);
|
|
390
|
+
output += replacement;
|
|
391
|
+
index += "import.meta.url".length;
|
|
392
|
+
copyStart = index;
|
|
393
|
+
continue;
|
|
394
|
+
}
|
|
395
|
+
if (char === '"' || char === "'") {
|
|
396
|
+
index = skipQuotedString(source, index, char);
|
|
397
|
+
continue;
|
|
398
|
+
}
|
|
399
|
+
if (char === "`") {
|
|
400
|
+
const template = replaceImportMetaUrlInTemplate(source, index, replacement);
|
|
401
|
+
output += source.slice(copyStart, index);
|
|
402
|
+
output += template.text;
|
|
403
|
+
index = template.next;
|
|
404
|
+
copyStart = index;
|
|
405
|
+
continue;
|
|
406
|
+
}
|
|
407
|
+
if (char === "/" && source[index + 1] === "/") {
|
|
408
|
+
index = skipLineComment(source, index + 2);
|
|
409
|
+
continue;
|
|
410
|
+
}
|
|
411
|
+
if (char === "/" && source[index + 1] === "*") {
|
|
412
|
+
index = skipBlockComment(source, index + 2);
|
|
413
|
+
continue;
|
|
414
|
+
}
|
|
415
|
+
if (stopAtTemplateExpressionEnd && char === "{") {
|
|
416
|
+
braceDepth += 1;
|
|
417
|
+
}
|
|
418
|
+
index += 1;
|
|
419
|
+
}
|
|
420
|
+
return {
|
|
421
|
+
next: index,
|
|
422
|
+
text: output + source.slice(copyStart, index),
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
function replaceImportMetaUrlInTemplate(source, start, replacement) {
|
|
426
|
+
let output = "`";
|
|
427
|
+
let copyStart = start + 1;
|
|
428
|
+
let index = start + 1;
|
|
429
|
+
while (index < source.length) {
|
|
430
|
+
const char = source[index];
|
|
431
|
+
if (char === "\\") {
|
|
432
|
+
index += 2;
|
|
433
|
+
continue;
|
|
434
|
+
}
|
|
435
|
+
if (char === "`") {
|
|
436
|
+
return {
|
|
437
|
+
next: index + 1,
|
|
438
|
+
text: output + source.slice(copyStart, index + 1),
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
if (char === "$" && source[index + 1] === "{") {
|
|
442
|
+
output += source.slice(copyStart, index + 2);
|
|
443
|
+
const expression = replaceImportMetaUrlInCode(source, index + 2, source.length, replacement, true);
|
|
444
|
+
output += expression.text;
|
|
445
|
+
index = expression.next;
|
|
446
|
+
if (source[index] === "}") {
|
|
447
|
+
output += "}";
|
|
448
|
+
index += 1;
|
|
449
|
+
}
|
|
450
|
+
copyStart = index;
|
|
451
|
+
continue;
|
|
452
|
+
}
|
|
453
|
+
index += 1;
|
|
454
|
+
}
|
|
455
|
+
return {
|
|
456
|
+
next: index,
|
|
457
|
+
text: output + source.slice(copyStart, index),
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
function isImportMetaUrlToken(source, index) {
|
|
461
|
+
return (source.startsWith("import.meta.url", index) &&
|
|
462
|
+
!isIdentifierPartCode(source.charCodeAt(index - 1)) &&
|
|
463
|
+
!isIdentifierPartCode(source.charCodeAt(index + "import.meta.url".length)));
|
|
464
|
+
}
|
|
465
|
+
function isIdentifierPartCode(code) {
|
|
466
|
+
return ((code >= 48 && code <= 57) ||
|
|
467
|
+
(code >= 65 && code <= 90) ||
|
|
468
|
+
(code >= 97 && code <= 122) ||
|
|
469
|
+
code === 36 ||
|
|
470
|
+
code === 95);
|
|
471
|
+
}
|
|
472
|
+
function skipQuotedString(source, start, quote) {
|
|
473
|
+
let index = start + 1;
|
|
474
|
+
while (index < source.length) {
|
|
475
|
+
const char = source[index];
|
|
476
|
+
if (char === "\\") {
|
|
477
|
+
index += 2;
|
|
478
|
+
continue;
|
|
479
|
+
}
|
|
480
|
+
if (char === quote) {
|
|
481
|
+
return index + 1;
|
|
482
|
+
}
|
|
483
|
+
index += 1;
|
|
484
|
+
}
|
|
485
|
+
return index;
|
|
486
|
+
}
|
|
487
|
+
function skipLineComment(source, start) {
|
|
488
|
+
const end = source.indexOf("\n", start);
|
|
489
|
+
return end === -1 ? source.length : end + 1;
|
|
490
|
+
}
|
|
491
|
+
function skipBlockComment(source, start) {
|
|
492
|
+
const end = source.indexOf("*/", start);
|
|
493
|
+
return end === -1 ? source.length : end + 2;
|
|
367
494
|
}
|
|
368
495
|
function withNodeRequireShimForEsmBundle(options) {
|
|
369
496
|
const requireBaseUrl = pathToFileURL(join(options.requireBaseDir ?? process.cwd(), "__mreact_require_shim.cjs")).href;
|
|
@@ -827,6 +954,10 @@ function workspacePackageResolutionPlugin() {
|
|
|
827
954
|
"@reckona/mreact-compat/scheduler",
|
|
828
955
|
{ entry: "scheduler", monorepoDir: "react-compat", packageName: "@reckona/mreact-compat" },
|
|
829
956
|
],
|
|
957
|
+
[
|
|
958
|
+
"@reckona/mreact-compat/server",
|
|
959
|
+
{ entry: "server", monorepoDir: "react-compat", packageName: "@reckona/mreact-compat" },
|
|
960
|
+
],
|
|
830
961
|
[
|
|
831
962
|
"@reckona/mreact-reactive-core",
|
|
832
963
|
{
|