@analogjs/platform 2.4.0-beta.9 → 3.0.0-alpha.10
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 +7 -14
- package/src/index.d.ts +2 -2
- package/src/index.js +7 -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 +12 -12
- 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/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 +3 -2
- package/src/lib/nx-plugin/src/generators/app/compat.js +6 -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/server/routes/api/v1/hello.ts__template__ +2 -2
- 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-v17/src/app/app.config.ts__template__ +0 -6
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v17/src/server/routes/v1/hello.ts__template__ +2 -2
- 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 -17
- 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/src/server/routes/api/v1/hello.ts__template__ +2 -2
- 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 -17
- 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/src/server/routes/api/v1/hello.ts__template__ +2 -2
- 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 -8
- 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 +17 -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 -3
- package/src/lib/nx-plugin/src/generators/app/lib/add-tailwind-helpers.js +65 -138
- 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 +7 -12
- package/src/lib/nx-plugin/src/generators/app/versions/nx_18_X/versions.js +9 -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.js +10 -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 +3 -2
- package/src/lib/nx-plugin/src/generators/init/compat.js +6 -6
- package/src/lib/nx-plugin/src/generators/init/compat.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/files/src/server/routes/api/v1/hello.ts__template__ +2 -2
- 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/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 +0 -1
- package/src/lib/nx-plugin/src/generators/preset/generator.d.ts +3 -3
- package/src/lib/nx-plugin/src/generators/preset/generator.js +11 -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 +3 -2
- package/src/lib/nx-plugin/src/generators/setup-vitest/compat.js +6 -6
- package/src/lib/nx-plugin/src/generators/setup-vitest/compat.js.map +1 -1
- 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 +83 -79
- package/src/lib/platform-plugin.d.ts +2 -2
- package/src/lib/platform-plugin.js +59 -61
- package/src/lib/platform-plugin.js.map +1 -0
- package/src/lib/router-plugin.d.ts +19 -19
- package/src/lib/router-plugin.js +191 -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/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/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,9 +1,9 @@
|
|
|
1
|
-
import { ShikiHighlighterOptions, ShikiHighlightOptions } from
|
|
2
|
-
import { BundledLanguage } from
|
|
1
|
+
import { ShikiHighlighterOptions, ShikiHighlightOptions } from "./shiki-highlighter.js";
|
|
2
|
+
import { BundledLanguage } from "shiki/langs";
|
|
3
3
|
export interface WithShikiHighlighterOptions {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
highlighter?: Partial<ShikiHighlighterOptions> & {
|
|
5
|
+
additionalLangs?: BundledLanguage[];
|
|
6
|
+
};
|
|
7
|
+
highlight?: ShikiHighlightOptions;
|
|
8
|
+
container?: string;
|
|
9
9
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { type BundledLanguage, type BundledTheme, type CodeOptionsMeta, type CodeOptionsMultipleThemes, type CodeOptionsSingleTheme, type CodeToHastOptionsCommon, getHighlighter } from
|
|
2
|
-
import { MarkedContentHighlighter } from
|
|
1
|
+
import { type BundledLanguage, type BundledTheme, type CodeOptionsMeta, type CodeOptionsMultipleThemes, type CodeOptionsSingleTheme, type CodeToHastOptionsCommon, getHighlighter } from "shiki";
|
|
2
|
+
import { MarkedContentHighlighter } from "../marked/marked-content-highlighter.js";
|
|
3
3
|
export type ShikiHighlighterOptions = Parameters<typeof getHighlighter>[0];
|
|
4
|
-
export type ShikiHighlightOptions = Partial<Omit<CodeToHastOptionsCommon<BundledLanguage>,
|
|
4
|
+
export type ShikiHighlightOptions = Partial<Omit<CodeToHastOptionsCommon<BundledLanguage>, "lang">> & CodeOptionsMeta & Partial<CodeOptionsSingleTheme<BundledTheme>> & Partial<CodeOptionsMultipleThemes<BundledTheme>>;
|
|
5
5
|
export declare const defaultHighlighterOptions: {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
langs: string[];
|
|
7
|
+
themes: string[];
|
|
8
8
|
};
|
|
9
9
|
export declare class ShikiHighlighter extends MarkedContentHighlighter {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
private highlighterOptions;
|
|
11
|
+
private highlightOptions;
|
|
12
|
+
private container;
|
|
13
|
+
private hasLoadMermaid;
|
|
14
|
+
private readonly highlighter;
|
|
15
|
+
constructor(highlighterOptions: ShikiHighlighterOptions, highlightOptions: ShikiHighlightOptions, container: string, hasLoadMermaid?: boolean);
|
|
16
|
+
getHighlightExtension(): import("marked").MarkedExtension;
|
|
17
17
|
}
|
|
@@ -1,45 +1,46 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { MarkedContentHighlighter } from "../marked/marked-content-highlighter.js";
|
|
2
|
+
import markedShiki from "marked-shiki";
|
|
3
|
+
import { getHighlighter } from "shiki";
|
|
4
|
+
//#region packages/platform/src/lib/content/shiki/shiki-highlighter.ts
|
|
5
|
+
var defaultHighlighterOptions = {
|
|
6
|
+
langs: [
|
|
7
|
+
"json",
|
|
8
|
+
"ts",
|
|
9
|
+
"tsx",
|
|
10
|
+
"js",
|
|
11
|
+
"jsx",
|
|
12
|
+
"html",
|
|
13
|
+
"css",
|
|
14
|
+
"angular-html",
|
|
15
|
+
"angular-ts"
|
|
16
|
+
],
|
|
17
|
+
themes: ["github-dark", "github-light"]
|
|
17
18
|
};
|
|
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
|
-
//# sourceMappingURL=
|
|
19
|
+
var ShikiHighlighter = class extends MarkedContentHighlighter {
|
|
20
|
+
constructor(highlighterOptions, highlightOptions, container, hasLoadMermaid = false) {
|
|
21
|
+
super();
|
|
22
|
+
this.highlighterOptions = highlighterOptions;
|
|
23
|
+
this.highlightOptions = highlightOptions;
|
|
24
|
+
this.container = container;
|
|
25
|
+
this.hasLoadMermaid = hasLoadMermaid;
|
|
26
|
+
this.highlighter = getHighlighter(this.highlighterOptions);
|
|
27
|
+
}
|
|
28
|
+
getHighlightExtension() {
|
|
29
|
+
return markedShiki({
|
|
30
|
+
container: this.container,
|
|
31
|
+
highlight: async (code, lang, props) => {
|
|
32
|
+
if (this.hasLoadMermaid && lang === "mermaid") return `<pre class="mermaid">${code}</pre>`;
|
|
33
|
+
const { codeToHtml } = await this.highlighter;
|
|
34
|
+
return codeToHtml(code, Object.assign({
|
|
35
|
+
lang,
|
|
36
|
+
meta: { __raw: props.join(" ") },
|
|
37
|
+
theme: "github-dark"
|
|
38
|
+
}, this.highlightOptions));
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
export { ShikiHighlighter, defaultHighlighterOptions };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=shiki-highlighter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shiki-highlighter.js","names":[],"sources":["../../../../../../../packages/platform/src/lib/content/shiki/shiki-highlighter.ts"],"sourcesContent":["import markedShiki from 'marked-shiki';\nimport {\n type BundledLanguage,\n type BundledTheme,\n type CodeOptionsMeta,\n type CodeOptionsMultipleThemes,\n type CodeOptionsSingleTheme,\n type CodeToHastOptionsCommon,\n getHighlighter,\n} from 'shiki';\n\nimport { MarkedContentHighlighter } from '../marked/marked-content-highlighter.js';\n\nexport type ShikiHighlighterOptions = Parameters<typeof getHighlighter>[0];\nexport type ShikiHighlightOptions = Partial<\n Omit<CodeToHastOptionsCommon<BundledLanguage>, 'lang'>\n> &\n CodeOptionsMeta &\n Partial<CodeOptionsSingleTheme<BundledTheme>> &\n Partial<CodeOptionsMultipleThemes<BundledTheme>>;\n\nexport const defaultHighlighterOptions: {\n langs: string[];\n themes: string[];\n} = {\n langs: [\n 'json',\n 'ts',\n 'tsx',\n 'js',\n 'jsx',\n 'html',\n 'css',\n 'angular-html',\n 'angular-ts',\n ],\n themes: ['github-dark', 'github-light'],\n};\n\nexport class ShikiHighlighter extends MarkedContentHighlighter {\n private readonly highlighter: ReturnType<typeof getHighlighter>;\n\n constructor(\n private highlighterOptions: ShikiHighlighterOptions,\n private highlightOptions: ShikiHighlightOptions,\n private container: string,\n private hasLoadMermaid = false,\n ) {\n super();\n this.highlighter = getHighlighter(this.highlighterOptions);\n }\n getHighlightExtension(): import('marked').MarkedExtension {\n return markedShiki({\n container: this.container,\n highlight: async (code, lang, props) => {\n if (this.hasLoadMermaid && lang === 'mermaid') {\n return `<pre class=\"mermaid\">${code}</pre>`;\n }\n\n const { codeToHtml } = await this.highlighter;\n return codeToHtml(\n code,\n Object.assign(\n {\n lang,\n // required by `transformerMeta*`\n meta: { __raw: props.join(' ') },\n theme: 'github-dark',\n },\n this.highlightOptions,\n ),\n );\n },\n });\n }\n}\n"],"mappings":";;;;AAqBA,IAAa,4BAGT;CACF,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD;CACD,QAAQ,CAAC,eAAe,eAAe;CACxC;AAED,IAAa,mBAAb,cAAsC,yBAAyB;CAG7D,YACE,oBACA,kBACA,WACA,iBAAyB,OACzB;AACA,SAAO;AALC,OAAA,qBAAA;AACA,OAAA,mBAAA;AACA,OAAA,YAAA;AACA,OAAA,iBAAA;AAGR,OAAK,cAAc,eAAe,KAAK,mBAAmB;;CAE5D,wBAA0D;AACxD,SAAO,YAAY;GACjB,WAAW,KAAK;GAChB,WAAW,OAAO,MAAM,MAAM,UAAU;AACtC,QAAI,KAAK,kBAAkB,SAAS,UAClC,QAAO,wBAAwB,KAAK;IAGtC,MAAM,EAAE,eAAe,MAAM,KAAK;AAClC,WAAO,WACL,MACA,OAAO,OACL;KACE;KAEA,MAAM,EAAE,OAAO,MAAM,KAAK,IAAI,EAAE;KAChC,OAAO;KACR,EACD,KAAK,iBACN,CACF;;GAEJ,CAAC"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { WithShikiHighlighterOptions } from
|
|
3
|
-
import type { WithPrismHighlighterOptions } from
|
|
4
|
-
import type { WithMarkedOptions } from
|
|
5
|
-
import type { Options } from
|
|
1
|
+
import * as vite from "vite";
|
|
2
|
+
import type { WithShikiHighlighterOptions } from "./content/shiki/options.js";
|
|
3
|
+
import type { WithPrismHighlighterOptions } from "./content/prism/options.js";
|
|
4
|
+
import type { WithMarkedOptions } from "./content/marked/index.js";
|
|
5
|
+
import type { Options } from "./options.js";
|
|
6
6
|
export type ContentPluginOptions = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
highlighter?: "shiki" | "prism";
|
|
8
|
+
markedOptions?: WithMarkedOptions;
|
|
9
|
+
shikiOptions?: WithShikiHighlighterOptions;
|
|
10
|
+
prismOptions?: WithPrismHighlighterOptions;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export declare function contentPlugin({ highlighter, markedOptions, shikiOptions, prismOptions
|
|
13
|
+
* Content plugin that provides markdown and content file processing for Analog.
|
|
14
|
+
*
|
|
15
|
+
* IMPORTANT: This plugin uses tinyglobby for file discovery.
|
|
16
|
+
* Key pitfall with { dot: true }:
|
|
17
|
+
* - Returns relative paths from cwd (e.g., "apps/blog-app/src/content/...")
|
|
18
|
+
* - These paths CANNOT be used directly in ES module imports
|
|
19
|
+
* - Relative paths without ./ or ../ are treated as package names
|
|
20
|
+
* - Must convert to absolute paths for imports to work correctly
|
|
21
|
+
*/
|
|
22
|
+
export declare function contentPlugin({ highlighter, markedOptions, shikiOptions, prismOptions }?: ContentPluginOptions, options?: Options): vite.Plugin[];
|
|
@@ -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.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
|