@analogjs/platform 3.0.0-alpha.2 → 3.0.0-alpha.20
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/package.json +13 -17
- package/src/index.d.ts +5 -2
- package/src/index.js +9 -3
- package/src/index.js.map +1 -0
- package/src/lib/clear-client-page-endpoint.d.ts +2 -2
- package/src/lib/clear-client-page-endpoint.js +22 -32
- package/src/lib/clear-client-page-endpoint.js.map +1 -0
- package/src/lib/content/marked/index.d.ts +5 -5
- package/src/lib/content/marked/index.js +10 -6
- package/src/lib/content/marked/index.js.map +1 -0
- package/src/lib/content/marked/marked-content-highlighter.d.ts +2 -4
- package/src/lib/content/marked/marked-content-highlighter.js +6 -3
- package/src/lib/content/marked/marked-content-highlighter.js.map +1 -0
- package/src/lib/content/marked/marked-setup.service.d.ts +8 -8
- package/src/lib/content/marked/marked-setup.service.js +44 -54
- package/src/lib/content/marked/marked-setup.service.js.map +1 -0
- package/src/lib/content/prism/angular.d.ts +1 -0
- package/src/lib/content/prism/angular.js +18 -19
- package/src/lib/content/prism/angular.js.map +1 -0
- package/src/lib/content/prism/index.d.ts +1 -1
- package/src/lib/content/prism/index.js +10 -7
- package/src/lib/content/prism/index.js.map +1 -0
- package/src/lib/content/prism/options.d.ts +1 -1
- package/src/lib/content/prism/prism-highlighter.d.ts +5 -5
- package/src/lib/content/prism/prism-highlighter.js +33 -33
- package/src/lib/content/prism/prism-highlighter.js.map +1 -0
- package/src/lib/content/shiki/index.d.ts +3 -3
- package/src/lib/content/shiki/index.js +19 -28
- package/src/lib/content/shiki/index.js.map +1 -0
- package/src/lib/content/shiki/options.d.ts +7 -7
- package/src/lib/content/shiki/shiki-highlighter.d.ts +13 -13
- package/src/lib/content/shiki/shiki-highlighter.js +45 -44
- package/src/lib/content/shiki/shiki-highlighter.js.map +1 -0
- package/src/lib/content-plugin.d.ts +19 -19
- package/src/lib/content-plugin.js +178 -196
- package/src/lib/content-plugin.js.map +1 -0
- package/src/lib/deps-plugin.d.ts +2 -2
- package/src/lib/deps-plugin.js +73 -82
- package/src/lib/deps-plugin.js.map +1 -0
- package/src/lib/json-ld-manifest-plugin.d.ts +41 -0
- package/src/lib/json-ld-manifest-plugin.js +84 -0
- package/src/lib/json-ld-manifest-plugin.js.map +1 -0
- package/src/lib/nx-plugin/builders.json +7 -0
- package/src/lib/nx-plugin/executors.json +5 -0
- package/src/lib/nx-plugin/generators.json +25 -0
- package/src/lib/nx-plugin/package.json +1 -5
- package/src/lib/nx-plugin/src/executors/vite/compat.d.ts +3 -2
- package/src/lib/nx-plugin/src/executors/vite/compat.js +6 -6
- package/src/lib/nx-plugin/src/executors/vite/compat.js.map +1 -1
- package/src/lib/nx-plugin/src/executors/vite/schema.d.ts +1 -1
- package/src/lib/nx-plugin/src/executors/vite/vite.impl.d.ts +1 -1
- package/src/lib/nx-plugin/src/executors/vite/vite.impl.js +5 -4
- package/src/lib/nx-plugin/src/executors/vite/vite.impl.js.map +1 -1
- package/src/lib/nx-plugin/src/executors/vite-dev-server/compat.d.ts +3 -2
- package/src/lib/nx-plugin/src/executors/vite-dev-server/compat.js +6 -6
- package/src/lib/nx-plugin/src/executors/vite-dev-server/compat.js.map +1 -1
- package/src/lib/nx-plugin/src/executors/vite-dev-server/schema.d.ts +1 -1
- package/src/lib/nx-plugin/src/executors/vite-dev-server/vite-dev-server.impl.d.ts +1 -1
- package/src/lib/nx-plugin/src/executors/vite-dev-server/vite-dev-server.impl.js +5 -4
- package/src/lib/nx-plugin/src/executors/vite-dev-server/vite-dev-server.impl.js.map +1 -1
- package/src/lib/nx-plugin/src/executors/vitest/compat.d.ts +3 -2
- package/src/lib/nx-plugin/src/executors/vitest/compat.js +6 -6
- package/src/lib/nx-plugin/src/executors/vitest/compat.js.map +1 -1
- package/src/lib/nx-plugin/src/executors/vitest/schema.d.ts +1 -1
- package/src/lib/nx-plugin/src/executors/vitest/vitest.impl.d.ts +1 -1
- package/src/lib/nx-plugin/src/executors/vitest/vitest.impl.js +5 -4
- package/src/lib/nx-plugin/src/executors/vitest/vitest.impl.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/compat.d.ts +9 -2
- package/src/lib/nx-plugin/src/generators/app/compat.js +17 -6
- package/src/lib/nx-plugin/src/generators/app/compat.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/files/root/tsconfig.base.json +3 -6
- package/src/lib/nx-plugin/src/generators/app/files/template-angular/src/test-setup.ts__template__ +1 -0
- package/src/lib/nx-plugin/src/generators/app/files/template-angular/tsconfig.app.json__template__ +1 -3
- package/src/lib/nx-plugin/src/generators/app/files/template-angular/tsconfig.json__template__ +2 -1
- package/src/lib/nx-plugin/src/generators/app/files/template-angular/vite.config.ts__template__ +6 -0
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v17/src/app/app.config.ts__template__ +0 -6
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v17/tsconfig.json__template__ +4 -2
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v17/vite.config.ts__template__ +0 -18
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v18/src/app/app.config.ts__template__ +0 -6
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v18/tsconfig.json__template__ +4 -2
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v18/vite.config.ts__template__ +0 -18
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v19/src/app/app.config.ts__template__ +0 -6
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v19/tsconfig.app.json__template__ +1 -3
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v19/tsconfig.json__template__ +4 -2
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v19/vite.config.ts__template__ +0 -9
- package/src/lib/nx-plugin/src/generators/app/generator.d.ts +11 -11
- package/src/lib/nx-plugin/src/generators/app/generator.js +78 -88
- package/src/lib/nx-plugin/src/generators/app/generator.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-analog-dependencies.d.ts +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-analog-project-config.d.ts +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-analog-project-config.js +72 -89
- package/src/lib/nx-plugin/src/generators/app/lib/add-analog-project-config.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-angular-app.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/app/lib/add-angular-app.js +24 -58
- package/src/lib/nx-plugin/src/generators/app/lib/add-angular-app.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-eslint.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/app/lib/add-files.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/app/lib/add-files.js +15 -16
- package/src/lib/nx-plugin/src/generators/app/lib/add-files.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-home-page.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/app/lib/add-home-page.js +14 -13
- package/src/lib/nx-plugin/src/generators/app/lib/add-home-page.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-tailwind-config.d.ts +7 -7
- package/src/lib/nx-plugin/src/generators/app/lib/add-tailwind-config.js +15 -30
- package/src/lib/nx-plugin/src/generators/app/lib/add-tailwind-config.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-tailwind-helpers.d.ts +3 -5
- package/src/lib/nx-plugin/src/generators/app/lib/add-tailwind-helpers.js +49 -147
- package/src/lib/nx-plugin/src/generators/app/lib/add-tailwind-helpers.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-vite-plugin.d.ts +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/cleanup-files.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/app/lib/cleanup-files.js +17 -20
- package/src/lib/nx-plugin/src/generators/app/lib/cleanup-files.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/initialize-analog-workspace.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/app/lib/update-index-html.d.ts +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/update-index-html.js +14 -12
- package/src/lib/nx-plugin/src/generators/app/lib/update-index-html.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/versions/minimum-supported-versions.d.ts +4 -5
- package/src/lib/nx-plugin/src/generators/app/versions/minimum-supported-versions.js +6 -10
- package/src/lib/nx-plugin/src/generators/app/versions/minimum-supported-versions.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/versions/nx-dependencies.d.ts +0 -3
- package/src/lib/nx-plugin/src/generators/app/versions/nx_17_X/versions.d.ts +0 -5
- package/src/lib/nx-plugin/src/generators/app/versions/nx_18_X/versions.d.ts +9 -16
- package/src/lib/nx-plugin/src/generators/app/versions/nx_18_X/versions.js +7 -37
- package/src/lib/nx-plugin/src/generators/app/versions/nx_18_X/versions.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/versions/tailwind-dependencies.d.ts +1 -1
- package/src/lib/nx-plugin/src/generators/app/versions/tailwind-dependencies.js +9 -15
- package/src/lib/nx-plugin/src/generators/app/versions/tailwind-dependencies.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/versions.d.ts +0 -28
- package/src/lib/nx-plugin/src/generators/init/compat.d.ts +9 -2
- package/src/lib/nx-plugin/src/generators/init/compat.js +17 -6
- package/src/lib/nx-plugin/src/generators/init/compat.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/generator.d.ts +3 -3
- package/src/lib/nx-plugin/src/generators/init/generator.js +54 -55
- package/src/lib/nx-plugin/src/generators/init/generator.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/lib/add-analog-dependencies.d.ts +1 -1
- package/src/lib/nx-plugin/src/generators/init/lib/add-analog-dependencies.js +19 -20
- package/src/lib/nx-plugin/src/generators/init/lib/add-analog-dependencies.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/lib/update-app-tsconfig.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/init/lib/update-app-tsconfig.js +20 -18
- package/src/lib/nx-plugin/src/generators/init/lib/update-app-tsconfig.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/lib/update-build-target.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/init/lib/update-build-target.js +56 -57
- package/src/lib/nx-plugin/src/generators/init/lib/update-build-target.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/lib/update-git-ignore.d.ts +1 -1
- package/src/lib/nx-plugin/src/generators/init/lib/update-git-ignore.js +12 -11
- package/src/lib/nx-plugin/src/generators/init/lib/update-git-ignore.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/lib/update-index-html.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/init/lib/update-index-html.js +17 -15
- package/src/lib/nx-plugin/src/generators/init/lib/update-index-html.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/lib/update-main.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/init/lib/update-main.js +12 -12
- package/src/lib/nx-plugin/src/generators/init/lib/update-main.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/lib/update-package-json.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/init/lib/update-package-json.js +19 -25
- package/src/lib/nx-plugin/src/generators/init/lib/update-package-json.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/lib/update-serve-target.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/init/lib/update-serve-target.js +43 -45
- package/src/lib/nx-plugin/src/generators/init/lib/update-serve-target.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/lib/update-test-target.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/init/lib/update-test-target.js +27 -28
- package/src/lib/nx-plugin/src/generators/init/lib/update-test-target.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/lib/update-test-tsconfig.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/init/lib/update-test-tsconfig.js +19 -17
- package/src/lib/nx-plugin/src/generators/init/lib/update-test-tsconfig.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/test-files/src/test-setup.ts__template__ +1 -0
- package/src/lib/nx-plugin/src/generators/page/compat.d.ts +9 -0
- package/src/lib/nx-plugin/src/generators/page/compat.js +18 -0
- package/src/lib/nx-plugin/src/generators/page/compat.js.map +1 -0
- package/src/lib/nx-plugin/src/generators/page/generator.d.ts +3 -4
- package/src/lib/nx-plugin/src/generators/page/generator.js +33 -44
- package/src/lib/nx-plugin/src/generators/page/generator.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/preset/__snapshots__/generator.spec.ts.snap +5 -3
- package/src/lib/nx-plugin/src/generators/preset/generator.d.ts +3 -3
- package/src/lib/nx-plugin/src/generators/preset/generator.js +17 -43
- package/src/lib/nx-plugin/src/generators/preset/generator.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/setup-vitest/compat.d.ts +9 -2
- package/src/lib/nx-plugin/src/generators/setup-vitest/compat.js +17 -6
- package/src/lib/nx-plugin/src/generators/setup-vitest/compat.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/setup-vitest/files/src/test-setup.ts__template__ +1 -0
- package/src/lib/nx-plugin/src/generators/setup-vitest/generator.d.ts +3 -3
- package/src/lib/nx-plugin/src/generators/setup-vitest/generator.js +35 -32
- package/src/lib/nx-plugin/src/generators/setup-vitest/generator.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/setup-vitest/lib/add-analog-dependencies.d.ts +1 -1
- package/src/lib/nx-plugin/src/generators/setup-vitest/lib/add-analog-dependencies.js +7 -7
- package/src/lib/nx-plugin/src/generators/setup-vitest/lib/add-analog-dependencies.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/setup-vitest/lib/update-test-target.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/setup-vitest/lib/update-test-target.js +20 -21
- package/src/lib/nx-plugin/src/generators/setup-vitest/lib/update-test-target.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/setup-vitest/lib/update-tsconfig.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/setup-vitest/lib/update-tsconfig.js +19 -19
- package/src/lib/nx-plugin/src/generators/setup-vitest/lib/update-tsconfig.js.map +1 -1
- package/src/lib/nx-plugin/src/index.js +0 -1
- package/src/lib/nx-plugin/src/utils/version-utils.d.ts +1 -1
- package/src/lib/nx-plugin/src/utils/version-utils.js +20 -18
- package/src/lib/nx-plugin/src/utils/version-utils.js.map +1 -1
- package/src/lib/nx-plugin/src/utils/versions/dependencies.js +42 -62
- package/src/lib/nx-plugin/src/utils/versions/dependencies.js.map +1 -1
- package/src/lib/nx-plugin/src/utils/versions/dev-dependencies.js +49 -83
- package/src/lib/nx-plugin/src/utils/versions/dev-dependencies.js.map +1 -1
- package/src/lib/nx-plugin/src/utils/versions/ng_17_X/versions.js +33 -20
- package/src/lib/nx-plugin/src/utils/versions/ng_17_X/versions.js.map +1 -1
- package/src/lib/nx-plugin/src/utils/versions/ng_18_X/versions.js +33 -20
- package/src/lib/nx-plugin/src/utils/versions/ng_18_X/versions.js.map +1 -1
- package/src/lib/nx-plugin/src/utils/versions/ng_19_X/versions.d.ts +7 -7
- package/src/lib/nx-plugin/src/utils/versions/ng_19_X/versions.js +37 -23
- package/src/lib/nx-plugin/src/utils/versions/ng_19_X/versions.js.map +1 -1
- package/src/lib/options.d.ts +158 -80
- package/src/lib/platform-plugin.d.ts +2 -2
- package/src/lib/platform-plugin.js +67 -61
- package/src/lib/platform-plugin.js.map +1 -0
- package/src/lib/route-file-discovery.d.ts +23 -0
- package/src/lib/route-file-discovery.js +114 -0
- package/src/lib/route-file-discovery.js.map +1 -0
- package/src/lib/route-generation-plugin.d.ts +3 -0
- package/src/lib/route-generation-plugin.js +34 -0
- package/src/lib/route-generation-plugin.js.map +1 -0
- package/src/lib/route-manifest.d.ts +118 -0
- package/src/lib/route-manifest.js +377 -0
- package/src/lib/route-manifest.js.map +1 -0
- package/src/lib/router-plugin.d.ts +19 -19
- package/src/lib/router-plugin.js +193 -150
- package/src/lib/router-plugin.js.map +1 -0
- package/src/lib/ssr/inject-html-plugin.d.ts +1 -1
- package/src/lib/ssr/inject-html-plugin.js +25 -25
- package/src/lib/ssr/inject-html-plugin.js.map +1 -0
- package/src/lib/ssr/ssr-build-plugin.d.ts +18 -2
- package/src/lib/ssr/ssr-build-plugin.js +54 -30
- package/src/lib/ssr/ssr-build-plugin.js.map +1 -0
- package/src/lib/tailwind-preprocessor.d.ts +23 -0
- package/src/lib/tailwind-preprocessor.js +33 -0
- package/src/lib/tailwind-preprocessor.js.map +1 -0
- package/src/lib/typed-routes-plugin.d.ts +50 -0
- package/src/lib/typed-routes-plugin.js +204 -0
- package/src/lib/typed-routes-plugin.js.map +1 -0
- package/src/lib/utils/rolldown.d.ts +3 -0
- package/src/lib/utils/rolldown.js +15 -0
- package/src/lib/utils/rolldown.js.map +1 -0
- package/src/server-mode-plugin.d.ts +6 -6
- package/src/server-mode-plugin.js +16 -18
- package/src/server-mode-plugin.js.map +1 -0
- package/README.md +0 -5
- package/src/lib/content/prism/options.js +0 -1
- package/src/lib/content/shiki/options.js +0 -1
- package/src/lib/nx-plugin/README.md +0 -23
- package/src/lib/nx-plugin/src/generators/app/files/tailwind/v2/postcss.config.cjs__template__ +0 -10
- package/src/lib/nx-plugin/src/generators/app/files/tailwind/v2/tailwind.config.cjs__template__ +0 -14
- package/src/lib/nx-plugin/src/generators/app/files/tailwind/v3/postcss.config.cjs__template__ +0 -10
- package/src/lib/nx-plugin/src/generators/app/files/tailwind/v3/tailwind.config.ts__template__ +0 -14
- package/src/lib/nx-plugin/src/generators/app/files/tailwind/v4/.postcssrc.json +0 -5
- package/src/lib/nx-plugin/src/generators/app/files/tailwind/v4/tailwind.config.ts__template__ +0 -14
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/index.html__template__ +0 -15
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/app/app.component.spec.ts__template__ +0 -17
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/app/app.component.ts__template__ +0 -10
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/favicon.ico__template__ +0 -0
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/main.providers.ts__template__ +0 -5
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/main.server.ts__template__ +0 -23
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/main.ts__template__ +0 -17
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/public/assets/.gitkeep__template__ +0 -0
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/public/assets/analog.svg__template__ +0 -1
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/public/assets/vite.svg__template__ +0 -1
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/server/routes/v1/hello.ts__template__ +0 -3
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/styles.css__template__ +0 -4
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/test-setup.ts__template__ +0 -12
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/vite-env.d.ts__template__ +0 -1
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/tsconfig.app.json__template__ +0 -16
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/tsconfig.editor.json__template__ +0 -7
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/tsconfig.json__template__ +0 -32
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/tsconfig.spec.json__template__ +0 -14
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/vite.config.ts__template__ +0 -69
- package/src/lib/nx-plugin/src/generators/app/lib/add-analog-dependencies.js +0 -15
- package/src/lib/nx-plugin/src/generators/app/lib/add-analog-dependencies.js.map +0 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-eslint.js +0 -58
- package/src/lib/nx-plugin/src/generators/app/lib/add-eslint.js.map +0 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-vite-plugin.js +0 -47
- package/src/lib/nx-plugin/src/generators/app/lib/add-vite-plugin.js.map +0 -1
- package/src/lib/nx-plugin/src/generators/app/lib/initialize-analog-workspace.js +0 -107
- package/src/lib/nx-plugin/src/generators/app/lib/initialize-analog-workspace.js.map +0 -1
- package/src/lib/nx-plugin/src/generators/app/versions/dependencies.js +0 -56
- package/src/lib/nx-plugin/src/generators/app/versions/dependencies.js.map +0 -1
- package/src/lib/nx-plugin/src/generators/app/versions/dev-dependencies.js +0 -72
- package/src/lib/nx-plugin/src/generators/app/versions/dev-dependencies.js.map +0 -1
- package/src/lib/nx-plugin/src/generators/app/versions/nx-dependencies.js +0 -46
- package/src/lib/nx-plugin/src/generators/app/versions/nx-dependencies.js.map +0 -1
- package/src/lib/nx-plugin/src/generators/app/versions/nx_17_X/versions.js +0 -37
- package/src/lib/nx-plugin/src/generators/app/versions/nx_17_X/versions.js.map +0 -1
- package/src/lib/nx-plugin/src/generators/app/versions.js +0 -43
- package/src/lib/nx-plugin/src/generators/app/versions.js.map +0 -1
- package/src/lib/nx-plugin/src/index.d.ts +0 -0
- package/src/lib/nx-plugin/src/index.js.map +0 -1
- package/src/lib/options.js +0 -1
- package/src/lib/ssr/ssr-xhr-plugin.d.ts +0 -2
- package/src/lib/ssr/ssr-xhr-plugin.js +0 -28
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
//#region packages/platform/src/lib/route-manifest.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts a discovered filename to a route path pattern.
|
|
4
|
+
*
|
|
5
|
+
* Uses the same stripping rules as the existing route system
|
|
6
|
+
* but preserves bracket param syntax instead of converting to
|
|
7
|
+
* Angular's `:param` syntax.
|
|
8
|
+
*
|
|
9
|
+
* The regex applies four alternations (left to right, all replaced with ''):
|
|
10
|
+
* 1. `^(.*?)[\\/](?:routes|pages|content)[\\/]` — anchored, strips everything
|
|
11
|
+
* up to and including the first /routes/, /pages/, or /content/ segment.
|
|
12
|
+
* Handles app-local paths (`/src/app/pages/`) AND additional dirs
|
|
13
|
+
* (`/libs/shared/feature/src/content/`) uniformly.
|
|
14
|
+
* 2. `[\\/](?:app[\\/](?:routes|pages)|src[\\/]content)[\\/]` — non-anchored
|
|
15
|
+
* fallback for legacy paths where the directory marker appears mid-string.
|
|
16
|
+
* 3. `\.page\.(js|ts|analog|ag)$` — strips page file extensions.
|
|
17
|
+
* 4. `\.(ts|md|analog|ag)$` — strips remaining file extensions.
|
|
18
|
+
*
|
|
19
|
+
* Examples:
|
|
20
|
+
* - '/app/routes/index.ts' -> '/'
|
|
21
|
+
* - '/app/routes/about.ts' -> '/about'
|
|
22
|
+
* - '/src/app/pages/users/[id].page.ts' -> '/users/[id]'
|
|
23
|
+
* - '/app/routes/blog.[slug].ts' -> '/blog/[slug]'
|
|
24
|
+
* - '/src/app/pages/(auth)/login.page.ts' -> '/login'
|
|
25
|
+
* - '/src/app/pages/docs/[...slug].page.ts' -> '/docs/[...slug]'
|
|
26
|
+
* - '/src/app/pages/shop/[[...category]].page.ts' -> '/shop/[[...category]]'
|
|
27
|
+
* - '/libs/shared/feature/src/content/test.md' -> '/test'
|
|
28
|
+
*/
|
|
29
|
+
function filenameToRoutePath(filename) {
|
|
30
|
+
let path = filename.replace(/^(?:[a-zA-Z]:[\\/])?(.*?)[\\/](?:routes|pages|content)[\\/]|(?:[\\/](?:app[\\/](?:routes|pages)|src[\\/]content)[\\/])|(\.page\.(js|ts|analog|ag)$)|(\.(ts|md|analog|ag)$)/g, "");
|
|
31
|
+
const brackets = [];
|
|
32
|
+
path = path.replace(/\[\[?\.{0,3}[^\]]*\]?\]/g, (match) => {
|
|
33
|
+
brackets.push(match);
|
|
34
|
+
return `\0B${brackets.length - 1}\0`;
|
|
35
|
+
});
|
|
36
|
+
path = path.replace(/\./g, "/");
|
|
37
|
+
path = path.replace(/\0B(\d+)\0/g, (_, idx) => brackets[Number(idx)]);
|
|
38
|
+
const segments = path.split("/").filter(Boolean);
|
|
39
|
+
const processed = [];
|
|
40
|
+
for (const segment of segments) {
|
|
41
|
+
if (/^\([^.[\]]*\)$/.test(segment)) continue;
|
|
42
|
+
processed.push(segment);
|
|
43
|
+
}
|
|
44
|
+
if (processed.length > 0 && processed[processed.length - 1] === "index") processed.pop();
|
|
45
|
+
return "/" + processed.join("/");
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Converts a discovered filename to a stable structural route id.
|
|
49
|
+
*
|
|
50
|
+
* Unlike `filenameToRoutePath`, this preserves route groups and `index`
|
|
51
|
+
* segments so that multiple files resolving to the same URL shape can still
|
|
52
|
+
* have distinct structural identities in the generated route tree metadata.
|
|
53
|
+
*
|
|
54
|
+
* Uses the same directory-stripping regex as `filenameToRoutePath` —
|
|
55
|
+
* changes to the regex must be kept in sync between both functions.
|
|
56
|
+
*/
|
|
57
|
+
function filenameToRouteId(filename) {
|
|
58
|
+
let path = filename.replace(/^(?:[a-zA-Z]:[\\/])?(.*?)[\\/](?:routes|pages|content)[\\/]|(?:[\\/](?:app[\\/](?:routes|pages)|src[\\/]content)[\\/])|(\.page\.(js|ts|analog|ag)$)|(\.(ts|md|analog|ag)$)/g, "");
|
|
59
|
+
const brackets = [];
|
|
60
|
+
path = path.replace(/\[\[?\.{0,3}[^\]]*\]?\]/g, (match) => {
|
|
61
|
+
brackets.push(match);
|
|
62
|
+
return `\0B${brackets.length - 1}\0`;
|
|
63
|
+
});
|
|
64
|
+
path = path.replace(/\./g, "/");
|
|
65
|
+
path = path.replace(/\0B(\d+)\0/g, (_, idx) => brackets[Number(idx)]);
|
|
66
|
+
return "/" + path.split("/").filter(Boolean).join("/");
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Extracts parameter information from a route path pattern.
|
|
70
|
+
*/
|
|
71
|
+
function extractRouteParams(routePath) {
|
|
72
|
+
const params = [];
|
|
73
|
+
for (const match of routePath.matchAll(/\[\[\.\.\.([^\]]+)\]\]/g)) params.push({
|
|
74
|
+
name: match[1],
|
|
75
|
+
type: "optionalCatchAll"
|
|
76
|
+
});
|
|
77
|
+
for (const match of routePath.matchAll(/(?<!\[)\[\.\.\.([^\]]+)\](?!\])/g)) params.push({
|
|
78
|
+
name: match[1],
|
|
79
|
+
type: "catchAll"
|
|
80
|
+
});
|
|
81
|
+
for (const match of routePath.matchAll(/(?<!\[)\[(?!\.)([^\]]+)\](?!\])/g)) params.push({
|
|
82
|
+
name: match[1],
|
|
83
|
+
type: "dynamic"
|
|
84
|
+
});
|
|
85
|
+
return params;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Detects whether a route file exports schema constants.
|
|
89
|
+
*/
|
|
90
|
+
function detectSchemaExports(fileContent) {
|
|
91
|
+
return {
|
|
92
|
+
hasParamsSchema: /export\s+const\s+routeParamsSchema\b/.test(fileContent),
|
|
93
|
+
hasQuerySchema: /export\s+const\s+routeQuerySchema\b/.test(fileContent)
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
var NO_SCHEMAS = {
|
|
97
|
+
hasParamsSchema: false,
|
|
98
|
+
hasQuerySchema: false
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Generates a route manifest from a list of discovered filenames.
|
|
102
|
+
*
|
|
103
|
+
* @param collisionPriority - Optional callback that returns a numeric priority
|
|
104
|
+
* for each filename (lower wins). When provided, this replaces the default
|
|
105
|
+
* hard-coded path-substring heuristic with config-derived precedence.
|
|
106
|
+
*/
|
|
107
|
+
function generateRouteManifest(filenames, schemaDetector, collisionPriority) {
|
|
108
|
+
const routes = [];
|
|
109
|
+
const seenByFullPath = /* @__PURE__ */ new Map();
|
|
110
|
+
const getPriority = collisionPriority ?? getCollisionPriority;
|
|
111
|
+
const prioritizedFilenames = [...filenames].sort((a, b) => {
|
|
112
|
+
const aPriority = getPriority(a);
|
|
113
|
+
const bPriority = getPriority(b);
|
|
114
|
+
if (aPriority !== bPriority) return aPriority - bPriority;
|
|
115
|
+
return a.localeCompare(b);
|
|
116
|
+
});
|
|
117
|
+
for (const filename of prioritizedFilenames) {
|
|
118
|
+
const fullPath = filenameToRoutePath(filename);
|
|
119
|
+
const params = extractRouteParams(fullPath);
|
|
120
|
+
const schemas = schemaDetector ? schemaDetector(filename) : NO_SCHEMAS;
|
|
121
|
+
const id = filenameToRouteId(filename);
|
|
122
|
+
if (seenByFullPath.has(fullPath)) {
|
|
123
|
+
const winningFilename = seenByFullPath.get(fullPath);
|
|
124
|
+
console.warn(`[Analog] Route collision: '${fullPath}' is defined by both '${winningFilename}' and '${filename}'. Keeping '${winningFilename}' based on route source precedence and skipping duplicate.`);
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
seenByFullPath.set(fullPath, filename);
|
|
128
|
+
routes.push({
|
|
129
|
+
id,
|
|
130
|
+
path: fullPath,
|
|
131
|
+
fullPath,
|
|
132
|
+
params,
|
|
133
|
+
filename,
|
|
134
|
+
schemas,
|
|
135
|
+
kind: filename.endsWith(".md") ? "content" : "page",
|
|
136
|
+
parentId: null,
|
|
137
|
+
children: [],
|
|
138
|
+
isIndex: id === "/index" || id.endsWith("/index"),
|
|
139
|
+
isGroup: id.includes("/(") || /^\/*\(/.test(id),
|
|
140
|
+
isCatchAll: params.some((param) => param.type === "catchAll"),
|
|
141
|
+
isOptionalCatchAll: params.some((param) => param.type === "optionalCatchAll")
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
routes.sort((a, b) => {
|
|
145
|
+
const aW = getRouteWeight(a.fullPath);
|
|
146
|
+
const bW = getRouteWeight(b.fullPath);
|
|
147
|
+
if (aW !== bW) return aW - bW;
|
|
148
|
+
return a.fullPath.localeCompare(b.fullPath);
|
|
149
|
+
});
|
|
150
|
+
const routeByFullPath = new Map(routes.map((route) => [route.fullPath, route]));
|
|
151
|
+
for (const route of routes) {
|
|
152
|
+
const parent = findNearestParentRoute(route.fullPath, routeByFullPath);
|
|
153
|
+
route.parentId = parent?.id ?? null;
|
|
154
|
+
route.path = computeLocalPath(route.fullPath, parent?.fullPath ?? null);
|
|
155
|
+
}
|
|
156
|
+
const routeById = new Map(routes.map((route) => [route.id, route]));
|
|
157
|
+
for (const route of routes) if (route.parentId) routeById.get(route.parentId)?.children.push(route.id);
|
|
158
|
+
for (const route of routes) if (route.schemas.hasParamsSchema && route.params.length === 0) console.warn(`[Analog] Route '${route.fullPath}' exports routeParamsSchema but has no dynamic params in the filename.`);
|
|
159
|
+
for (const route of routes) {
|
|
160
|
+
if (route.parentId && !routeById.has(route.parentId)) console.warn(`[Analog] Route '${route.id}' has parentId '${route.parentId}' which does not match any route id in the manifest.`);
|
|
161
|
+
for (const childId of route.children) if (!routeById.has(childId)) console.warn(`[Analog] Route '${route.id}' lists child '${childId}' which does not match any route id in the manifest.`);
|
|
162
|
+
}
|
|
163
|
+
return { routes };
|
|
164
|
+
}
|
|
165
|
+
function getRouteWeight(path) {
|
|
166
|
+
if (path.includes("[[...")) return 3;
|
|
167
|
+
if (path.includes("[...")) return 2;
|
|
168
|
+
if (path.includes("[")) return 1;
|
|
169
|
+
return 0;
|
|
170
|
+
}
|
|
171
|
+
function getCollisionPriority(filename) {
|
|
172
|
+
if (filename.includes("/src/app/pages/") || filename.includes("/src/app/routes/") || filename.includes("/app/pages/") || filename.includes("/app/routes/") || filename.includes("/src/content/")) return 0;
|
|
173
|
+
return 1;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Produces a human-readable summary of the generated route manifest.
|
|
177
|
+
*/
|
|
178
|
+
function formatManifestSummary(manifest) {
|
|
179
|
+
const lines = [];
|
|
180
|
+
const total = manifest.routes.length;
|
|
181
|
+
const withSchemas = manifest.routes.filter((r) => r.schemas.hasParamsSchema || r.schemas.hasQuerySchema).length;
|
|
182
|
+
const staticCount = manifest.routes.filter((r) => r.params.length === 0).length;
|
|
183
|
+
const dynamicCount = total - staticCount;
|
|
184
|
+
lines.push(`[Analog] Generated typed routes:`);
|
|
185
|
+
lines.push(` ${total} routes (${staticCount} static, ${dynamicCount} dynamic)`);
|
|
186
|
+
if (withSchemas > 0) lines.push(` ${withSchemas} with schema validation`);
|
|
187
|
+
for (const route of manifest.routes) {
|
|
188
|
+
const flags = [];
|
|
189
|
+
if (route.schemas.hasParamsSchema) flags.push("params-schema");
|
|
190
|
+
if (route.schemas.hasQuerySchema) flags.push("query-schema");
|
|
191
|
+
const suffix = flags.length > 0 ? ` [${flags.join(", ")}]` : "";
|
|
192
|
+
lines.push(` ${route.fullPath}${suffix}`);
|
|
193
|
+
}
|
|
194
|
+
return lines.join("\n");
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Generates the route-table section for the combined generated route module.
|
|
198
|
+
*/
|
|
199
|
+
function generateRouteTableDeclaration(manifest) {
|
|
200
|
+
const lines = [];
|
|
201
|
+
const hasAnySchema = manifest.routes.some((r) => r.schemas.hasParamsSchema || r.schemas.hasQuerySchema);
|
|
202
|
+
lines.push("// This file is auto-generated by @analogjs/platform");
|
|
203
|
+
lines.push("// Do not edit manually");
|
|
204
|
+
lines.push("");
|
|
205
|
+
if (hasAnySchema) lines.push("import type { StandardSchemaV1 } from '@standard-schema/spec';");
|
|
206
|
+
const schemaImports = /* @__PURE__ */ new Map();
|
|
207
|
+
let aliasIndex = 0;
|
|
208
|
+
for (const route of manifest.routes) if (route.schemas.hasParamsSchema || route.schemas.hasQuerySchema) {
|
|
209
|
+
const importPath = filenameToImportPath(route.filename);
|
|
210
|
+
const names = [];
|
|
211
|
+
if (route.schemas.hasParamsSchema) {
|
|
212
|
+
const alias = `_p${aliasIndex}`;
|
|
213
|
+
names.push(`routeParamsSchema as ${alias}`);
|
|
214
|
+
schemaImports.set(`${route.fullPath}:params`, alias);
|
|
215
|
+
}
|
|
216
|
+
if (route.schemas.hasQuerySchema) {
|
|
217
|
+
const alias = `_q${aliasIndex}`;
|
|
218
|
+
names.push(`routeQuerySchema as ${alias}`);
|
|
219
|
+
schemaImports.set(`${route.fullPath}:query`, alias);
|
|
220
|
+
}
|
|
221
|
+
lines.push(`import type { ${names.join(", ")} } from '${importPath}';`);
|
|
222
|
+
aliasIndex++;
|
|
223
|
+
}
|
|
224
|
+
if (hasAnySchema) lines.push("");
|
|
225
|
+
lines.push("declare module '@analogjs/router' {");
|
|
226
|
+
lines.push(" interface AnalogRouteTable {");
|
|
227
|
+
for (const route of manifest.routes) {
|
|
228
|
+
const paramsAlias = schemaImports.get(`${route.fullPath}:params`);
|
|
229
|
+
const queryAlias = schemaImports.get(`${route.fullPath}:query`);
|
|
230
|
+
const paramsType = generateParamsType(route.params);
|
|
231
|
+
const queryType = "Record<string, string | string[] | undefined>";
|
|
232
|
+
const paramsOutputType = paramsAlias ? `StandardSchemaV1.InferOutput<typeof ${paramsAlias}>` : paramsType;
|
|
233
|
+
const queryOutputType = queryAlias ? `StandardSchemaV1.InferOutput<typeof ${queryAlias}>` : queryType;
|
|
234
|
+
lines.push(` '${route.fullPath}': {`);
|
|
235
|
+
lines.push(` params: ${paramsType};`);
|
|
236
|
+
lines.push(` paramsOutput: ${paramsOutputType};`);
|
|
237
|
+
lines.push(` query: ${queryType};`);
|
|
238
|
+
lines.push(` queryOutput: ${queryOutputType};`);
|
|
239
|
+
lines.push(` };`);
|
|
240
|
+
}
|
|
241
|
+
lines.push(" }");
|
|
242
|
+
lines.push("}");
|
|
243
|
+
lines.push("");
|
|
244
|
+
lines.push("export {};");
|
|
245
|
+
lines.push("");
|
|
246
|
+
return lines.join("\n");
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Generates the route-tree section for the combined generated route module.
|
|
250
|
+
*/
|
|
251
|
+
function generateRouteTreeDeclaration(manifest, options = {}) {
|
|
252
|
+
const lines = [];
|
|
253
|
+
const jsonLdPaths = new Set(options.jsonLdPaths ?? []);
|
|
254
|
+
lines.push("// This file is auto-generated by @analogjs/platform");
|
|
255
|
+
lines.push("// Do not edit manually");
|
|
256
|
+
lines.push("");
|
|
257
|
+
lines.push("export interface AnalogGeneratedRouteRecord<");
|
|
258
|
+
lines.push(" TId extends string = string,");
|
|
259
|
+
lines.push(" TPath extends string = string,");
|
|
260
|
+
lines.push(" TFullPath extends string = string,");
|
|
261
|
+
lines.push(" TParentId extends string | null = string | null,");
|
|
262
|
+
lines.push(" TChildren extends readonly string[] = readonly string[],");
|
|
263
|
+
lines.push("> {");
|
|
264
|
+
lines.push(" id: TId;");
|
|
265
|
+
lines.push(" path: TPath;");
|
|
266
|
+
lines.push(" fullPath: TFullPath;");
|
|
267
|
+
lines.push(" parentId: TParentId;");
|
|
268
|
+
lines.push(" children: TChildren;");
|
|
269
|
+
lines.push(" sourceFile: string;");
|
|
270
|
+
lines.push(" kind: 'page' | 'content';");
|
|
271
|
+
lines.push(" hasParamsSchema: boolean;");
|
|
272
|
+
lines.push(" hasQuerySchema: boolean;");
|
|
273
|
+
lines.push(" hasJsonLd: boolean;");
|
|
274
|
+
lines.push(" isIndex: boolean;");
|
|
275
|
+
lines.push(" isGroup: boolean;");
|
|
276
|
+
lines.push(" isCatchAll: boolean;");
|
|
277
|
+
lines.push(" isOptionalCatchAll: boolean;");
|
|
278
|
+
lines.push("}");
|
|
279
|
+
lines.push("");
|
|
280
|
+
lines.push("export interface AnalogFileRoutesById {");
|
|
281
|
+
for (const route of manifest.routes) lines.push(` ${toTsKey(route.id)}: AnalogGeneratedRouteRecord<${toTsStringLiteral(route.id)}, ${toTsStringLiteral(route.path)}, ${toTsStringLiteral(route.fullPath)}, ${route.parentId ? toTsStringLiteral(route.parentId) : "null"}, ${toReadonlyTupleType(route.children)}>;`);
|
|
282
|
+
lines.push("}");
|
|
283
|
+
lines.push("");
|
|
284
|
+
lines.push("export interface AnalogFileRoutesByFullPath {");
|
|
285
|
+
for (const route of manifest.routes) lines.push(` ${toTsKey(route.fullPath)}: AnalogFileRoutesById[${toTsStringLiteral(route.id)}];`);
|
|
286
|
+
lines.push("}");
|
|
287
|
+
lines.push("");
|
|
288
|
+
lines.push("export type AnalogRouteTreeId = keyof AnalogFileRoutesById;");
|
|
289
|
+
lines.push("export type AnalogRouteTreeFullPath = keyof AnalogFileRoutesByFullPath;");
|
|
290
|
+
lines.push("");
|
|
291
|
+
lines.push("export const analogRouteTree = {");
|
|
292
|
+
lines.push(" byId: {");
|
|
293
|
+
for (const route of manifest.routes) {
|
|
294
|
+
lines.push(` ${toObjectKey(route.id)}: {`);
|
|
295
|
+
lines.push(` id: ${toTsStringLiteral(route.id)},`);
|
|
296
|
+
lines.push(` path: ${toTsStringLiteral(route.path)},`);
|
|
297
|
+
lines.push(` fullPath: ${toTsStringLiteral(route.fullPath)},`);
|
|
298
|
+
lines.push(` parentId: ${route.parentId ? toTsStringLiteral(route.parentId) : "null"},`);
|
|
299
|
+
lines.push(` children: ${toReadonlyTupleValue(route.children)},`);
|
|
300
|
+
lines.push(` sourceFile: ${toTsStringLiteral(route.filename)},`);
|
|
301
|
+
lines.push(` kind: ${toTsStringLiteral(route.kind)},`);
|
|
302
|
+
lines.push(` hasParamsSchema: ${String(route.schemas.hasParamsSchema)},`);
|
|
303
|
+
lines.push(` hasQuerySchema: ${String(route.schemas.hasQuerySchema)},`);
|
|
304
|
+
lines.push(` hasJsonLd: ${String(jsonLdPaths.has(route.fullPath))},`);
|
|
305
|
+
lines.push(` isIndex: ${String(route.isIndex)},`);
|
|
306
|
+
lines.push(` isGroup: ${String(route.isGroup)},`);
|
|
307
|
+
lines.push(` isCatchAll: ${String(route.isCatchAll)},`);
|
|
308
|
+
lines.push(` isOptionalCatchAll: ${String(route.isOptionalCatchAll)},`);
|
|
309
|
+
lines.push(` } satisfies AnalogFileRoutesById[${toTsStringLiteral(route.id)}],`);
|
|
310
|
+
}
|
|
311
|
+
lines.push(" },");
|
|
312
|
+
lines.push(" byFullPath: {");
|
|
313
|
+
for (const route of manifest.routes) lines.push(` ${toObjectKey(route.fullPath)}: ${toTsStringLiteral(route.id)},`);
|
|
314
|
+
lines.push(" },");
|
|
315
|
+
lines.push("} as const;");
|
|
316
|
+
lines.push("");
|
|
317
|
+
return lines.join("\n");
|
|
318
|
+
}
|
|
319
|
+
function filenameToImportPath(filename) {
|
|
320
|
+
return "../" + filename.replace(/^\//, "").replace(/\.ts$/, "");
|
|
321
|
+
}
|
|
322
|
+
function generateParamsType(params) {
|
|
323
|
+
if (params.length === 0) return "Record<string, never>";
|
|
324
|
+
return `{ ${params.map((p) => {
|
|
325
|
+
const key = isValidIdentifier(p.name) ? p.name : `'${p.name}'`;
|
|
326
|
+
switch (p.type) {
|
|
327
|
+
case "dynamic": return `${key}: string`;
|
|
328
|
+
case "catchAll": return `${key}: string[]`;
|
|
329
|
+
case "optionalCatchAll": return `${key}?: string[]`;
|
|
330
|
+
}
|
|
331
|
+
}).join("; ")} }`;
|
|
332
|
+
}
|
|
333
|
+
function isValidIdentifier(name) {
|
|
334
|
+
return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name);
|
|
335
|
+
}
|
|
336
|
+
function findNearestParentRoute(fullPath, routesByFullPath) {
|
|
337
|
+
if (fullPath === "/") return;
|
|
338
|
+
const segments = fullPath.slice(1).split("/");
|
|
339
|
+
for (let index = segments.length - 1; index > 0; index--) {
|
|
340
|
+
const candidate = "/" + segments.slice(0, index).join("/");
|
|
341
|
+
const route = routesByFullPath.get(candidate);
|
|
342
|
+
if (route) return route;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
function computeLocalPath(fullPath, parentFullPath) {
|
|
346
|
+
if (fullPath === "/") return "/";
|
|
347
|
+
if (!parentFullPath) return fullPath.slice(1);
|
|
348
|
+
return fullPath.slice(parentFullPath.length).replace(/^\/+/, "") || "/";
|
|
349
|
+
}
|
|
350
|
+
function toTsStringLiteral(value) {
|
|
351
|
+
return JSON.stringify(value);
|
|
352
|
+
}
|
|
353
|
+
function toTsKey(value) {
|
|
354
|
+
return toTsStringLiteral(value);
|
|
355
|
+
}
|
|
356
|
+
function toObjectKey(value) {
|
|
357
|
+
return isValidIdentifier(value) ? value : toTsStringLiteral(value);
|
|
358
|
+
}
|
|
359
|
+
function toReadonlyTupleType(values) {
|
|
360
|
+
if (values.length === 0) return "readonly []";
|
|
361
|
+
return `readonly [${values.map((value) => toTsStringLiteral(value)).join(", ")}]`;
|
|
362
|
+
}
|
|
363
|
+
function toReadonlyTupleValue(values) {
|
|
364
|
+
if (values.length === 0) return "[] as const";
|
|
365
|
+
return `[${values.map((value) => toTsStringLiteral(value)).join(", ")}] as const`;
|
|
366
|
+
}
|
|
367
|
+
function isJsonLdObject(value) {
|
|
368
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
369
|
+
}
|
|
370
|
+
function normalizeJsonLd(value) {
|
|
371
|
+
if (Array.isArray(value)) return value.filter(isJsonLdObject);
|
|
372
|
+
return isJsonLdObject(value) ? [value] : [];
|
|
373
|
+
}
|
|
374
|
+
//#endregion
|
|
375
|
+
export { detectSchemaExports, filenameToRoutePath, formatManifestSummary, generateRouteManifest, generateRouteTableDeclaration, generateRouteTreeDeclaration, normalizeJsonLd };
|
|
376
|
+
|
|
377
|
+
//# sourceMappingURL=route-manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-manifest.js","names":[],"sources":["../../../src/lib/route-manifest.ts"],"sourcesContent":["/**\n * Route-manifest engine for typed file routes.\n *\n * Pure functions (no Angular dependencies) for converting discovered\n * filenames into typed route manifests and generated declarations.\n */\n\nexport interface RouteParamInfo {\n name: string;\n type: 'dynamic' | 'catchAll' | 'optionalCatchAll';\n}\n\nexport interface RouteSchemaInfo {\n hasParamsSchema: boolean;\n hasQuerySchema: boolean;\n}\n\nexport interface GenerateRouteTreeDeclarationOptions {\n jsonLdPaths?: Iterable<string>;\n}\n\nexport interface RouteEntry {\n /** Stable structural route id derived from the source filename */\n id: string;\n /** The route path segment relative to the nearest existing parent route */\n path: string;\n /** The fully resolved navigation path pattern (e.g., '/users/[id]') */\n fullPath: string;\n /** Extracted parameter information */\n params: RouteParamInfo[];\n /** Original filename that produced this route */\n filename: string;\n /** Schema export info (detected from file content) */\n schemas: RouteSchemaInfo;\n /** Type of source that produced this route */\n kind: 'page' | 'content';\n /** Parent route id, or null for top-level routes */\n parentId: string | null;\n /** Child route ids */\n children: string[];\n /** Whether the source filename represents an index route */\n isIndex: boolean;\n /** Whether the source filename includes route-group/pathless segments */\n isGroup: boolean;\n /** Whether the route contains a required catch-all parameter */\n isCatchAll: boolean;\n /** Whether the route contains an optional catch-all parameter */\n isOptionalCatchAll: boolean;\n}\n\nexport interface RouteManifest {\n routes: RouteEntry[];\n}\n\n/**\n * Converts a discovered filename to a route path pattern.\n *\n * Uses the same stripping rules as the existing route system\n * but preserves bracket param syntax instead of converting to\n * Angular's `:param` syntax.\n *\n * The regex applies four alternations (left to right, all replaced with ''):\n * 1. `^(.*?)[\\\\/](?:routes|pages|content)[\\\\/]` — anchored, strips everything\n * up to and including the first /routes/, /pages/, or /content/ segment.\n * Handles app-local paths (`/src/app/pages/`) AND additional dirs\n * (`/libs/shared/feature/src/content/`) uniformly.\n * 2. `[\\\\/](?:app[\\\\/](?:routes|pages)|src[\\\\/]content)[\\\\/]` — non-anchored\n * fallback for legacy paths where the directory marker appears mid-string.\n * 3. `\\.page\\.(js|ts|analog|ag)$` — strips page file extensions.\n * 4. `\\.(ts|md|analog|ag)$` — strips remaining file extensions.\n *\n * Examples:\n * - '/app/routes/index.ts' -> '/'\n * - '/app/routes/about.ts' -> '/about'\n * - '/src/app/pages/users/[id].page.ts' -> '/users/[id]'\n * - '/app/routes/blog.[slug].ts' -> '/blog/[slug]'\n * - '/src/app/pages/(auth)/login.page.ts' -> '/login'\n * - '/src/app/pages/docs/[...slug].page.ts' -> '/docs/[...slug]'\n * - '/src/app/pages/shop/[[...category]].page.ts' -> '/shop/[[...category]]'\n * - '/libs/shared/feature/src/content/test.md' -> '/test'\n */\nexport function filenameToRoutePath(filename: string): string {\n let path = filename.replace(\n /^(?:[a-zA-Z]:[\\\\/])?(.*?)[\\\\/](?:routes|pages|content)[\\\\/]|(?:[\\\\/](?:app[\\\\/](?:routes|pages)|src[\\\\/]content)[\\\\/])|(\\.page\\.(js|ts|analog|ag)$)|(\\.(ts|md|analog|ag)$)/g,\n '',\n );\n\n const brackets: string[] = [];\n path = path.replace(/\\[\\[?\\.{0,3}[^\\]]*\\]?\\]/g, (match) => {\n brackets.push(match);\n // eslint-disable-next-line no-control-regex\n return `\\0B${brackets.length - 1}\\0`;\n });\n path = path.replace(/\\./g, '/');\n // eslint-disable-next-line no-control-regex\n path = path.replace(/\\0B(\\d+)\\0/g, (_, idx) => brackets[Number(idx)]);\n\n const segments = path.split('/').filter(Boolean);\n const processed: string[] = [];\n\n for (const segment of segments) {\n if (/^\\([^.[\\]]*\\)$/.test(segment)) continue;\n processed.push(segment);\n }\n\n if (processed.length > 0 && processed[processed.length - 1] === 'index') {\n processed.pop();\n }\n\n return '/' + processed.join('/');\n}\n\n/**\n * Converts a discovered filename to a stable structural route id.\n *\n * Unlike `filenameToRoutePath`, this preserves route groups and `index`\n * segments so that multiple files resolving to the same URL shape can still\n * have distinct structural identities in the generated route tree metadata.\n *\n * Uses the same directory-stripping regex as `filenameToRoutePath` —\n * changes to the regex must be kept in sync between both functions.\n */\nexport function filenameToRouteId(filename: string): string {\n let path = filename.replace(\n /^(?:[a-zA-Z]:[\\\\/])?(.*?)[\\\\/](?:routes|pages|content)[\\\\/]|(?:[\\\\/](?:app[\\\\/](?:routes|pages)|src[\\\\/]content)[\\\\/])|(\\.page\\.(js|ts|analog|ag)$)|(\\.(ts|md|analog|ag)$)/g,\n '',\n );\n\n const brackets: string[] = [];\n path = path.replace(/\\[\\[?\\.{0,3}[^\\]]*\\]?\\]/g, (match) => {\n brackets.push(match);\n // eslint-disable-next-line no-control-regex\n return `\\0B${brackets.length - 1}\\0`;\n });\n path = path.replace(/\\./g, '/');\n // eslint-disable-next-line no-control-regex\n path = path.replace(/\\0B(\\d+)\\0/g, (_, idx) => brackets[Number(idx)]);\n\n const segments = path.split('/').filter(Boolean);\n\n return '/' + segments.join('/');\n}\n\n/**\n * Extracts parameter information from a route path pattern.\n */\nexport function extractRouteParams(routePath: string): RouteParamInfo[] {\n const params: RouteParamInfo[] = [];\n\n for (const match of routePath.matchAll(/\\[\\[\\.\\.\\.([^\\]]+)\\]\\]/g)) {\n params.push({ name: match[1], type: 'optionalCatchAll' });\n }\n for (const match of routePath.matchAll(/(?<!\\[)\\[\\.\\.\\.([^\\]]+)\\](?!\\])/g)) {\n params.push({ name: match[1], type: 'catchAll' });\n }\n for (const match of routePath.matchAll(/(?<!\\[)\\[(?!\\.)([^\\]]+)\\](?!\\])/g)) {\n params.push({ name: match[1], type: 'dynamic' });\n }\n\n return params;\n}\n\n/**\n * Detects whether a route file exports schema constants.\n */\nexport function detectSchemaExports(fileContent: string): RouteSchemaInfo {\n return {\n hasParamsSchema: /export\\s+const\\s+routeParamsSchema\\b/.test(fileContent),\n hasQuerySchema: /export\\s+const\\s+routeQuerySchema\\b/.test(fileContent),\n };\n}\n\nconst NO_SCHEMAS: RouteSchemaInfo = {\n hasParamsSchema: false,\n hasQuerySchema: false,\n};\n\n/**\n * Generates a route manifest from a list of discovered filenames.\n *\n * @param collisionPriority - Optional callback that returns a numeric priority\n * for each filename (lower wins). When provided, this replaces the default\n * hard-coded path-substring heuristic with config-derived precedence.\n */\nexport function generateRouteManifest(\n filenames: string[],\n schemaDetector?: (filename: string) => RouteSchemaInfo,\n collisionPriority?: (filename: string) => number,\n): RouteManifest {\n const routes: RouteEntry[] = [];\n const seenByFullPath = new Map<string, string>();\n const getPriority = collisionPriority ?? getCollisionPriority;\n\n // Prefer app-local route files over shared/external sources when two files\n // resolve to the same URL. This keeps `additionalPagesDirs` additive instead\n // of unexpectedly overriding the route that lives inside the app itself.\n const prioritizedFilenames = [...filenames].sort((a, b) => {\n const aPriority = getPriority(a);\n const bPriority = getPriority(b);\n if (aPriority !== bPriority) {\n return aPriority - bPriority;\n }\n return a.localeCompare(b);\n });\n\n for (const filename of prioritizedFilenames) {\n const fullPath = filenameToRoutePath(filename);\n const params = extractRouteParams(fullPath);\n const schemas = schemaDetector ? schemaDetector(filename) : NO_SCHEMAS;\n const id = filenameToRouteId(filename);\n\n if (seenByFullPath.has(fullPath)) {\n const winningFilename = seenByFullPath.get(fullPath);\n console.warn(\n `[Analog] Route collision: '${fullPath}' is defined by both ` +\n `'${winningFilename}' and '${filename}'. ` +\n `Keeping '${winningFilename}' based on route source precedence and skipping duplicate.`,\n );\n continue;\n }\n seenByFullPath.set(fullPath, filename);\n\n routes.push({\n id,\n path: fullPath,\n fullPath,\n params,\n filename,\n schemas,\n kind: filename.endsWith('.md') ? 'content' : 'page',\n parentId: null,\n children: [],\n isIndex: id === '/index' || id.endsWith('/index'),\n isGroup: id.includes('/(') || /^\\/*\\(/.test(id),\n isCatchAll: params.some((param) => param.type === 'catchAll'),\n isOptionalCatchAll: params.some(\n (param) => param.type === 'optionalCatchAll',\n ),\n });\n }\n\n routes.sort((a, b) => {\n const aW = getRouteWeight(a.fullPath);\n const bW = getRouteWeight(b.fullPath);\n if (aW !== bW) return aW - bW;\n return a.fullPath.localeCompare(b.fullPath);\n });\n\n const routeByFullPath = new Map(\n routes.map((route) => [route.fullPath, route]),\n );\n\n for (const route of routes) {\n const parent = findNearestParentRoute(route.fullPath, routeByFullPath);\n route.parentId = parent?.id ?? null;\n route.path = computeLocalPath(route.fullPath, parent?.fullPath ?? null);\n }\n\n const routeById = new Map(routes.map((route) => [route.id, route]));\n for (const route of routes) {\n if (route.parentId) {\n routeById.get(route.parentId)?.children.push(route.id);\n }\n }\n\n for (const route of routes) {\n if (route.schemas.hasParamsSchema && route.params.length === 0) {\n console.warn(\n `[Analog] Route '${route.fullPath}' exports routeParamsSchema` +\n ` but has no dynamic params in the filename.`,\n );\n }\n }\n\n // Build-time consistency check: every parentId and child reference must\n // point to a real route in the manifest. Invalid references indicate a\n // bug in the hierarchy computation.\n for (const route of routes) {\n if (route.parentId && !routeById.has(route.parentId)) {\n console.warn(\n `[Analog] Route '${route.id}' has parentId '${route.parentId}' ` +\n `which does not match any route id in the manifest.`,\n );\n }\n for (const childId of route.children) {\n if (!routeById.has(childId)) {\n console.warn(\n `[Analog] Route '${route.id}' lists child '${childId}' ` +\n `which does not match any route id in the manifest.`,\n );\n }\n }\n }\n\n return { routes };\n}\n\nfunction getRouteWeight(path: string): number {\n if (path.includes('[[...')) return 3;\n if (path.includes('[...')) return 2;\n if (path.includes('[')) return 1;\n return 0;\n}\n\nfunction getCollisionPriority(filename: string): number {\n if (\n filename.includes('/src/app/pages/') ||\n filename.includes('/src/app/routes/') ||\n filename.includes('/app/pages/') ||\n filename.includes('/app/routes/') ||\n filename.includes('/src/content/')\n ) {\n return 0;\n }\n\n return 1;\n}\n\n/**\n * Produces a human-readable summary of the generated route manifest.\n */\nexport function formatManifestSummary(manifest: RouteManifest): string {\n const lines: string[] = [];\n const total = manifest.routes.length;\n const withSchemas = manifest.routes.filter(\n (r) => r.schemas.hasParamsSchema || r.schemas.hasQuerySchema,\n ).length;\n const staticCount = manifest.routes.filter(\n (r) => r.params.length === 0,\n ).length;\n const dynamicCount = total - staticCount;\n\n lines.push(`[Analog] Generated typed routes:`);\n lines.push(\n ` ${total} routes (${staticCount} static, ${dynamicCount} dynamic)`,\n );\n if (withSchemas > 0) {\n lines.push(` ${withSchemas} with schema validation`);\n }\n\n for (const route of manifest.routes) {\n const flags: string[] = [];\n if (route.schemas.hasParamsSchema) flags.push('params-schema');\n if (route.schemas.hasQuerySchema) flags.push('query-schema');\n const suffix = flags.length > 0 ? ` [${flags.join(', ')}]` : '';\n lines.push(` ${route.fullPath}${suffix}`);\n }\n\n return lines.join('\\n');\n}\n\n/**\n * Generates the route-table section for the combined generated route module.\n */\nexport function generateRouteTableDeclaration(manifest: RouteManifest): string {\n const lines: string[] = [];\n const hasAnySchema = manifest.routes.some(\n (r) => r.schemas.hasParamsSchema || r.schemas.hasQuerySchema,\n );\n\n lines.push('// This file is auto-generated by @analogjs/platform');\n lines.push('// Do not edit manually');\n lines.push('');\n\n if (hasAnySchema) {\n lines.push(\n \"import type { StandardSchemaV1 } from '@standard-schema/spec';\",\n );\n }\n\n const schemaImports = new Map<string, string>();\n let aliasIndex = 0;\n\n for (const route of manifest.routes) {\n if (route.schemas.hasParamsSchema || route.schemas.hasQuerySchema) {\n const importPath = filenameToImportPath(route.filename);\n const names: string[] = [];\n\n if (route.schemas.hasParamsSchema) {\n const alias = `_p${aliasIndex}`;\n names.push(`routeParamsSchema as ${alias}`);\n schemaImports.set(`${route.fullPath}:params`, alias);\n }\n if (route.schemas.hasQuerySchema) {\n const alias = `_q${aliasIndex}`;\n names.push(`routeQuerySchema as ${alias}`);\n schemaImports.set(`${route.fullPath}:query`, alias);\n }\n\n lines.push(`import type { ${names.join(', ')} } from '${importPath}';`);\n aliasIndex++;\n }\n }\n\n if (hasAnySchema) {\n lines.push('');\n }\n\n lines.push(\"declare module '@analogjs/router' {\");\n lines.push(' interface AnalogRouteTable {');\n\n for (const route of manifest.routes) {\n const paramsAlias = schemaImports.get(`${route.fullPath}:params`);\n const queryAlias = schemaImports.get(`${route.fullPath}:query`);\n\n const paramsType = generateParamsType(route.params);\n const queryType = 'Record<string, string | string[] | undefined>';\n\n const paramsOutputType = paramsAlias\n ? `StandardSchemaV1.InferOutput<typeof ${paramsAlias}>`\n : paramsType;\n const queryOutputType = queryAlias\n ? `StandardSchemaV1.InferOutput<typeof ${queryAlias}>`\n : queryType;\n\n lines.push(` '${route.fullPath}': {`);\n lines.push(` params: ${paramsType};`);\n lines.push(` paramsOutput: ${paramsOutputType};`);\n lines.push(` query: ${queryType};`);\n lines.push(` queryOutput: ${queryOutputType};`);\n lines.push(` };`);\n }\n\n lines.push(' }');\n lines.push('}');\n lines.push('');\n lines.push('export {};');\n lines.push('');\n\n return lines.join('\\n');\n}\n\n/**\n * Generates the route-tree section for the combined generated route module.\n */\nexport function generateRouteTreeDeclaration(\n manifest: RouteManifest,\n options: GenerateRouteTreeDeclarationOptions = {},\n): string {\n const lines: string[] = [];\n const jsonLdPaths = new Set(options.jsonLdPaths ?? []);\n\n lines.push('// This file is auto-generated by @analogjs/platform');\n lines.push('// Do not edit manually');\n lines.push('');\n lines.push('export interface AnalogGeneratedRouteRecord<');\n lines.push(' TId extends string = string,');\n lines.push(' TPath extends string = string,');\n lines.push(' TFullPath extends string = string,');\n lines.push(' TParentId extends string | null = string | null,');\n lines.push(' TChildren extends readonly string[] = readonly string[],');\n lines.push('> {');\n lines.push(' id: TId;');\n lines.push(' path: TPath;');\n lines.push(' fullPath: TFullPath;');\n lines.push(' parentId: TParentId;');\n lines.push(' children: TChildren;');\n lines.push(' sourceFile: string;');\n lines.push(\" kind: 'page' | 'content';\");\n lines.push(' hasParamsSchema: boolean;');\n lines.push(' hasQuerySchema: boolean;');\n lines.push(' hasJsonLd: boolean;');\n lines.push(' isIndex: boolean;');\n lines.push(' isGroup: boolean;');\n lines.push(' isCatchAll: boolean;');\n lines.push(' isOptionalCatchAll: boolean;');\n lines.push('}');\n lines.push('');\n lines.push('export interface AnalogFileRoutesById {');\n for (const route of manifest.routes) {\n lines.push(\n ` ${toTsKey(route.id)}: AnalogGeneratedRouteRecord<${toTsStringLiteral(route.id)}, ${toTsStringLiteral(route.path)}, ${toTsStringLiteral(route.fullPath)}, ${route.parentId ? toTsStringLiteral(route.parentId) : 'null'}, ${toReadonlyTupleType(route.children)}>;`,\n );\n }\n lines.push('}');\n lines.push('');\n lines.push('export interface AnalogFileRoutesByFullPath {');\n for (const route of manifest.routes) {\n lines.push(\n ` ${toTsKey(route.fullPath)}: AnalogFileRoutesById[${toTsStringLiteral(route.id)}];`,\n );\n }\n lines.push('}');\n lines.push('');\n lines.push('export type AnalogRouteTreeId = keyof AnalogFileRoutesById;');\n lines.push(\n 'export type AnalogRouteTreeFullPath = keyof AnalogFileRoutesByFullPath;',\n );\n lines.push('');\n lines.push('export const analogRouteTree = {');\n lines.push(' byId: {');\n for (const route of manifest.routes) {\n lines.push(` ${toObjectKey(route.id)}: {`);\n lines.push(` id: ${toTsStringLiteral(route.id)},`);\n lines.push(` path: ${toTsStringLiteral(route.path)},`);\n lines.push(` fullPath: ${toTsStringLiteral(route.fullPath)},`);\n lines.push(\n ` parentId: ${route.parentId ? toTsStringLiteral(route.parentId) : 'null'},`,\n );\n lines.push(` children: ${toReadonlyTupleValue(route.children)},`);\n lines.push(` sourceFile: ${toTsStringLiteral(route.filename)},`);\n lines.push(` kind: ${toTsStringLiteral(route.kind)},`);\n lines.push(\n ` hasParamsSchema: ${String(route.schemas.hasParamsSchema)},`,\n );\n lines.push(\n ` hasQuerySchema: ${String(route.schemas.hasQuerySchema)},`,\n );\n lines.push(` hasJsonLd: ${String(jsonLdPaths.has(route.fullPath))},`);\n lines.push(` isIndex: ${String(route.isIndex)},`);\n lines.push(` isGroup: ${String(route.isGroup)},`);\n lines.push(` isCatchAll: ${String(route.isCatchAll)},`);\n lines.push(\n ` isOptionalCatchAll: ${String(route.isOptionalCatchAll)},`,\n );\n lines.push(\n ` } satisfies AnalogFileRoutesById[${toTsStringLiteral(route.id)}],`,\n );\n }\n lines.push(' },');\n lines.push(' byFullPath: {');\n for (const route of manifest.routes) {\n lines.push(\n ` ${toObjectKey(route.fullPath)}: ${toTsStringLiteral(route.id)},`,\n );\n }\n lines.push(' },');\n lines.push('} as const;');\n lines.push('');\n\n return lines.join('\\n');\n}\n\nfunction filenameToImportPath(filename: string): string {\n const stripped = filename.replace(/^\\//, '').replace(/\\.ts$/, '');\n return '../' + stripped;\n}\n\nfunction generateParamsType(params: RouteParamInfo[]): string {\n if (params.length === 0) return 'Record<string, never>';\n\n const entries = params.map((p) => {\n const key = isValidIdentifier(p.name) ? p.name : `'${p.name}'`;\n switch (p.type) {\n case 'dynamic':\n return `${key}: string`;\n case 'catchAll':\n return `${key}: string[]`;\n case 'optionalCatchAll':\n return `${key}?: string[]`;\n }\n });\n\n return `{ ${entries.join('; ')} }`;\n}\n\nfunction isValidIdentifier(name: string): boolean {\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name);\n}\n\nfunction findNearestParentRoute(\n fullPath: string,\n routesByFullPath: Map<string, RouteEntry>,\n): RouteEntry | undefined {\n if (fullPath === '/') {\n return undefined;\n }\n\n const segments = fullPath.slice(1).split('/');\n for (let index = segments.length - 1; index > 0; index--) {\n const candidate = '/' + segments.slice(0, index).join('/');\n const route = routesByFullPath.get(candidate);\n if (route) {\n return route;\n }\n }\n\n return undefined;\n}\n\nfunction computeLocalPath(\n fullPath: string,\n parentFullPath: string | null,\n): string {\n if (fullPath === '/') {\n return '/';\n }\n\n if (!parentFullPath) {\n return fullPath.slice(1);\n }\n\n const suffix = fullPath.slice(parentFullPath.length).replace(/^\\/+/, '');\n return suffix || '/';\n}\n\nfunction toTsStringLiteral(value: string): string {\n return JSON.stringify(value);\n}\n\nfunction toTsKey(value: string): string {\n return toTsStringLiteral(value);\n}\n\nfunction toObjectKey(value: string): string {\n return isValidIdentifier(value) ? value : toTsStringLiteral(value);\n}\n\nfunction toReadonlyTupleType(values: readonly string[]): string {\n if (values.length === 0) {\n return 'readonly []';\n }\n\n return `readonly [${values.map((value) => toTsStringLiteral(value)).join(', ')}]`;\n}\n\nfunction toReadonlyTupleValue(values: readonly string[]): string {\n if (values.length === 0) {\n return '[] as const';\n }\n\n return `[${values.map((value) => toTsStringLiteral(value)).join(', ')}] as const`;\n}\n\n// --- JSON-LD utilities ---\n\nexport type JsonLdObject = Record<string, unknown>;\n\nexport function isJsonLdObject(value: unknown): value is JsonLdObject {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nexport function normalizeJsonLd(value: unknown): JsonLdObject[] {\n if (Array.isArray(value)) {\n return value.filter(isJsonLdObject);\n }\n\n return isJsonLdObject(value) ? [value] : [];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiFA,SAAgB,oBAAoB,UAA0B;CAC5D,IAAI,OAAO,SAAS,QAClB,+KACA,GACD;CAED,MAAM,WAAqB,EAAE;AAC7B,QAAO,KAAK,QAAQ,6BAA6B,UAAU;AACzD,WAAS,KAAK,MAAM;AAEpB,SAAO,MAAM,SAAS,SAAS,EAAE;GACjC;A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ADe,SAAS,MAAM,eAAe,OAAO,CAAC,QAAQ,QAAQ,GAAG,IACvD;;AAGnB,SAAS,kBAAkB,OAAuB;AAChD,QAAO,KAAK,UAAU,MAAM;;AAG9B,SAAS,QAAQ,OAAuB;AACtC,QAAO,kBAAkB,MAAM;;AAGjC,SAAS,YAAY,OAAuB;AAC1C,QAAO,kBAAkB,MAAM,GAAG,QAAQ,kBAAkB,MAAM;;AAGpE,SAAS,oBAAoB,QAAmC;AAC9D,KAAI,OAAO,WAAW,EACpB,QAAO;AAGT,QAAO,aAAa,OAAO,KAAK,UAAU,kBAAkB,MAAM,CAAC,CAAC,KAAK,KAAK,CAAC;;AAGjF,SAAS,qBAAqB,QAAmC;AAC/D,KAAI,OAAO,WAAW,EACpB,QAAO;AAGT,QAAO,IAAI,OAAO,KAAK,UAAU,kBAAkB,MAAM,CAAC,CAAC,KAAK,KAAK,CAAC;;AAOxE,SAAgB,eAAe,OAAuC;AACpE,QAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,MAAM;;AAG7E,SAAgB,gBAAgB,OAAgC;AAC9D,KAAI,MAAM,QAAQ,MAAM,CACtB,QAAO,MAAM,OAAO,eAAe;AAGrC,QAAO,eAAe,MAAM,GAAG,CAAC,MAAM,GAAG,EAAE"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { Plugin } from
|
|
2
|
-
import { Options } from
|
|
1
|
+
import { Plugin } from "vite";
|
|
2
|
+
import { Options } from "./options.js";
|
|
3
3
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
* Router plugin that handles route file discovery and hot module replacement.
|
|
5
|
+
*
|
|
6
|
+
* This plugin provides three main functionalities:
|
|
7
|
+
* 1. Route invalidation when files are added/deleted (HMR workaround)
|
|
8
|
+
* 2. Dynamic route file discovery and import generation
|
|
9
|
+
* 3. Content route file discovery for markdown and Analog content
|
|
10
|
+
*
|
|
11
|
+
* @param options Configuration options for the router plugin
|
|
12
|
+
* @returns Array of Vite plugins for route handling
|
|
13
|
+
*
|
|
14
|
+
* IMPORTANT: This plugin uses tinyglobby for file discovery.
|
|
15
|
+
* Key behavior with { dot: true, absolute: true }:
|
|
16
|
+
* - Returns absolute paths for ALL discovered files
|
|
17
|
+
* - Path normalization is required to match expected output format
|
|
18
|
+
* - Files within project root must use relative paths in object keys
|
|
19
|
+
* - Files outside project root keep absolute paths in object keys
|
|
20
|
+
*/
|
|
21
21
|
export declare function routerPlugin(options?: Options): Plugin[];
|