@analogjs/platform 3.0.0-alpha.2 → 3.0.0-alpha.21
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 +16 -18
- 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 +120 -0
- package/src/lib/route-manifest.js +411 -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
|
@@ -1,198 +1,180 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { getBundleOptionsKey } from "./utils/rolldown.js";
|
|
2
|
+
import * as vite from "vite";
|
|
3
|
+
import { globSync } from "tinyglobby";
|
|
4
|
+
import { relative, resolve } from "node:path";
|
|
5
|
+
import { readFileSync } from "node:fs";
|
|
6
|
+
//#region packages/platform/src/lib/content-plugin.ts
|
|
5
7
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
const loadLanguages = await import('prismjs/components/index.js');
|
|
176
|
-
loadLanguages.default(langs);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
const fm = await import('front-matter');
|
|
180
|
-
// The `default` property will be available in CommonJS environment, for instance,
|
|
181
|
-
// when running unit tests. It's safe to retrieve `default` first, since we still
|
|
182
|
-
// fallback to the original implementation.
|
|
183
|
-
const frontmatterFn = fm.default || fm;
|
|
184
|
-
const fileContents = readFileSync(id.split('?')[0], 'utf8');
|
|
185
|
-
const { body, frontmatter } = frontmatterFn(fileContents);
|
|
186
|
-
// parse markdown and highlight
|
|
187
|
-
const { getMarkedSetup } = await import('./content/marked/index.js');
|
|
188
|
-
const markedSetupService = getMarkedSetup({ mangle: true, ...(markedOptions || {}) }, markedHighlighter);
|
|
189
|
-
const mdContent = (await markedSetupService
|
|
190
|
-
.getMarkedInstance()
|
|
191
|
-
.parse(body));
|
|
192
|
-
return `export default ${JSON.stringify(`---\n${frontmatter}\n---\n\n${mdContent}`)}`;
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
...contentDiscoveryPlugins,
|
|
196
|
-
];
|
|
8
|
+
* Content plugin that provides markdown and content file processing for Analog.
|
|
9
|
+
*
|
|
10
|
+
* IMPORTANT: This plugin uses tinyglobby for file discovery.
|
|
11
|
+
* Key pitfall with { dot: true }:
|
|
12
|
+
* - Returns relative paths from cwd (e.g., "apps/blog-app/src/content/...")
|
|
13
|
+
* - These paths CANNOT be used directly in ES module imports
|
|
14
|
+
* - Relative paths without ./ or ../ are treated as package names
|
|
15
|
+
* - Must convert to absolute paths for imports to work correctly
|
|
16
|
+
*/
|
|
17
|
+
function contentPlugin({ highlighter, markedOptions, shikiOptions, prismOptions } = {}, options) {
|
|
18
|
+
const cache = /* @__PURE__ */ new Map();
|
|
19
|
+
let contentFilesListCache;
|
|
20
|
+
let markedHighlighter;
|
|
21
|
+
const workspaceRoot = vite.normalizePath(options?.workspaceRoot ?? process.env["NX_WORKSPACE_ROOT"] ?? process.cwd());
|
|
22
|
+
let config;
|
|
23
|
+
let root;
|
|
24
|
+
let contentRootDirs;
|
|
25
|
+
const normalizeContentDir = (dir) => {
|
|
26
|
+
const normalized = vite.normalizePath(dir.startsWith("/") ? `${workspaceRoot}${dir}` : resolve(workspaceRoot, dir));
|
|
27
|
+
return normalized.endsWith("/") ? normalized.slice(0, -1) : normalized;
|
|
28
|
+
};
|
|
29
|
+
const initContentRootDirs = () => {
|
|
30
|
+
contentRootDirs = [vite.normalizePath(`${root}/src/content`), ...(options?.additionalContentDirs || []).map(normalizeContentDir)];
|
|
31
|
+
};
|
|
32
|
+
const discoverContentFilesList = () => {
|
|
33
|
+
contentFilesListCache ??= globSync(contentRootDirs.map((dir) => `${dir}/**/*.md`), { dot: true });
|
|
34
|
+
return contentFilesListCache;
|
|
35
|
+
};
|
|
36
|
+
const resolveContentModulePath = (module) => vite.normalizePath(module.startsWith("/") ? module : `${workspaceRoot}/${module}`);
|
|
37
|
+
const getContentModuleKey = (module) => {
|
|
38
|
+
const absolutePath = resolveContentModulePath(module);
|
|
39
|
+
const relativeToRoot = vite.normalizePath(relative(root, absolutePath));
|
|
40
|
+
return !relativeToRoot.startsWith("..") && !relativeToRoot.startsWith("/") ? `/${relativeToRoot}` : `/${vite.normalizePath(relative(workspaceRoot, absolutePath))}`;
|
|
41
|
+
};
|
|
42
|
+
const contentDiscoveryPlugins = [{
|
|
43
|
+
name: "analog-content-glob-routes",
|
|
44
|
+
config(_config) {
|
|
45
|
+
config = _config;
|
|
46
|
+
root = vite.normalizePath(resolve(workspaceRoot, config.root || ".") || ".");
|
|
47
|
+
initContentRootDirs();
|
|
48
|
+
},
|
|
49
|
+
transform: {
|
|
50
|
+
filter: { code: "ANALOG_CONTENT_FILE_LIST" },
|
|
51
|
+
handler(code) {
|
|
52
|
+
if (code.includes("ANALOG_CONTENT_FILE_LIST")) {
|
|
53
|
+
const contentFilesList = discoverContentFilesList();
|
|
54
|
+
const eagerImports = [];
|
|
55
|
+
contentFilesList.forEach((module, index) => {
|
|
56
|
+
const absolutePath = resolveContentModulePath(module);
|
|
57
|
+
eagerImports.push(`import { default as analog_module_${index} } from "${absolutePath}?analog-content-list=true";`);
|
|
58
|
+
});
|
|
59
|
+
let result = code.replace("const ANALOG_CONTENT_FILE_LIST = {};", `
|
|
60
|
+
let ANALOG_CONTENT_FILE_LIST = {${contentFilesList.map((module, index) => `"${getContentModuleKey(module)}": analog_module_${index}`)}};
|
|
61
|
+
`);
|
|
62
|
+
if (!code.includes("analog_module_")) result = `${eagerImports.join("\n")}\n${result}`;
|
|
63
|
+
return {
|
|
64
|
+
code: result,
|
|
65
|
+
map: { mappings: "" }
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
name: "analogjs-invalidate-content-dirs",
|
|
72
|
+
configureServer(server) {
|
|
73
|
+
function invalidateContent(path) {
|
|
74
|
+
const normalizedPath = vite.normalizePath(path);
|
|
75
|
+
if (contentRootDirs.some((dir) => normalizedPath === dir || normalizedPath.startsWith(`${dir}/`))) {
|
|
76
|
+
contentFilesListCache = void 0;
|
|
77
|
+
server.moduleGraph.fileToModulesMap.forEach((mods) => {
|
|
78
|
+
mods.forEach((mod) => {
|
|
79
|
+
if (mod.id?.includes("analogjs") && mod.id?.includes("content")) {
|
|
80
|
+
server.moduleGraph.invalidateModule(mod);
|
|
81
|
+
mod.importers.forEach((imp) => {
|
|
82
|
+
server.moduleGraph.invalidateModule(imp);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
server.ws.send({ type: "full-reload" });
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
server.watcher.on("add", invalidateContent);
|
|
91
|
+
server.watcher.on("unlink", invalidateContent);
|
|
92
|
+
}
|
|
93
|
+
}];
|
|
94
|
+
if (!highlighter) return [
|
|
95
|
+
{
|
|
96
|
+
name: "analogjs-external-content",
|
|
97
|
+
config() {
|
|
98
|
+
return { build: { [getBundleOptionsKey()]: { external: ["@analogjs/content"] } } };
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: "analogjs-exclude-content-import",
|
|
103
|
+
transform: {
|
|
104
|
+
filter: { code: "@analogjs/content" },
|
|
105
|
+
handler(code) {
|
|
106
|
+
/**
|
|
107
|
+
* Remove the package so it doesn't get
|
|
108
|
+
* referenced when building for serverless
|
|
109
|
+
* functions.
|
|
110
|
+
*/
|
|
111
|
+
if (code.includes(`import('@analogjs/content')`)) return { code: code.replace(`import('@analogjs/content')`, "Promise.resolve({})") };
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
...contentDiscoveryPlugins
|
|
116
|
+
];
|
|
117
|
+
return [
|
|
118
|
+
{
|
|
119
|
+
name: "analogjs-content-frontmatter",
|
|
120
|
+
transform: {
|
|
121
|
+
filter: { id: /analog-content-list=true/ },
|
|
122
|
+
async handler(code, id) {
|
|
123
|
+
const cachedContent = cache.get(id);
|
|
124
|
+
if (cachedContent?.code === code) return {
|
|
125
|
+
code: `export default ${cachedContent.attributes}`,
|
|
126
|
+
moduleSideEffects: false
|
|
127
|
+
};
|
|
128
|
+
const fm = await import("front-matter");
|
|
129
|
+
const { attributes } = (fm.default || fm)(readFileSync(id.split("?")[0], "utf8"));
|
|
130
|
+
const content = {
|
|
131
|
+
code,
|
|
132
|
+
attributes: JSON.stringify(attributes)
|
|
133
|
+
};
|
|
134
|
+
cache.set(id, content);
|
|
135
|
+
return {
|
|
136
|
+
code: `export default ${content.attributes}`,
|
|
137
|
+
moduleSideEffects: false
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: "analogjs-content-file",
|
|
144
|
+
enforce: "post",
|
|
145
|
+
async load(id) {
|
|
146
|
+
if (!id.includes("analog-content-file=true")) return;
|
|
147
|
+
if (!markedHighlighter) if (highlighter === "shiki") {
|
|
148
|
+
const { getShikiHighlighter } = await import("./content/shiki/index.js");
|
|
149
|
+
markedHighlighter = getShikiHighlighter(shikiOptions);
|
|
150
|
+
} else {
|
|
151
|
+
const { getPrismHighlighter } = await import("./content/prism/index.js");
|
|
152
|
+
markedHighlighter = getPrismHighlighter();
|
|
153
|
+
const langs = [
|
|
154
|
+
"bash",
|
|
155
|
+
"css",
|
|
156
|
+
"javascript",
|
|
157
|
+
"json",
|
|
158
|
+
"markup",
|
|
159
|
+
"typescript"
|
|
160
|
+
];
|
|
161
|
+
if (Array.isArray(prismOptions?.additionalLangs) && prismOptions?.additionalLangs?.length > 0) langs.push(...prismOptions.additionalLangs);
|
|
162
|
+
(await import("prismjs/components/index.js")).default(langs);
|
|
163
|
+
}
|
|
164
|
+
const fm = await import("front-matter");
|
|
165
|
+
const { body, frontmatter } = (fm.default || fm)(readFileSync(id.split("?")[0], "utf8"));
|
|
166
|
+
const { getMarkedSetup } = await import("./content/marked/index.js");
|
|
167
|
+
const mdContent = await getMarkedSetup({
|
|
168
|
+
mangle: true,
|
|
169
|
+
...markedOptions || {}
|
|
170
|
+
}, markedHighlighter).getMarkedInstance().parse(body);
|
|
171
|
+
return `export default ${JSON.stringify(`---\n${frontmatter}\n---\n\n${mdContent}`)}`;
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
...contentDiscoveryPlugins
|
|
175
|
+
];
|
|
197
176
|
}
|
|
198
|
-
//#
|
|
177
|
+
//#endregion
|
|
178
|
+
export { contentPlugin };
|
|
179
|
+
|
|
180
|
+
//# sourceMappingURL=content-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-plugin.js","names":[],"sources":["../../../src/lib/content-plugin.ts"],"sourcesContent":["import * as vite from 'vite';\nimport { readFileSync } from 'node:fs';\nimport { relative, resolve } from 'node:path';\nimport { globSync } from 'tinyglobby';\n\nimport type { WithShikiHighlighterOptions } from './content/shiki/options.js';\nimport type { MarkedContentHighlighter } from './content/marked/marked-content-highlighter.js';\nimport type { WithPrismHighlighterOptions } from './content/prism/options.js';\nimport type { WithMarkedOptions } from './content/marked/index.js';\nimport type { Options } from './options.js';\nimport { getBundleOptionsKey } from './utils/rolldown.js';\n\ninterface Content {\n code: string;\n attributes: string;\n}\n\nexport type ContentPluginOptions = {\n highlighter?: 'shiki' | 'prism';\n markedOptions?: WithMarkedOptions;\n shikiOptions?: WithShikiHighlighterOptions;\n prismOptions?: WithPrismHighlighterOptions;\n};\n\n/**\n * Content plugin that provides markdown and content file processing for Analog.\n *\n * IMPORTANT: This plugin uses tinyglobby for file discovery.\n * Key pitfall with { dot: true }:\n * - Returns relative paths from cwd (e.g., \"apps/blog-app/src/content/...\")\n * - These paths CANNOT be used directly in ES module imports\n * - Relative paths without ./ or ../ are treated as package names\n * - Must convert to absolute paths for imports to work correctly\n */\nexport function contentPlugin(\n {\n highlighter,\n markedOptions,\n shikiOptions,\n prismOptions,\n }: ContentPluginOptions = {},\n options?: Options,\n): vite.Plugin[] {\n const cache = new Map<string, Content>();\n // The content list placeholder can be transformed several times during serve.\n // Caching the discovered markdown paths keeps those repeat passes cheap.\n let contentFilesListCache: string[] | undefined;\n\n let markedHighlighter: MarkedContentHighlighter;\n const workspaceRoot = vite.normalizePath(\n options?.workspaceRoot ?? process.env['NX_WORKSPACE_ROOT'] ?? process.cwd(),\n );\n let config: vite.UserConfig;\n let root: string;\n // Keep discovery and invalidation aligned by deriving both from the same\n // normalized content roots. That way external content dirs participate in\n // cache busting exactly the same way they participate in glob discovery.\n // Initialized once in the `config` hook after `root` is resolved — all\n // inputs (`root`, `workspaceRoot`, `options`) are stable after that point.\n let contentRootDirs: string[];\n const normalizeContentDir = (dir: string) => {\n const normalized = vite.normalizePath(\n dir.startsWith('/')\n ? `${workspaceRoot}${dir}`\n : resolve(workspaceRoot, dir),\n );\n return normalized.endsWith('/') ? normalized.slice(0, -1) : normalized;\n };\n const initContentRootDirs = () => {\n contentRootDirs = [\n vite.normalizePath(`${root}/src/content`),\n ...(options?.additionalContentDirs || []).map(normalizeContentDir),\n ];\n };\n const discoverContentFilesList = () => {\n contentFilesListCache ??= globSync(\n contentRootDirs.map((dir) => `${dir}/**/*.md`),\n { dot: true },\n );\n\n return contentFilesListCache;\n };\n const resolveContentModulePath = (module: string) =>\n vite.normalizePath(\n module.startsWith('/') ? module : `${workspaceRoot}/${module}`,\n );\n const getContentModuleKey = (module: string) => {\n const absolutePath = resolveContentModulePath(module);\n const relativeToRoot = vite.normalizePath(relative(root, absolutePath));\n // `startsWith(root)` is not safe here because sibling directories such as\n // `/apps/my-app-tools` also start with `/apps/my-app`. A relative path only\n // represents in-app content when it stays within `root`.\n const isInApp =\n !relativeToRoot.startsWith('..') && !relativeToRoot.startsWith('/');\n\n // Both branches prepend `/` so generated keys are always absolute-\n // looking (`/src/content/...` for in-app, `/libs/shared/...` for\n // workspace-external). Downstream consumers like content-files-token\n // rely on the leading `/` for slug extraction regexes.\n return isInApp\n ? `/${relativeToRoot}`\n : `/${vite.normalizePath(relative(workspaceRoot, absolutePath))}`;\n };\n\n const contentDiscoveryPlugins: vite.Plugin[] = [\n {\n name: 'analog-content-glob-routes',\n config(_config) {\n config = _config;\n root = vite.normalizePath(\n resolve(workspaceRoot, config.root || '.') || '.',\n );\n initContentRootDirs();\n },\n // Vite 8 / Rolldown \"filtered transform\" — the `filter.code` string\n // tells the bundler to skip this handler entirely for modules whose\n // source does not contain the substring, avoiding unnecessary JS→Rust\n // round-trips. The inner `code.includes()` guard is kept for Vite 7\n // compat where filters are not evaluated by the bundler.\n transform: {\n filter: {\n code: 'ANALOG_CONTENT_FILE_LIST',\n },\n handler(code) {\n if (code.includes('ANALOG_CONTENT_FILE_LIST')) {\n const contentFilesList = discoverContentFilesList();\n\n const eagerImports: string[] = [];\n\n contentFilesList.forEach((module, index) => {\n // CRITICAL: tinyglobby returns relative paths like \"apps/blog-app/src/content/file.md\"\n // These MUST be converted to absolute paths for ES module imports\n // Otherwise Node.js treats \"apps\" as a package name and throws \"Cannot find package 'apps'\"\n const absolutePath = resolveContentModulePath(module);\n eagerImports.push(\n `import { default as analog_module_${index} } from \"${absolutePath}?analog-content-list=true\";`,\n );\n });\n\n let result = code.replace(\n 'const ANALOG_CONTENT_FILE_LIST = {};',\n `\n let ANALOG_CONTENT_FILE_LIST = {${contentFilesList.map(\n (module, index) =>\n `\"${getContentModuleKey(module)}\": analog_module_${index}`,\n )}};\n `,\n );\n\n if (!code.includes('analog_module_')) {\n result = `${eagerImports.join('\\n')}\\n${result}`;\n }\n\n return {\n code: result,\n map: { mappings: '' },\n };\n }\n\n return;\n },\n },\n },\n {\n name: 'analogjs-invalidate-content-dirs',\n configureServer(server) {\n function invalidateContent(path: string) {\n const normalizedPath = vite.normalizePath(path);\n const isContentPath = contentRootDirs.some(\n (dir) =>\n normalizedPath === dir || normalizedPath.startsWith(`${dir}/`),\n );\n\n if (isContentPath) {\n // The file set only changes on add/remove because this watcher is\n // intentionally scoped to those events. Clear the list cache so the\n // next transform sees the updated directory contents.\n contentFilesListCache = undefined;\n server.moduleGraph.fileToModulesMap.forEach((mods) => {\n mods.forEach((mod) => {\n if (\n mod.id?.includes('analogjs') &&\n mod.id?.includes('content')\n ) {\n server.moduleGraph.invalidateModule(mod);\n\n mod.importers.forEach((imp) => {\n server.moduleGraph.invalidateModule(imp);\n });\n }\n });\n });\n\n server.ws.send({\n type: 'full-reload',\n });\n }\n }\n\n server.watcher.on('add', invalidateContent);\n server.watcher.on('unlink', invalidateContent);\n },\n },\n ];\n\n if (!highlighter) {\n return [\n {\n name: 'analogjs-external-content',\n config() {\n const bundleOptionsKey = getBundleOptionsKey();\n return {\n build: {\n [bundleOptionsKey]: {\n external: ['@analogjs/content'],\n },\n },\n };\n },\n },\n {\n name: 'analogjs-exclude-content-import',\n transform: {\n filter: {\n code: '@analogjs/content',\n },\n handler(code) {\n /**\n * Remove the package so it doesn't get\n * referenced when building for serverless\n * functions.\n */\n if (code.includes(`import('@analogjs/content')`)) {\n return {\n code: code.replace(\n `import('@analogjs/content')`,\n 'Promise.resolve({})',\n ),\n };\n }\n\n return;\n },\n },\n },\n ...contentDiscoveryPlugins,\n ];\n }\n\n return [\n {\n name: 'analogjs-content-frontmatter',\n // Filter by module ID so only `?analog-content-list=true` virtual\n // imports enter the handler. Returns `moduleSideEffects: false` so\n // Rolldown can tree-shake unused content list entries.\n transform: {\n filter: {\n id: /analog-content-list=true/,\n },\n async handler(code, id) {\n const cachedContent = cache.get(id);\n // There's no reason to run `readFileSync` and frontmatter parsing if the\n // `transform` hook is called with the same code. In such cases, we can simply\n // return the cached attributes, which is faster than repeatedly reading files\n // synchronously during the build process.\n if (cachedContent?.code === code) {\n return {\n code: `export default ${cachedContent.attributes}`,\n moduleSideEffects: false,\n };\n }\n\n const fm: any = await import('front-matter');\n // The `default` property will be available in CommonJS environment, for instance,\n // when running unit tests. It's safe to retrieve `default` first, since we still\n // fallback to the original implementation.\n const frontmatter = fm.default || fm;\n const fileContents = readFileSync(id.split('?')[0], 'utf8');\n const { attributes } = frontmatter(fileContents);\n const content = {\n code,\n attributes: JSON.stringify(attributes),\n };\n cache.set(id, content);\n\n return {\n code: `export default ${content.attributes}`,\n moduleSideEffects: false,\n };\n },\n },\n },\n {\n name: 'analogjs-content-file',\n enforce: 'post',\n async load(id) {\n if (!id.includes('analog-content-file=true')) {\n return;\n }\n\n if (!markedHighlighter) {\n if (highlighter === 'shiki') {\n const { getShikiHighlighter } =\n await import('./content/shiki/index.js');\n markedHighlighter = getShikiHighlighter(shikiOptions);\n } else {\n const { getPrismHighlighter } =\n await import('./content/prism/index.js');\n markedHighlighter = getPrismHighlighter();\n\n const langs = [\n 'bash',\n 'css',\n 'javascript',\n 'json',\n 'markup',\n 'typescript',\n ];\n\n if (\n Array.isArray(prismOptions?.additionalLangs) &&\n prismOptions?.additionalLangs?.length > 0\n ) {\n langs.push(...prismOptions.additionalLangs);\n }\n\n const loadLanguages = await import('prismjs/components/index.js');\n\n (\n loadLanguages as unknown as { default: (...args: any[]) => any }\n ).default(langs);\n }\n }\n\n const fm: any = await import('front-matter');\n // The `default` property will be available in CommonJS environment, for instance,\n // when running unit tests. It's safe to retrieve `default` first, since we still\n // fallback to the original implementation.\n const frontmatterFn = fm.default || fm;\n const fileContents = readFileSync(id.split('?')[0], 'utf8');\n const { body, frontmatter } = frontmatterFn(fileContents);\n\n // parse markdown and highlight\n const { getMarkedSetup } = await import('./content/marked/index.js');\n const markedSetupService = getMarkedSetup(\n { mangle: true, ...(markedOptions || {}) },\n markedHighlighter,\n );\n const mdContent = (await markedSetupService\n .getMarkedInstance()\n .parse(body)) as unknown as string;\n\n return `export default ${JSON.stringify(\n `---\\n${frontmatter}\\n---\\n\\n${mdContent}`,\n )}`;\n },\n },\n ...contentDiscoveryPlugins,\n ];\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAkCA,SAAgB,cACd,EACE,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AE,MAAM,iBAFQ,GAAG,WAAW,IACf,aAAa,GAAG,MAAM,IAAI,CAAC,IAAI,OAAO,CACF;IAGzD,MAAM,EAAE,mBAAmB,MAAM,OAAO;IAKxC,MAAM,YAAa,MAJQ,eACzB;KAAE,QAAQ;KAAM,GAAI,iBAAiB,EAAE;KAAG,EAC1C,kBACD,CAEE,mBAAmB,CACnB,MAAM,KAAK;AAEd,WAAO,kBAAkB,KAAK,UAC5B,QAAQ,YAAY,WAAW,YAChC;;GAEJ;EACD,GAAG;EACJ"}
|
package/src/lib/deps-plugin.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { Plugin } from
|
|
2
|
-
import { Options } from
|
|
1
|
+
import type { Plugin } from "vite";
|
|
2
|
+
import { Options } from "./options.js";
|
|
3
3
|
export declare function depsPlugin(options?: Options): Plugin[];
|
package/src/lib/deps-plugin.js
CHANGED
|
@@ -1,83 +1,74 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { crawlFrameworkPkgs } from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const pkgConfig = await crawlFrameworkPkgs({
|
|
71
|
-
root: workspaceRoot,
|
|
72
|
-
isBuild: command === 'build',
|
|
73
|
-
viteUserConfig: config,
|
|
74
|
-
isSemiFrameworkPkgByJson(pkgJson) {
|
|
75
|
-
return pkgJson['module'] && pkgJson['module'].includes('fesm');
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
|
-
return pkgConfig;
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
];
|
|
1
|
+
import { getJsTransformConfigKey } from "./utils/rolldown.js";
|
|
2
|
+
import { VERSION } from "@angular/compiler-cli";
|
|
3
|
+
import { crawlFrameworkPkgs } from "vitefu";
|
|
4
|
+
//#region packages/platform/src/lib/deps-plugin.ts
|
|
5
|
+
function depsPlugin(options) {
|
|
6
|
+
const workspaceRoot = options?.workspaceRoot ?? process.env["NX_WORKSPACE_ROOT"] ?? process.cwd();
|
|
7
|
+
const viteOptions = options?.vite === false ? void 0 : options?.vite;
|
|
8
|
+
return [{
|
|
9
|
+
name: "analogjs-deps-plugin",
|
|
10
|
+
config() {
|
|
11
|
+
const useAngularCompilationAPI = options?.experimental?.useAngularCompilationAPI ?? viteOptions?.experimental?.useAngularCompilationAPI;
|
|
12
|
+
const transformConfig = options?.vite === false || useAngularCompilationAPI ? {} : { exclude: ["**/*.ts", "**/*.js"] };
|
|
13
|
+
return {
|
|
14
|
+
[getJsTransformConfigKey()]: transformConfig,
|
|
15
|
+
ssr: { noExternal: [
|
|
16
|
+
"@analogjs/**",
|
|
17
|
+
"firebase/**",
|
|
18
|
+
"firebase-admin/**",
|
|
19
|
+
"rxfire",
|
|
20
|
+
"@ng-web-apis/**",
|
|
21
|
+
"@taiga-ui/**",
|
|
22
|
+
"@tanstack/angular-query-experimental"
|
|
23
|
+
] },
|
|
24
|
+
optimizeDeps: {
|
|
25
|
+
include: [
|
|
26
|
+
"@angular/common",
|
|
27
|
+
"@angular/common/http",
|
|
28
|
+
...Number(VERSION.major) > 15 ? ["@angular/core/rxjs-interop"] : [],
|
|
29
|
+
"front-matter"
|
|
30
|
+
],
|
|
31
|
+
exclude: [
|
|
32
|
+
"@angular/platform-server",
|
|
33
|
+
"@analogjs/content",
|
|
34
|
+
"@analogjs/router",
|
|
35
|
+
"@nx/angular",
|
|
36
|
+
"@nx/vite",
|
|
37
|
+
"@nx/devkit",
|
|
38
|
+
"@nx/js",
|
|
39
|
+
"@nx/devkit",
|
|
40
|
+
"@nx/cypress",
|
|
41
|
+
"@nx/jest",
|
|
42
|
+
"@nx/js",
|
|
43
|
+
"@nx/eslint",
|
|
44
|
+
"@nx/webpack",
|
|
45
|
+
"@nx/web",
|
|
46
|
+
"@nx/workspace",
|
|
47
|
+
"@nx/eslint",
|
|
48
|
+
"@nx/module-federation",
|
|
49
|
+
"@nx/rspack",
|
|
50
|
+
"webpack",
|
|
51
|
+
"fsevents",
|
|
52
|
+
"nx"
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}, {
|
|
58
|
+
name: "analogjs-auto-discover-deps",
|
|
59
|
+
async config(config, { command }) {
|
|
60
|
+
return await crawlFrameworkPkgs({
|
|
61
|
+
root: workspaceRoot,
|
|
62
|
+
isBuild: command === "build",
|
|
63
|
+
viteUserConfig: config,
|
|
64
|
+
isSemiFrameworkPkgByJson(pkgJson) {
|
|
65
|
+
return pkgJson["module"] && pkgJson["module"].includes("fesm");
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}];
|
|
82
70
|
}
|
|
83
|
-
//#
|
|
71
|
+
//#endregion
|
|
72
|
+
export { depsPlugin };
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=deps-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deps-plugin.js","names":[],"sources":["../../../src/lib/deps-plugin.ts"],"sourcesContent":["import { VERSION } from '@angular/compiler-cli';\nimport type { Plugin } from 'vite';\nimport { crawlFrameworkPkgs } from 'vitefu';\n\nimport { Options } from './options.js';\nimport { getJsTransformConfigKey } from './utils/rolldown.js';\n\nexport function depsPlugin(options?: Options): Plugin[] {\n const workspaceRoot =\n options?.workspaceRoot ?? process.env['NX_WORKSPACE_ROOT'] ?? process.cwd();\n const viteOptions = options?.vite === false ? undefined : options?.vite;\n\n return [\n {\n name: 'analogjs-deps-plugin',\n config() {\n const useAngularCompilationAPI =\n options?.experimental?.useAngularCompilationAPI ??\n viteOptions?.experimental?.useAngularCompilationAPI;\n\n const transformConfig =\n options?.vite === false || useAngularCompilationAPI\n ? {}\n : { exclude: ['**/*.ts', '**/*.js'] };\n\n return {\n [getJsTransformConfigKey()]: transformConfig,\n ssr: {\n noExternal: [\n '@analogjs/**',\n 'firebase/**',\n 'firebase-admin/**',\n 'rxfire',\n '@ng-web-apis/**',\n '@taiga-ui/**',\n '@tanstack/angular-query-experimental',\n ],\n },\n optimizeDeps: {\n include: [\n '@angular/common',\n '@angular/common/http',\n ...(Number(VERSION.major) > 15\n ? ['@angular/core/rxjs-interop']\n : []),\n 'front-matter',\n ],\n exclude: [\n '@angular/platform-server',\n '@analogjs/content',\n '@analogjs/router',\n '@nx/angular',\n '@nx/vite',\n '@nx/devkit',\n '@nx/js',\n '@nx/devkit',\n '@nx/cypress',\n '@nx/jest',\n '@nx/js',\n '@nx/eslint',\n '@nx/webpack',\n '@nx/web',\n '@nx/workspace',\n '@nx/eslint',\n '@nx/module-federation',\n '@nx/rspack',\n 'webpack',\n 'fsevents',\n 'nx',\n ],\n },\n };\n },\n },\n {\n name: 'analogjs-auto-discover-deps',\n async config(config, { command }) {\n const pkgConfig = await crawlFrameworkPkgs({\n root: workspaceRoot,\n isBuild: command === 'build',\n viteUserConfig: config,\n isSemiFrameworkPkgByJson(pkgJson) {\n return pkgJson['module'] && pkgJson['module'].includes('fesm');\n },\n });\n return pkgConfig;\n },\n },\n ];\n}\n"],"mappings":";;;;AAOA,SAAgB,WAAW,SAA6B;CACtD,MAAM,gBACJ,SAAS,iBAAiB,QAAQ,IAAI,wBAAwB,QAAQ,KAAK;CAC7E,MAAM,cAAc,SAAS,SAAS,QAAQ,KAAA,IAAY,SAAS;AAEnE,QAAO,CACL;EACE,MAAM;EACN,SAAS;GACP,MAAM,2BACJ,SAAS,cAAc,4BACvB,aAAa,cAAc;GAE7B,MAAM,kBACJ,SAAS,SAAS,SAAS,2BACvB,EAAE,GACF,EAAE,SAAS,CAAC,WAAW,UAAU,EAAE;AAEzC,UAAO;KACJ,yBAAyB,GAAG;IAC7B,KAAK,EACH,YAAY;KACV;KACA;KACA;KACA;KACA;KACA;KACA;KACD,EACF;IACD,cAAc;KACZ,SAAS;MACP;MACA;MACA,GAAI,OAAO,QAAQ,MAAM,GAAG,KACxB,CAAC,6BAA6B,GAC9B,EAAE;MACN;MACD;KACD,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACD;KACF;IACF;;EAEJ,EACD;EACE,MAAM;EACN,MAAM,OAAO,QAAQ,EAAE,WAAW;AAShC,UARkB,MAAM,mBAAmB;IACzC,MAAM;IACN,SAAS,YAAY;IACrB,gBAAgB;IAChB,yBAAyB,SAAS;AAChC,YAAO,QAAQ,aAAa,QAAQ,UAAU,SAAS,OAAO;;IAEjE,CAAC;;EAGL,CACF"}
|