@reckona/mreact-router 0.0.83 → 0.0.84
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/route-source.d.ts.map +1 -1
- package/dist/route-source.js +7 -5
- package/dist/route-source.js.map +1 -1
- package/package.json +11 -11
- package/src/route-source.ts +9 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-source.d.ts","sourceRoot":"","sources":["../src/route-source.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"route-source.d.ts","sourceRoot":"","sources":["../src/route-source.ts"],"names":[],"mappings":"AAuCA,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK5D;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAShE;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B,GAAG,MAAM,CAKT;AAED,wBAAgB,qCAAqC,CAAC,KAAK,EAAE;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B,GAAG,MAAM,CAST;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQjE;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQhE;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQlE;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK5D;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE/D;AAED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE;IACvD,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CA0DV;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnE;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAErD"}
|
package/dist/route-source.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { dirname, isAbsolute, join } from "node:path";
|
|
2
|
-
import { collectFormActionExpressionReferences, collectTopLevelValueExportNames, collectJsxComponentRootNames, collectStaticImportReferences, demoteTopLevelExportDeclarations, hasModuleDirective, hasTopLevelExportDeclaration, stripTopLevelExportDeclarations, } from "@reckona/mreact-compiler";
|
|
2
|
+
import { collectFormActionExpressionReferences, collectTopLevelValueExportNames, collectJsxComponentRootNames, collectStaticImportReferences, demoteTopLevelExportDeclarations, hasModuleDirective, hasTopLevelExportDeclaration, stripTopLevelExportDeclarations, stripUnusedStaticValueImports, } from "@reckona/mreact-compiler";
|
|
3
3
|
import { sourceModuleCandidates } from "./source-modules.js";
|
|
4
4
|
const routeModuleExportNames = [
|
|
5
5
|
"auth",
|
|
@@ -31,10 +31,12 @@ export function stripRouteModuleExports(code) {
|
|
|
31
31
|
}));
|
|
32
32
|
}
|
|
33
33
|
export function stripRouteClientOnlyExports(code) {
|
|
34
|
-
return
|
|
35
|
-
code
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
return stripUnusedStaticValueImports({
|
|
35
|
+
code: demoteRouteHelperExports(stripTopLevelExportDeclarations({
|
|
36
|
+
code,
|
|
37
|
+
names: routeClientOnlyExportNames,
|
|
38
|
+
})),
|
|
39
|
+
});
|
|
38
40
|
}
|
|
39
41
|
export function stripRouteClientSource(input) {
|
|
40
42
|
return stripRouteClientFormActionExpressions({
|
package/dist/route-source.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-source.js","sourceRoot":"","sources":["../src/route-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EACL,qCAAqC,EACrC,+BAA+B,EAC/B,4BAA4B,EAC5B,6BAA6B,EAC7B,gCAAgC,EAChC,kBAAkB,EAClB,4BAA4B,EAC5B,+BAA+B,GAChC,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,sBAAsB,GAAG;IAC7B,MAAM;IACN,sBAAsB;IACtB,QAAQ;IACR,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,QAAQ;CACA,CAAC;AACX,MAAM,0BAA0B,GAAG;IACjC,GAAG,sBAAsB;IACzB,kBAAkB;IAClB,UAAU;CACF,CAAC;AACX,MAAM,6BAA6B,GAAG,CAAC,SAAS,EAAE,OAAO,CAAU,CAAC;AACpE,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAS,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;AACrE,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAS;IAC9C,GAAG,0BAA0B;IAC7B,kBAAkB;IAClB,UAAU;CACX,CAAC,CAAC;AACH,MAAM,0BAA0B,GAAG,IAAI,GAAG,CAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC/D,MAAM,4BAA4B,GAAG,IAAI,GAAG,CAAS,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC,CAAC;AA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AAC,CAAC;AACpF,CAAC;AAED,SAAS,wBAAwB,CAC/B,KAA6B,EAC7B,QAAgB,EAChB,SAAiB;IAEjB,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;IAEhD,KAAK,MAAM,SAAS,IAAI,sBAAsB,CAAC,IAAI,CAAC,EAAE,CAAC;QACrD,IAAI,KAAK,CAAC,SAAS,CAAC,KAAK,SAAS,EAAE,CAAC;YACnC,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,yBAAyB,CAAC,WAAmB,EAAE,QAAgB;IACtE,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;AACvE,CAAC","sourcesContent":["import { dirname, isAbsolute, join } from \"node:path\";\nimport {\n collectFormActionExpressionReferences,\n collectTopLevelValueExportNames,\n collectJsxComponentRootNames,\n collectStaticImportReferences,\n demoteTopLevelExportDeclarations,\n hasModuleDirective,\n hasTopLevelExportDeclaration,\n stripTopLevelExportDeclarations,\n} from \"@reckona/mreact-compiler\";\nimport type { StaticImportReference } from \"@reckona/mreact-compiler\";\nimport { sourceModuleCandidates } from \"./source-modules.js\";\n\nconst routeModuleExportNames = [\n \"auth\",\n \"generateStaticParams\",\n \"loader\",\n \"middleware\",\n \"prerender\",\n \"revalidate\",\n \"stream\",\n] as const;\nconst routeClientOnlyExportNames = [\n ...routeModuleExportNames,\n \"generateMetadata\",\n \"metadata\",\n] as const;\nconst routeRequestRenderExportNames = [\"default\", \"slots\"] as const;\nconst routeRenderExportNames = new Set<string>([\"default\", \"slots\"]);\nconst routeRequestExportNames = new Set<string>([\n ...routeClientOnlyExportNames,\n \"generateMetadata\",\n \"metadata\",\n]);\nconst routeLoaderOnlyExportNames = new Set<string>([\"loader\"]);\nconst routeMetadataOnlyExportNames = new Set<string>([\"generateMetadata\", \"metadata\"]);\n\nexport function stripRouteModuleExports(code: string): string {\n return demoteRouteHelperExports(stripTopLevelExportDeclarations({\n code,\n names: routeModuleExportNames,\n }));\n}\n\nexport function stripRouteClientOnlyExports(code: string): string {\n return demoteRouteHelperExports(stripTopLevelExportDeclarations({\n code,\n names: routeClientOnlyExportNames,\n }));\n}\n\nexport function stripRouteClientSource(input: {\n code: string;\n filename?: string | undefined;\n}): string {\n return stripRouteClientFormActionExpressions({\n code: stripRouteClientOnlyExports(input.code),\n filename: input.filename,\n });\n}\n\nexport function stripRouteClientFormActionExpressions(input: {\n code: string;\n filename?: string | undefined;\n}): string {\n const references = collectFormActionExpressionReferences(input);\n let code = input.code;\n\n for (const reference of [...references].reverse()) {\n code = `${code.slice(0, reference.expressionStart)}undefined${code.slice(reference.expressionEnd)}`;\n }\n\n return code;\n}\n\nexport function stripRouteBuildExports(code: string): string {\n return stripRouteClientOnlyExports(code);\n}\n\nexport function stripRouteRequestOnlyExports(code: string): string {\n return demoteRouteHelperExports(\n stripTopLevelExportDeclarations({\n code,\n names: routeRequestRenderExportNames,\n }),\n routeRequestExportNames,\n );\n}\n\nexport function stripRouteLoaderOnlyExports(code: string): string {\n return demoteRouteHelperExports(\n stripTopLevelExportDeclarations({\n code,\n names: [\"auth\", \"default\", \"generateMetadata\", \"generateStaticParams\", \"metadata\", \"middleware\", \"prerender\", \"revalidate\", \"slots\", \"stream\"],\n }),\n routeLoaderOnlyExportNames,\n );\n}\n\nexport function stripRouteMetadataOnlyExports(code: string): string {\n return demoteRouteHelperExports(\n stripTopLevelExportDeclarations({\n code,\n names: [\"auth\", \"default\", \"generateStaticParams\", \"loader\", \"middleware\", \"prerender\", \"revalidate\", \"slots\", \"stream\"],\n }),\n routeMetadataOnlyExportNames,\n );\n}\n\nexport function stripRouteConfigExports(code: string): string {\n return stripTopLevelExportDeclarations({\n code,\n names: [\"auth\", \"prerender\", \"revalidate\", \"stream\"],\n });\n}\n\nexport function isStreamRouteSource(code: string): boolean {\n return hasTopLevelExportDeclaration({ code, names: [\"stream\"] });\n}\n\nexport function mayUseAwaitBoundarySource(code: string): boolean {\n return collectJsxComponentRootNames({ code }).includes(\"Await\");\n}\n\nexport function routeClosureMayUseAwaitBoundary(options: {\n filename: string;\n files: Record<string, string>;\n projectRoot: string;\n seen?: Set<string> | undefined;\n source: string;\n}): boolean {\n const seen = options.seen ?? new Set<string>();\n if (\n seen.has(options.filename) ||\n hasModuleDirective({ code: options.source, directive: \"use client\" })\n ) {\n return false;\n }\n\n seen.add(options.filename);\n\n try {\n if (mayUseAwaitBoundarySource(options.source)) {\n return true;\n }\n\n const sourceFilename = sourceFilenameForCompiler(options.projectRoot, options.filename);\n const jsxComponentRoots = new Set(\n collectJsxComponentRootNames({\n code: options.source,\n filename: sourceFilename,\n }),\n );\n\n for (const reference of collectStaticImportReferences({\n code: options.source,\n filename: sourceFilename,\n })) {\n if (!isRenderedStaticImportReference(reference, jsxComponentRoots)) {\n continue;\n }\n\n const resolved = resolveLocalSourceImport(options.files, options.filename, reference.source);\n\n if (resolved === undefined) {\n continue;\n }\n\n const importedSource = options.files[resolved];\n\n if (\n importedSource !== undefined &&\n routeClosureMayUseAwaitBoundary({\n filename: resolved,\n files: options.files,\n projectRoot: options.projectRoot,\n seen,\n source: importedSource,\n })\n ) {\n return true;\n }\n }\n\n return false;\n } finally {\n seen.delete(options.filename);\n }\n}\n\nexport function hasPrerenderExport(code: string): boolean {\n return hasTopLevelExportDeclaration({ code, names: [\"prerender\"] });\n}\n\nexport function hasGenerateStaticParamsExport(code: string): boolean {\n return hasTopLevelExportDeclaration({ code, names: [\"generateStaticParams\"] });\n}\n\nexport function hasLoaderExport(code: string): boolean {\n return hasTopLevelExportDeclaration({ code, names: [\"loader\"] });\n}\n\nfunction demoteRouteHelperExports(\n code: string,\n preservedExportNames: ReadonlySet<string> = routeRenderExportNames,\n): string {\n const helperNames = collectTopLevelValueExportNames({ code })\n .filter((name) => !preservedExportNames.has(name) && startsLowercase(name));\n\n return helperNames.length === 0\n ? code\n : demoteTopLevelExportDeclarations({ code, names: helperNames });\n}\n\nfunction startsLowercase(value: string): boolean {\n return /^[a-z]/.test(value);\n}\n\nfunction isRenderedStaticImportReference(\n reference: StaticImportReference,\n jsxComponentRoots: ReadonlySet<string>,\n): boolean {\n return reference.localNames.some((localName) => jsxComponentRoots.has(localName));\n}\n\nfunction resolveLocalSourceImport(\n files: Record<string, string>,\n importer: string,\n specifier: string,\n): string | undefined {\n if (!specifier.startsWith(\".\")) {\n return undefined;\n }\n\n const base = join(dirname(importer), specifier);\n\n for (const candidate of sourceModuleCandidates(base)) {\n if (files[candidate] !== undefined) {\n return candidate;\n }\n }\n\n return undefined;\n}\n\nfunction sourceFilenameForCompiler(projectRoot: string, filename: string): string {\n return isAbsolute(filename) ? filename : join(projectRoot, filename);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"route-source.js","sourceRoot":"","sources":["../src/route-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EACL,qCAAqC,EACrC,+BAA+B,EAC/B,4BAA4B,EAC5B,6BAA6B,EAC7B,gCAAgC,EAChC,kBAAkB,EAClB,4BAA4B,EAC5B,+BAA+B,EAC/B,6BAA6B,GAC9B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,sBAAsB,GAAG;IAC7B,MAAM;IACN,sBAAsB;IACtB,QAAQ;IACR,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,QAAQ;CACA,CAAC;AACX,MAAM,0BAA0B,GAAG;IACjC,GAAG,sBAAsB;IACzB,kBAAkB;IAClB,UAAU;CACF,C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C,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;IAE9E,OAAO,WAAW,CAAC,MAAM,KAAK,CAAC;QAC7B,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,gCAAgC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;AACrE,CAAC;AAED,SAAS,eAAe,CAAC,KAAa;IACpC,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,+BAA+B,CACtC,SAAgC,EAChC,iBAAsC;IAEtC,OAAO,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;AACpF,CAAC;AAED,SAAS,wBAAwB,CAC/B,KAA6B,EAC7B,QAAgB,EAChB,SAAiB;IAEjB,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;IAEhD,KAAK,MAAM,SAAS,IAAI,sBAAsB,CAAC,IAAI,CAAC,EAAE,CAAC;QACrD,IAAI,KAAK,CAAC,SAAS,CAAC,KAAK,SAAS,EAAE,CAAC;YACnC,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,yBAAyB,CAAC,WAAmB,EAAE,QAAgB;IACtE,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;AACvE,CAAC","sourcesContent":["import { dirname, isAbsolute, join } from \"node:path\";\nimport {\n collectFormActionExpressionReferences,\n collectTopLevelValueExportNames,\n collectJsxComponentRootNames,\n collectStaticImportReferences,\n demoteTopLevelExportDeclarations,\n hasModuleDirective,\n hasTopLevelExportDeclaration,\n stripTopLevelExportDeclarations,\n stripUnusedStaticValueImports,\n} from \"@reckona/mreact-compiler\";\nimport type { StaticImportReference } from \"@reckona/mreact-compiler\";\nimport { sourceModuleCandidates } from \"./source-modules.js\";\n\nconst routeModuleExportNames = [\n \"auth\",\n \"generateStaticParams\",\n \"loader\",\n \"middleware\",\n \"prerender\",\n \"revalidate\",\n \"stream\",\n] as const;\nconst routeClientOnlyExportNames = [\n ...routeModuleExportNames,\n \"generateMetadata\",\n \"metadata\",\n] as const;\nconst routeRequestRenderExportNames = [\"default\", \"slots\"] as const;\nconst routeRenderExportNames = new Set<string>([\"default\", \"slots\"]);\nconst routeRequestExportNames = new Set<string>([\n ...routeClientOnlyExportNames,\n \"generateMetadata\",\n \"metadata\",\n]);\nconst routeLoaderOnlyExportNames = new Set<string>([\"loader\"]);\nconst routeMetadataOnlyExportNames = new Set<string>([\"generateMetadata\", \"metadata\"]);\n\nexport function stripRouteModuleExports(code: string): string {\n return demoteRouteHelperExports(stripTopLevelExportDeclarations({\n code,\n names: routeModuleExportNames,\n }));\n}\n\nexport function stripRouteClientOnlyExports(code: string): string {\n return stripUnusedStaticValueImports({\n code: demoteRouteHelperExports(\n stripTopLevelExportDeclarations({\n code,\n names: routeClientOnlyExportNames,\n }),\n ),\n });\n}\n\nexport function stripRouteClientSource(input: {\n code: string;\n filename?: string | undefined;\n}): string {\n return stripRouteClientFormActionExpressions({\n code: stripRouteClientOnlyExports(input.code),\n filename: input.filename,\n });\n}\n\nexport function stripRouteClientFormActionExpressions(input: {\n code: string;\n filename?: string | undefined;\n}): string {\n const references = collectFormActionExpressionReferences(input);\n let code = input.code;\n\n for (const reference of [...references].reverse()) {\n code = `${code.slice(0, reference.expressionStart)}undefined${code.slice(reference.expressionEnd)}`;\n }\n\n return code;\n}\n\nexport function stripRouteBuildExports(code: string): string {\n return stripRouteClientOnlyExports(code);\n}\n\nexport function stripRouteRequestOnlyExports(code: string): string {\n return demoteRouteHelperExports(\n stripTopLevelExportDeclarations({\n code,\n names: routeRequestRenderExportNames,\n }),\n routeRequestExportNames,\n );\n}\n\nexport function stripRouteLoaderOnlyExports(code: string): string {\n return demoteRouteHelperExports(\n stripTopLevelExportDeclarations({\n code,\n names: [\"auth\", \"default\", \"generateMetadata\", \"generateStaticParams\", \"metadata\", \"middleware\", \"prerender\", \"revalidate\", \"slots\", \"stream\"],\n }),\n routeLoaderOnlyExportNames,\n );\n}\n\nexport function stripRouteMetadataOnlyExports(code: string): string {\n return demoteRouteHelperExports(\n stripTopLevelExportDeclarations({\n code,\n names: [\"auth\", \"default\", \"generateStaticParams\", \"loader\", \"middleware\", \"prerender\", \"revalidate\", \"slots\", \"stream\"],\n }),\n routeMetadataOnlyExportNames,\n );\n}\n\nexport function stripRouteConfigExports(code: string): string {\n return stripTopLevelExportDeclarations({\n code,\n names: [\"auth\", \"prerender\", \"revalidate\", \"stream\"],\n });\n}\n\nexport function isStreamRouteSource(code: string): boolean {\n return hasTopLevelExportDeclaration({ code, names: [\"stream\"] });\n}\n\nexport function mayUseAwaitBoundarySource(code: string): boolean {\n return collectJsxComponentRootNames({ code }).includes(\"Await\");\n}\n\nexport function routeClosureMayUseAwaitBoundary(options: {\n filename: string;\n files: Record<string, string>;\n projectRoot: string;\n seen?: Set<string> | undefined;\n source: string;\n}): boolean {\n const seen = options.seen ?? new Set<string>();\n if (\n seen.has(options.filename) ||\n hasModuleDirective({ code: options.source, directive: \"use client\" })\n ) {\n return false;\n }\n\n seen.add(options.filename);\n\n try {\n if (mayUseAwaitBoundarySource(options.source)) {\n return true;\n }\n\n const sourceFilename = sourceFilenameForCompiler(options.projectRoot, options.filename);\n const jsxComponentRoots = new Set(\n collectJsxComponentRootNames({\n code: options.source,\n filename: sourceFilename,\n }),\n );\n\n for (const reference of collectStaticImportReferences({\n code: options.source,\n filename: sourceFilename,\n })) {\n if (!isRenderedStaticImportReference(reference, jsxComponentRoots)) {\n continue;\n }\n\n const resolved = resolveLocalSourceImport(options.files, options.filename, reference.source);\n\n if (resolved === undefined) {\n continue;\n }\n\n const importedSource = options.files[resolved];\n\n if (\n importedSource !== undefined &&\n routeClosureMayUseAwaitBoundary({\n filename: resolved,\n files: options.files,\n projectRoot: options.projectRoot,\n seen,\n source: importedSource,\n })\n ) {\n return true;\n }\n }\n\n return false;\n } finally {\n seen.delete(options.filename);\n }\n}\n\nexport function hasPrerenderExport(code: string): boolean {\n return hasTopLevelExportDeclaration({ code, names: [\"prerender\"] });\n}\n\nexport function hasGenerateStaticParamsExport(code: string): boolean {\n return hasTopLevelExportDeclaration({ code, names: [\"generateStaticParams\"] });\n}\n\nexport function hasLoaderExport(code: string): boolean {\n return hasTopLevelExportDeclaration({ code, names: [\"loader\"] });\n}\n\nfunction demoteRouteHelperExports(\n code: string,\n preservedExportNames: ReadonlySet<string> = routeRenderExportNames,\n): string {\n const helperNames = collectTopLevelValueExportNames({ code })\n .filter((name) => !preservedExportNames.has(name) && startsLowercase(name));\n\n return helperNames.length === 0\n ? code\n : demoteTopLevelExportDeclarations({ code, names: helperNames });\n}\n\nfunction startsLowercase(value: string): boolean {\n return /^[a-z]/.test(value);\n}\n\nfunction isRenderedStaticImportReference(\n reference: StaticImportReference,\n jsxComponentRoots: ReadonlySet<string>,\n): boolean {\n return reference.localNames.some((localName) => jsxComponentRoots.has(localName));\n}\n\nfunction resolveLocalSourceImport(\n files: Record<string, string>,\n importer: string,\n specifier: string,\n): string | undefined {\n if (!specifier.startsWith(\".\")) {\n return undefined;\n }\n\n const base = join(dirname(importer), specifier);\n\n for (const candidate of sourceModuleCandidates(base)) {\n if (files[candidate] !== undefined) {\n return candidate;\n }\n }\n\n return undefined;\n}\n\nfunction sourceFilenameForCompiler(projectRoot: string, filename: string): string {\n return isAbsolute(filename) ? filename : join(projectRoot, filename);\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.84",
|
|
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
|
|
110
|
-
"@reckona/mreact-
|
|
111
|
-
"@reckona/mreact-
|
|
112
|
-
"@reckona/mreact-
|
|
113
|
-
"@reckona/mreact-
|
|
114
|
-
"@reckona/mreact-
|
|
115
|
-
"@reckona/mreact-shared": "0.0.
|
|
116
|
-
"@reckona/mreact-
|
|
108
|
+
"@reckona/mreact-compat": "0.0.84",
|
|
109
|
+
"@reckona/mreact": "0.0.84",
|
|
110
|
+
"@reckona/mreact-devtools": "0.0.84",
|
|
111
|
+
"@reckona/mreact-query": "0.0.84",
|
|
112
|
+
"@reckona/mreact-reactive-core": "0.0.84",
|
|
113
|
+
"@reckona/mreact-compiler": "0.0.84",
|
|
114
|
+
"@reckona/mreact-reactive-dom": "0.0.84",
|
|
115
|
+
"@reckona/mreact-shared": "0.0.84",
|
|
116
|
+
"@reckona/mreact-server": "0.0.84"
|
|
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.84"
|
|
123
123
|
}
|
|
124
124
|
}
|
package/src/route-source.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
hasModuleDirective,
|
|
9
9
|
hasTopLevelExportDeclaration,
|
|
10
10
|
stripTopLevelExportDeclarations,
|
|
11
|
+
stripUnusedStaticValueImports,
|
|
11
12
|
} from "@reckona/mreact-compiler";
|
|
12
13
|
import type { StaticImportReference } from "@reckona/mreact-compiler";
|
|
13
14
|
import { sourceModuleCandidates } from "./source-modules.js";
|
|
@@ -44,10 +45,14 @@ export function stripRouteModuleExports(code: string): string {
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
export function stripRouteClientOnlyExports(code: string): string {
|
|
47
|
-
return
|
|
48
|
-
code
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
return stripUnusedStaticValueImports({
|
|
49
|
+
code: demoteRouteHelperExports(
|
|
50
|
+
stripTopLevelExportDeclarations({
|
|
51
|
+
code,
|
|
52
|
+
names: routeClientOnlyExportNames,
|
|
53
|
+
}),
|
|
54
|
+
),
|
|
55
|
+
});
|
|
51
56
|
}
|
|
52
57
|
|
|
53
58
|
export function stripRouteClientSource(input: {
|