@ykdz/template 0.0.36 → 0.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/application.d.ts +129 -13
- package/dist/application.js +286 -174
- package/dist/command-result.d.ts +9 -0
- package/dist/command-result.js +231 -0
- package/dist/main.d.ts +4 -1
- package/dist/main.js +319 -51
- package/node_modules/@ykdz/template-builtin-presets/dist/src/foundation.d.ts +122 -22
- package/node_modules/@ykdz/template-builtin-presets/dist/src/foundation.js +2081 -410
- package/node_modules/@ykdz/template-builtin-presets/dist/src/generation-record.d.ts +18 -3
- package/node_modules/@ykdz/template-builtin-presets/dist/src/generation-record.js +29 -5
- package/node_modules/@ykdz/template-builtin-presets/dist/src/index.d.ts +2 -2
- package/node_modules/@ykdz/template-builtin-presets/dist/src/index.js +1 -1
- package/node_modules/@ykdz/template-builtin-presets/dist/src/rust-bin/definition.d.ts +1 -1
- package/node_modules/@ykdz/template-builtin-presets/dist/src/rust-bin/definition.js +16 -15
- package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/development-container.d.ts +1 -1
- package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/development-container.js +1 -1
- package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/typescript.d.ts +8 -6
- package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/typescript.js +3 -3
- package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/vue.d.ts +6 -4
- package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/vue.js +8 -6
- package/node_modules/@ykdz/template-builtin-presets/dist/src/template-sources.d.ts +1 -1
- package/node_modules/@ykdz/template-builtin-presets/dist/src/template-sources.js +1 -1
- package/node_modules/@ykdz/template-builtin-presets/dist/src/ts-cli/definition.d.ts +1 -1
- package/node_modules/@ykdz/template-builtin-presets/dist/src/ts-cli/definition.js +34 -8
- package/node_modules/@ykdz/template-builtin-presets/dist/src/ts-lib/definition.d.ts +1 -1
- package/node_modules/@ykdz/template-builtin-presets/dist/src/ts-lib/definition.js +7 -7
- package/node_modules/@ykdz/template-builtin-presets/dist/src/vike-app/definition.d.ts +28 -2
- package/node_modules/@ykdz/template-builtin-presets/dist/src/vike-app/definition.js +164 -148
- package/node_modules/@ykdz/template-builtin-presets/dist/src/vue-app/definition.d.ts +2 -2
- package/node_modules/@ykdz/template-builtin-presets/dist/src/vue-app/definition.js +3 -3
- package/node_modules/@ykdz/template-builtin-presets/dist/src/vue-hono-app/definition.d.ts +2 -2
- package/node_modules/@ykdz/template-builtin-presets/dist/src/vue-hono-app/definition.js +22 -23
- package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/bin/semver.js +0 -0
- package/node_modules/{valibot → @ykdz/template-builtin-presets/node_modules/valibot}/README.md +1 -1
- package/node_modules/{valibot → @ykdz/template-builtin-presets/node_modules/valibot}/dist/index.cjs +427 -504
- package/node_modules/{valibot → @ykdz/template-builtin-presets/node_modules/valibot}/dist/index.d.cts +427 -32
- package/node_modules/{valibot → @ykdz/template-builtin-presets/node_modules/valibot}/dist/index.d.mts +427 -32
- package/node_modules/@ykdz/template-builtin-presets/node_modules/valibot/dist/index.min.cjs +2 -0
- package/node_modules/@ykdz/template-builtin-presets/node_modules/valibot/dist/index.min.mjs +2 -0
- package/node_modules/{valibot → @ykdz/template-builtin-presets/node_modules/valibot}/dist/index.mjs +418 -504
- package/node_modules/{valibot → @ykdz/template-builtin-presets/node_modules/valibot}/package.json +7 -2
- package/node_modules/@ykdz/template-builtin-presets/package.json +23 -10
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/.github/workflows/check-deployment-diagnostics.yml +5 -5
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/.github/workflows/check-deployment.yml +4 -4
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/.github/workflows/check-diagnostics.yml +4 -4
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/.github/workflows/check.yml +3 -3
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/AGENTS.md.template +17 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/devcontainer.json +4 -2
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/pnpm-workspace.dynamic.txt +1 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/pnpm-workspace.yaml +5 -5
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/scripts/check-toolchain-versions.ts +556 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/tsconfig.json +4 -6
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/tsconfig.packing-hook.json +2 -3
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/turbo.json +1 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/rust-bin/turbo.json +19 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/shared/devcontainer/node-pnpm.Dockerfile +4 -6
- package/node_modules/@ykdz/template-builtin-presets/templates/shared/oxc/tsconfig.config.json +2 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/shared/vue/tsconfig.app.json +1 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/shared/vue/tsconfig.node.json +2 -2
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/readiness.ts +26 -5
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/release.yml +1 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/root-tsconfig.json +2 -7
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/tsconfig.json +2 -2
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-lib/tsconfig.build.json +2 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-lib/tsconfig.json +2 -2
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db/scripts/reset.ts +3 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db/src/db.ts +3 -4
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db/src/readiness.ts +6 -5
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db/src/storage.ts +93 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db/tsconfig.build.json +8 -2
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db/tsconfig.json +3 -7
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db/turbo.json +1 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db-migrations/drizzle.config.ts +5 -5
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db-migrations/tsconfig.build.json +2 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db-migrations/tsconfig.json +2 -2
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/.env.example +2 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/Dockerfile +25 -17
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/Dockerfile.dockerignore +4 -4
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/playwright.config.ts +5 -25
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/scripts/check-standalone-deployment.ts +17 -15
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/test/playwright-teardown.ts +6 -7
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/tsconfig.app.json +1 -2
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/tsconfig.json +0 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/tsconfig.node.json +2 -3
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/tsconfig.test.json +0 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/turbo.json +0 -8
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/vite.config.ts +3 -39
- package/node_modules/@ykdz/template-builtin-presets/templates/vue-hono-app/api/tsconfig.json +7 -2
- package/node_modules/@ykdz/template-builtin-presets/templates/vue-hono-app/root/playwright.config.ts +34 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/vue-hono-app/{web → root}/test/e2e/app.spec.ts +3 -3
- package/node_modules/@ykdz/template-builtin-presets/templates/vue-hono-app/root/test/e2e/fixtures.ts +15 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/vue-hono-app/root/tsconfig.json +3 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/vue-hono-app/web/src/api.ts +1 -3
- package/node_modules/@ykdz/template-builtin-presets/templates/vue-hono-app/web/turbo.json +0 -4
- package/node_modules/@ykdz/template-builtin-presets/templates/vue-hono-app/web/vite.config.ts +2 -0
- package/node_modules/@ykdz/template-core/dist/ci-diagnostic-artifact.d.ts +2 -2
- package/node_modules/@ykdz/template-core/dist/ci-diagnostic-artifact.js +10 -5
- package/node_modules/@ykdz/template-core/dist/module-graph.d.ts +1 -1
- package/node_modules/@ykdz/template-core/dist/module-graph.js +7 -5
- package/node_modules/@ykdz/template-core/dist/package-contribution.d.ts +33 -10
- package/node_modules/@ykdz/template-core/dist/package-contribution.js +1 -1
- package/node_modules/@ykdz/template-core/dist/pnpm-workspace.yaml +10 -9
- package/node_modules/@ykdz/template-core/dist/preset-definition.d.ts +11 -0
- package/node_modules/@ykdz/template-core/dist/project-github.d.ts +7 -5
- package/node_modules/@ykdz/template-core/dist/project-github.js +4 -4
- package/node_modules/@ykdz/template-core/dist/project-linking-v2.d.ts +2 -2
- package/node_modules/@ykdz/template-core/dist/project-linking-v2.js +12 -6
- package/node_modules/@ykdz/template-core/dist/project-projection.d.ts +27 -0
- package/node_modules/@ykdz/template-core/dist/project-projection.js +394 -9
- package/node_modules/@ykdz/template-core/dist/release-toolchain-snapshot.d.ts +10 -0
- package/node_modules/@ykdz/template-core/dist/release-toolchain-snapshot.js +9 -0
- package/node_modules/@ykdz/template-core/dist/template-boundary-check.js +15 -9
- package/node_modules/@ykdz/template-core/node_modules/valibot/LICENSE.md +9 -0
- package/node_modules/@ykdz/template-core/node_modules/valibot/README.md +94 -0
- package/node_modules/@ykdz/template-core/node_modules/valibot/dist/index.cjs +7897 -0
- package/node_modules/@ykdz/template-core/node_modules/valibot/dist/index.d.cts +16579 -0
- package/node_modules/@ykdz/template-core/node_modules/valibot/dist/index.d.mts +16579 -0
- package/node_modules/@ykdz/template-core/node_modules/valibot/dist/index.min.cjs +2 -0
- package/node_modules/@ykdz/template-core/node_modules/valibot/dist/index.min.mjs +2 -0
- package/node_modules/@ykdz/template-core/node_modules/valibot/dist/index.mjs +7577 -0
- package/node_modules/@ykdz/template-core/node_modules/valibot/package.json +84 -0
- package/node_modules/@ykdz/template-core/package.json +0 -2
- package/node_modules/hosted-git-info/LICENSE +13 -0
- package/node_modules/hosted-git-info/README.md +138 -0
- package/node_modules/hosted-git-info/lib/from-url.js +122 -0
- package/node_modules/hosted-git-info/lib/hosts.js +229 -0
- package/node_modules/hosted-git-info/lib/index.js +227 -0
- package/node_modules/hosted-git-info/lib/parse-url.js +79 -0
- package/node_modules/hosted-git-info/package.json +57 -0
- package/node_modules/jsonc-parser/CHANGELOG.md +76 -0
- package/node_modules/jsonc-parser/LICENSE.md +21 -0
- package/node_modules/jsonc-parser/README.md +364 -0
- package/node_modules/jsonc-parser/SECURITY.md +41 -0
- package/node_modules/jsonc-parser/lib/esm/impl/edit.js +185 -0
- package/node_modules/jsonc-parser/lib/esm/impl/format.js +261 -0
- package/node_modules/jsonc-parser/lib/esm/impl/parser.js +659 -0
- package/node_modules/jsonc-parser/lib/esm/impl/scanner.js +443 -0
- package/node_modules/jsonc-parser/lib/esm/impl/string-intern.js +29 -0
- package/node_modules/jsonc-parser/lib/esm/main.d.ts +351 -0
- package/node_modules/jsonc-parser/lib/esm/main.js +178 -0
- package/node_modules/jsonc-parser/lib/umd/impl/edit.js +201 -0
- package/node_modules/jsonc-parser/lib/umd/impl/format.js +275 -0
- package/node_modules/jsonc-parser/lib/umd/impl/parser.js +682 -0
- package/node_modules/jsonc-parser/lib/umd/impl/scanner.js +456 -0
- package/node_modules/jsonc-parser/lib/umd/impl/string-intern.js +42 -0
- package/node_modules/jsonc-parser/lib/umd/main.d.ts +351 -0
- package/node_modules/jsonc-parser/lib/umd/main.js +194 -0
- package/node_modules/jsonc-parser/package.json +37 -0
- package/node_modules/lru-cache/LICENSE.md +55 -0
- package/node_modules/lru-cache/README.md +469 -0
- package/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel-browser.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel-browser.js.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel.d.ts +5 -0
- package/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel.js +7 -0
- package/node_modules/lru-cache/dist/commonjs/browser/index.d.ts +1400 -0
- package/node_modules/lru-cache/dist/commonjs/browser/index.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/browser/index.js +1733 -0
- package/node_modules/lru-cache/dist/commonjs/browser/index.js.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/browser/index.min.js +2 -0
- package/node_modules/lru-cache/dist/commonjs/browser/index.min.js.map +7 -0
- package/node_modules/lru-cache/dist/commonjs/browser/perf.d.ts +12 -0
- package/node_modules/lru-cache/dist/commonjs/browser/perf.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/browser/perf.js +10 -0
- package/node_modules/lru-cache/dist/commonjs/browser/perf.js.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/diagnostics-channel-cjs.cjs.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/diagnostics-channel-cjs.d.cts.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/diagnostics-channel.d.ts +5 -0
- package/node_modules/lru-cache/dist/commonjs/diagnostics-channel.js +7 -0
- package/node_modules/lru-cache/dist/commonjs/index.d.ts +1400 -0
- package/node_modules/lru-cache/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/index.js +1733 -0
- package/node_modules/lru-cache/dist/commonjs/index.js.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/index.min.js +2 -0
- package/node_modules/lru-cache/dist/commonjs/index.min.js.map +7 -0
- package/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel-node.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel-node.js.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel.d.ts +5 -0
- package/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel.js +9 -0
- package/node_modules/lru-cache/dist/commonjs/node/index.d.ts +1400 -0
- package/node_modules/lru-cache/dist/commonjs/node/index.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/node/index.js +1733 -0
- package/node_modules/lru-cache/dist/commonjs/node/index.js.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/node/index.min.js +2 -0
- package/node_modules/lru-cache/dist/commonjs/node/index.min.js.map +7 -0
- package/node_modules/lru-cache/dist/commonjs/node/perf.d.ts +12 -0
- package/node_modules/lru-cache/dist/commonjs/node/perf.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/node/perf.js +10 -0
- package/node_modules/lru-cache/dist/commonjs/node/perf.js.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/package.json +3 -0
- package/node_modules/lru-cache/dist/commonjs/perf.d.ts +12 -0
- package/node_modules/lru-cache/dist/commonjs/perf.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/perf.js +10 -0
- package/node_modules/lru-cache/dist/commonjs/perf.js.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/react-native/diagnostics-channel-react-native.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/react-native/diagnostics-channel-react-native.js.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/react-native/diagnostics-channel.d.ts +5 -0
- package/node_modules/lru-cache/dist/commonjs/react-native/diagnostics-channel.js +7 -0
- package/node_modules/lru-cache/dist/commonjs/react-native/index.d.ts +1400 -0
- package/node_modules/lru-cache/dist/commonjs/react-native/index.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/react-native/index.js +1733 -0
- package/node_modules/lru-cache/dist/commonjs/react-native/index.js.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/react-native/perf.d.ts +12 -0
- package/node_modules/lru-cache/dist/commonjs/react-native/perf.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/react-native/perf.js +10 -0
- package/node_modules/lru-cache/dist/commonjs/react-native/perf.js.map +1 -0
- package/node_modules/lru-cache/dist/esm/browser/diagnostics-channel-browser.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/esm/browser/diagnostics-channel-browser.js.map +1 -0
- package/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.d.ts +5 -0
- package/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.js +4 -0
- package/node_modules/lru-cache/dist/esm/browser/index.d.ts +1400 -0
- package/node_modules/lru-cache/dist/esm/browser/index.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/esm/browser/index.js +1729 -0
- package/node_modules/lru-cache/dist/esm/browser/index.js.map +1 -0
- package/node_modules/lru-cache/dist/esm/browser/index.min.js +2 -0
- package/node_modules/lru-cache/dist/esm/browser/index.min.js.map +7 -0
- package/node_modules/lru-cache/dist/esm/browser/perf.d.ts +12 -0
- package/node_modules/lru-cache/dist/esm/browser/perf.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/esm/browser/perf.js +7 -0
- package/node_modules/lru-cache/dist/esm/browser/perf.js.map +1 -0
- package/node_modules/lru-cache/dist/esm/diagnostics-channel-esm.d.mts.map +1 -0
- package/node_modules/lru-cache/dist/esm/diagnostics-channel-esm.mjs.map +1 -0
- package/node_modules/lru-cache/dist/esm/diagnostics-channel.d.ts +5 -0
- package/node_modules/lru-cache/dist/esm/diagnostics-channel.js +19 -0
- package/node_modules/lru-cache/dist/esm/index.d.ts +1400 -0
- package/node_modules/lru-cache/dist/esm/index.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/esm/index.js +1729 -0
- package/node_modules/lru-cache/dist/esm/index.js.map +1 -0
- package/node_modules/lru-cache/dist/esm/index.min.js +2 -0
- package/node_modules/lru-cache/dist/esm/index.min.js.map +7 -0
- package/node_modules/lru-cache/dist/esm/node/diagnostics-channel-node.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/esm/node/diagnostics-channel-node.js.map +1 -0
- package/node_modules/lru-cache/dist/esm/node/diagnostics-channel.d.ts +5 -0
- package/node_modules/lru-cache/dist/esm/node/diagnostics-channel.js +6 -0
- package/node_modules/lru-cache/dist/esm/node/index.d.ts +1400 -0
- package/node_modules/lru-cache/dist/esm/node/index.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/esm/node/index.js +1729 -0
- package/node_modules/lru-cache/dist/esm/node/index.js.map +1 -0
- package/node_modules/lru-cache/dist/esm/node/index.min.js +2 -0
- package/node_modules/lru-cache/dist/esm/node/index.min.js.map +7 -0
- package/node_modules/lru-cache/dist/esm/node/perf.d.ts +12 -0
- package/node_modules/lru-cache/dist/esm/node/perf.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/esm/node/perf.js +7 -0
- package/node_modules/lru-cache/dist/esm/node/perf.js.map +1 -0
- package/node_modules/lru-cache/dist/esm/package.json +3 -0
- package/node_modules/lru-cache/dist/esm/perf.d.ts +12 -0
- package/node_modules/lru-cache/dist/esm/perf.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/esm/perf.js +7 -0
- package/node_modules/lru-cache/dist/esm/perf.js.map +1 -0
- package/node_modules/lru-cache/dist/esm/react-native/diagnostics-channel-react-native.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/esm/react-native/diagnostics-channel-react-native.js.map +1 -0
- package/node_modules/lru-cache/dist/esm/react-native/diagnostics-channel.d.ts +5 -0
- package/node_modules/lru-cache/dist/esm/react-native/diagnostics-channel.js +4 -0
- package/node_modules/lru-cache/dist/esm/react-native/index.d.ts +1400 -0
- package/node_modules/lru-cache/dist/esm/react-native/index.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/esm/react-native/index.js +1729 -0
- package/node_modules/lru-cache/dist/esm/react-native/index.js.map +1 -0
- package/node_modules/lru-cache/dist/esm/react-native/perf.d.ts +12 -0
- package/node_modules/lru-cache/dist/esm/react-native/perf.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/esm/react-native/perf.js +7 -0
- package/node_modules/lru-cache/dist/esm/react-native/perf.js.map +1 -0
- package/node_modules/lru-cache/package.json +180 -0
- package/node_modules/npm-package-arg/LICENSE +15 -0
- package/node_modules/npm-package-arg/README.md +104 -0
- package/node_modules/npm-package-arg/lib/npa.js +479 -0
- package/node_modules/npm-package-arg/node_modules/semver/LICENSE +15 -0
- package/node_modules/npm-package-arg/node_modules/semver/README.md +680 -0
- package/node_modules/npm-package-arg/node_modules/semver/bin/semver.js +195 -0
- package/node_modules/npm-package-arg/node_modules/semver/classes/comparator.js +143 -0
- package/node_modules/npm-package-arg/node_modules/semver/classes/index.js +7 -0
- package/node_modules/npm-package-arg/node_modules/semver/classes/range.js +577 -0
- package/node_modules/npm-package-arg/node_modules/semver/classes/semver.js +350 -0
- package/node_modules/npm-package-arg/node_modules/semver/functions/clean.js +8 -0
- package/node_modules/npm-package-arg/node_modules/semver/functions/cmp.js +54 -0
- package/node_modules/npm-package-arg/node_modules/semver/functions/coerce.js +62 -0
- package/node_modules/npm-package-arg/node_modules/semver/functions/compare-build.js +9 -0
- package/node_modules/npm-package-arg/node_modules/semver/functions/compare-loose.js +5 -0
- package/node_modules/npm-package-arg/node_modules/semver/functions/compare.js +7 -0
- package/node_modules/npm-package-arg/node_modules/semver/functions/diff.js +60 -0
- package/node_modules/npm-package-arg/node_modules/semver/functions/eq.js +5 -0
- package/node_modules/npm-package-arg/node_modules/semver/functions/gt.js +5 -0
- package/node_modules/npm-package-arg/node_modules/semver/functions/gte.js +5 -0
- package/node_modules/npm-package-arg/node_modules/semver/functions/inc.js +21 -0
- package/node_modules/npm-package-arg/node_modules/semver/functions/lt.js +5 -0
- package/node_modules/npm-package-arg/node_modules/semver/functions/lte.js +5 -0
- package/node_modules/npm-package-arg/node_modules/semver/functions/major.js +5 -0
- package/node_modules/npm-package-arg/node_modules/semver/functions/minor.js +5 -0
- package/node_modules/npm-package-arg/node_modules/semver/functions/neq.js +5 -0
- package/node_modules/npm-package-arg/node_modules/semver/functions/parse.js +18 -0
- package/node_modules/npm-package-arg/node_modules/semver/functions/patch.js +5 -0
- package/node_modules/npm-package-arg/node_modules/semver/functions/prerelease.js +8 -0
- package/node_modules/npm-package-arg/node_modules/semver/functions/rcompare.js +5 -0
- package/node_modules/npm-package-arg/node_modules/semver/functions/rsort.js +5 -0
- package/node_modules/npm-package-arg/node_modules/semver/functions/satisfies.js +12 -0
- package/node_modules/npm-package-arg/node_modules/semver/functions/sort.js +5 -0
- package/node_modules/npm-package-arg/node_modules/semver/functions/truncate.js +48 -0
- package/node_modules/npm-package-arg/node_modules/semver/functions/valid.js +8 -0
- package/node_modules/npm-package-arg/node_modules/semver/index.js +93 -0
- package/node_modules/npm-package-arg/node_modules/semver/internal/constants.js +37 -0
- package/node_modules/npm-package-arg/node_modules/semver/internal/debug.js +11 -0
- package/node_modules/npm-package-arg/node_modules/semver/internal/identifiers.js +29 -0
- package/node_modules/npm-package-arg/node_modules/semver/internal/lrucache.js +42 -0
- package/node_modules/npm-package-arg/node_modules/semver/internal/parse-options.js +17 -0
- package/node_modules/npm-package-arg/node_modules/semver/internal/re.js +223 -0
- package/node_modules/npm-package-arg/node_modules/semver/package.json +78 -0
- package/node_modules/npm-package-arg/node_modules/semver/preload.js +4 -0
- package/node_modules/npm-package-arg/node_modules/semver/range.bnf +17 -0
- package/node_modules/npm-package-arg/node_modules/semver/ranges/gtr.js +6 -0
- package/node_modules/npm-package-arg/node_modules/semver/ranges/intersects.js +9 -0
- package/node_modules/npm-package-arg/node_modules/semver/ranges/ltr.js +6 -0
- package/node_modules/npm-package-arg/node_modules/semver/ranges/max-satisfying.js +27 -0
- package/node_modules/npm-package-arg/node_modules/semver/ranges/min-satisfying.js +26 -0
- package/node_modules/npm-package-arg/node_modules/semver/ranges/min-version.js +63 -0
- package/node_modules/npm-package-arg/node_modules/semver/ranges/outside.js +82 -0
- package/node_modules/npm-package-arg/node_modules/semver/ranges/simplify.js +49 -0
- package/node_modules/npm-package-arg/node_modules/semver/ranges/subset.js +249 -0
- package/node_modules/npm-package-arg/node_modules/semver/ranges/to-comparators.js +10 -0
- package/node_modules/npm-package-arg/node_modules/semver/ranges/valid.js +13 -0
- package/node_modules/npm-package-arg/package.json +60 -0
- package/node_modules/picomatch/LICENSE +21 -0
- package/node_modules/picomatch/README.md +743 -0
- package/node_modules/picomatch/index.js +17 -0
- package/node_modules/picomatch/lib/constants.js +184 -0
- package/node_modules/picomatch/lib/parse.js +1425 -0
- package/node_modules/picomatch/lib/picomatch.js +361 -0
- package/node_modules/picomatch/lib/scan.js +403 -0
- package/node_modules/picomatch/lib/utils.js +72 -0
- package/node_modules/picomatch/package.json +83 -0
- package/node_modules/picomatch/posix.js +3 -0
- package/node_modules/proc-log/LICENSE +15 -0
- package/node_modules/proc-log/README.md +226 -0
- package/node_modules/proc-log/lib/index.js +158 -0
- package/node_modules/proc-log/package.json +46 -0
- package/node_modules/smol-toml/LICENSE +24 -0
- package/node_modules/smol-toml/README.md +605 -0
- package/node_modules/smol-toml/dist/date.d.ts +41 -0
- package/node_modules/smol-toml/dist/date.js +156 -0
- package/node_modules/smol-toml/dist/error.d.ts +37 -0
- package/node_modules/smol-toml/dist/error.js +67 -0
- package/node_modules/smol-toml/dist/extract.js +289 -0
- package/node_modules/smol-toml/dist/index.cjs +770 -0
- package/node_modules/smol-toml/dist/index.d.ts +44 -0
- package/node_modules/smol-toml/dist/index.js +34 -0
- package/node_modules/smol-toml/dist/parse.d.ts +73 -0
- package/node_modules/smol-toml/dist/parse.js +164 -0
- package/node_modules/smol-toml/dist/primitive.js +151 -0
- package/node_modules/smol-toml/dist/stringify.d.ts +32 -0
- package/node_modules/smol-toml/dist/stringify.js +219 -0
- package/node_modules/smol-toml/dist/struct.js +156 -0
- package/node_modules/smol-toml/dist/util.d.ts +43 -0
- package/node_modules/smol-toml/dist/util.js +57 -0
- package/node_modules/smol-toml/package.json +68 -0
- package/node_modules/typescript/bin/tsc +0 -0
- package/node_modules/typescript/bin/tsserver +0 -0
- package/node_modules/unbash/LICENSE +15 -0
- package/node_modules/unbash/README.md +289 -0
- package/node_modules/unbash/dist/ansi-c.d.ts +5 -0
- package/node_modules/unbash/dist/ansi-c.js +130 -0
- package/node_modules/unbash/dist/arithmetic.d.ts +11 -0
- package/node_modules/unbash/dist/arithmetic.js +530 -0
- package/node_modules/unbash/dist/assignment.d.ts +15 -0
- package/node_modules/unbash/dist/assignment.js +118 -0
- package/node_modules/unbash/dist/chars.d.ts +41 -0
- package/node_modules/unbash/dist/chars.js +41 -0
- package/node_modules/unbash/dist/command.d.ts +14 -0
- package/node_modules/unbash/dist/command.js +41 -0
- package/node_modules/unbash/dist/heredoc.d.ts +18 -0
- package/node_modules/unbash/dist/heredoc.js +25 -0
- package/node_modules/unbash/dist/internal-types.d.ts +87 -0
- package/node_modules/unbash/dist/internal-types.js +1 -0
- package/node_modules/unbash/dist/lexer.d.ts +202 -0
- package/node_modules/unbash/dist/lexer.js +3930 -0
- package/node_modules/unbash/dist/parser.d.ts +4 -0
- package/node_modules/unbash/dist/parser.js +1295 -0
- package/node_modules/unbash/dist/parts.d.ts +17 -0
- package/node_modules/unbash/dist/parts.js +82 -0
- package/node_modules/unbash/dist/printer.d.ts +2 -0
- package/node_modules/unbash/dist/printer.js +536 -0
- package/node_modules/unbash/dist/types.d.ts +494 -0
- package/node_modules/unbash/dist/types.js +1 -0
- package/node_modules/unbash/dist/word.d.ts +22 -0
- package/node_modules/unbash/dist/word.js +102 -0
- package/node_modules/unbash/package.json +80 -0
- package/node_modules/validate-npm-package-name/LICENSE +6 -0
- package/node_modules/validate-npm-package-name/README.md +120 -0
- package/node_modules/validate-npm-package-name/lib/builtin-modules.json +1 -0
- package/node_modules/validate-npm-package-name/lib/index.js +114 -0
- package/node_modules/validate-npm-package-name/package.json +59 -0
- package/node_modules/yaml/LICENSE +13 -0
- package/node_modules/yaml/README.md +172 -0
- package/node_modules/yaml/bin.mjs +11 -0
- package/node_modules/yaml/browser/dist/compose/compose-collection.js +88 -0
- package/node_modules/yaml/browser/dist/compose/compose-doc.js +43 -0
- package/node_modules/yaml/browser/dist/compose/compose-node.js +109 -0
- package/node_modules/yaml/browser/dist/compose/compose-scalar.js +86 -0
- package/node_modules/yaml/browser/dist/compose/composer.js +219 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +115 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +198 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +49 -0
- package/node_modules/yaml/browser/dist/compose/resolve-end.js +37 -0
- package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +207 -0
- package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +226 -0
- package/node_modules/yaml/browser/dist/compose/resolve-props.js +146 -0
- package/node_modules/yaml/browser/dist/compose/util-contains-newline.js +34 -0
- package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +26 -0
- package/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +15 -0
- package/node_modules/yaml/browser/dist/compose/util-map-includes.js +13 -0
- package/node_modules/yaml/browser/dist/doc/Document.js +335 -0
- package/node_modules/yaml/browser/dist/doc/anchors.js +71 -0
- package/node_modules/yaml/browser/dist/doc/applyReviver.js +55 -0
- package/node_modules/yaml/browser/dist/doc/createNode.js +88 -0
- package/node_modules/yaml/browser/dist/doc/directives.js +176 -0
- package/node_modules/yaml/browser/dist/errors.js +57 -0
- package/node_modules/yaml/browser/dist/index.js +17 -0
- package/node_modules/yaml/browser/dist/log.js +11 -0
- package/node_modules/yaml/browser/dist/nodes/Alias.js +118 -0
- package/node_modules/yaml/browser/dist/nodes/Collection.js +147 -0
- package/node_modules/yaml/browser/dist/nodes/Node.js +38 -0
- package/node_modules/yaml/browser/dist/nodes/Pair.js +36 -0
- package/node_modules/yaml/browser/dist/nodes/Scalar.js +24 -0
- package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +144 -0
- package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +113 -0
- package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +63 -0
- package/node_modules/yaml/browser/dist/nodes/identity.js +36 -0
- package/node_modules/yaml/browser/dist/nodes/toJS.js +37 -0
- package/node_modules/yaml/browser/dist/parse/cst-scalar.js +214 -0
- package/node_modules/yaml/browser/dist/parse/cst-stringify.js +61 -0
- package/node_modules/yaml/browser/dist/parse/cst-visit.js +97 -0
- package/node_modules/yaml/browser/dist/parse/cst.js +98 -0
- package/node_modules/yaml/browser/dist/parse/lexer.js +721 -0
- package/node_modules/yaml/browser/dist/parse/line-counter.js +39 -0
- package/node_modules/yaml/browser/dist/parse/parser.js +975 -0
- package/node_modules/yaml/browser/dist/public-api.js +102 -0
- package/node_modules/yaml/browser/dist/schema/Schema.js +37 -0
- package/node_modules/yaml/browser/dist/schema/common/map.js +17 -0
- package/node_modules/yaml/browser/dist/schema/common/null.js +15 -0
- package/node_modules/yaml/browser/dist/schema/common/seq.js +17 -0
- package/node_modules/yaml/browser/dist/schema/common/string.js +14 -0
- package/node_modules/yaml/browser/dist/schema/core/bool.js +19 -0
- package/node_modules/yaml/browser/dist/schema/core/float.js +43 -0
- package/node_modules/yaml/browser/dist/schema/core/int.js +38 -0
- package/node_modules/yaml/browser/dist/schema/core/schema.js +23 -0
- package/node_modules/yaml/browser/dist/schema/json/schema.js +62 -0
- package/node_modules/yaml/browser/dist/schema/tags.js +96 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +58 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +26 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +46 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +71 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +67 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +74 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +78 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +39 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +93 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +101 -0
- package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +146 -0
- package/node_modules/yaml/browser/dist/stringify/stringify.js +129 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +153 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyComment.js +20 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +85 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +25 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +150 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyString.js +336 -0
- package/node_modules/yaml/browser/dist/util.js +11 -0
- package/node_modules/yaml/browser/dist/visit.js +233 -0
- package/node_modules/yaml/browser/index.js +5 -0
- package/node_modules/yaml/browser/package.json +3 -0
- package/node_modules/yaml/dist/cli.d.ts +8 -0
- package/node_modules/yaml/dist/cli.mjs +201 -0
- package/node_modules/yaml/dist/compose/compose-collection.d.ts +11 -0
- package/node_modules/yaml/dist/compose/compose-collection.js +90 -0
- package/node_modules/yaml/dist/compose/compose-doc.d.ts +7 -0
- package/node_modules/yaml/dist/compose/compose-doc.js +45 -0
- package/node_modules/yaml/dist/compose/compose-node.d.ts +29 -0
- package/node_modules/yaml/dist/compose/compose-node.js +112 -0
- package/node_modules/yaml/dist/compose/compose-scalar.d.ts +5 -0
- package/node_modules/yaml/dist/compose/compose-scalar.js +88 -0
- package/node_modules/yaml/dist/compose/composer.d.ts +63 -0
- package/node_modules/yaml/dist/compose/composer.js +224 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.js +117 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +11 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.js +200 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.js +51 -0
- package/node_modules/yaml/dist/compose/resolve-end.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-end.js +39 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +7 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.js +209 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +10 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +228 -0
- package/node_modules/yaml/dist/compose/resolve-props.d.ts +23 -0
- package/node_modules/yaml/dist/compose/resolve-props.js +148 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +28 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +3 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
- package/node_modules/yaml/dist/compose/util-map-includes.d.ts +4 -0
- package/node_modules/yaml/dist/compose/util-map-includes.js +15 -0
- package/node_modules/yaml/dist/doc/Document.d.ts +141 -0
- package/node_modules/yaml/dist/doc/Document.js +337 -0
- package/node_modules/yaml/dist/doc/anchors.d.ts +24 -0
- package/node_modules/yaml/dist/doc/anchors.js +76 -0
- package/node_modules/yaml/dist/doc/applyReviver.d.ts +9 -0
- package/node_modules/yaml/dist/doc/applyReviver.js +57 -0
- package/node_modules/yaml/dist/doc/createNode.d.ts +17 -0
- package/node_modules/yaml/dist/doc/createNode.js +90 -0
- package/node_modules/yaml/dist/doc/directives.d.ts +49 -0
- package/node_modules/yaml/dist/doc/directives.js +178 -0
- package/node_modules/yaml/dist/errors.d.ts +21 -0
- package/node_modules/yaml/dist/errors.js +62 -0
- package/node_modules/yaml/dist/index.d.ts +25 -0
- package/node_modules/yaml/dist/index.js +50 -0
- package/node_modules/yaml/dist/log.d.ts +3 -0
- package/node_modules/yaml/dist/log.js +19 -0
- package/node_modules/yaml/dist/nodes/Alias.d.ts +29 -0
- package/node_modules/yaml/dist/nodes/Alias.js +120 -0
- package/node_modules/yaml/dist/nodes/Collection.d.ts +73 -0
- package/node_modules/yaml/dist/nodes/Collection.js +151 -0
- package/node_modules/yaml/dist/nodes/Node.d.ts +53 -0
- package/node_modules/yaml/dist/nodes/Node.js +40 -0
- package/node_modules/yaml/dist/nodes/Pair.d.ts +22 -0
- package/node_modules/yaml/dist/nodes/Pair.js +39 -0
- package/node_modules/yaml/dist/nodes/Scalar.d.ts +47 -0
- package/node_modules/yaml/dist/nodes/Scalar.js +27 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +53 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.js +147 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +60 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.js +115 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +4 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.js +65 -0
- package/node_modules/yaml/dist/nodes/identity.d.ts +23 -0
- package/node_modules/yaml/dist/nodes/identity.js +53 -0
- package/node_modules/yaml/dist/nodes/toJS.d.ts +29 -0
- package/node_modules/yaml/dist/nodes/toJS.js +39 -0
- package/node_modules/yaml/dist/options.d.ts +350 -0
- package/node_modules/yaml/dist/parse/cst-scalar.d.ts +64 -0
- package/node_modules/yaml/dist/parse/cst-scalar.js +218 -0
- package/node_modules/yaml/dist/parse/cst-stringify.d.ts +8 -0
- package/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
- package/node_modules/yaml/dist/parse/cst-visit.d.ts +39 -0
- package/node_modules/yaml/dist/parse/cst-visit.js +99 -0
- package/node_modules/yaml/dist/parse/cst.d.ts +109 -0
- package/node_modules/yaml/dist/parse/cst.js +112 -0
- package/node_modules/yaml/dist/parse/lexer.d.ts +87 -0
- package/node_modules/yaml/dist/parse/lexer.js +723 -0
- package/node_modules/yaml/dist/parse/line-counter.d.ts +22 -0
- package/node_modules/yaml/dist/parse/line-counter.js +41 -0
- package/node_modules/yaml/dist/parse/parser.d.ts +84 -0
- package/node_modules/yaml/dist/parse/parser.js +980 -0
- package/node_modules/yaml/dist/public-api.d.ts +44 -0
- package/node_modules/yaml/dist/public-api.js +107 -0
- package/node_modules/yaml/dist/schema/Schema.d.ts +17 -0
- package/node_modules/yaml/dist/schema/Schema.js +39 -0
- package/node_modules/yaml/dist/schema/common/map.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/map.js +19 -0
- package/node_modules/yaml/dist/schema/common/null.d.ts +4 -0
- package/node_modules/yaml/dist/schema/common/null.js +17 -0
- package/node_modules/yaml/dist/schema/common/seq.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/seq.js +19 -0
- package/node_modules/yaml/dist/schema/common/string.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/string.js +16 -0
- package/node_modules/yaml/dist/schema/core/bool.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/bool.js +21 -0
- package/node_modules/yaml/dist/schema/core/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/float.js +47 -0
- package/node_modules/yaml/dist/schema/core/int.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/int.js +42 -0
- package/node_modules/yaml/dist/schema/core/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/core/schema.js +25 -0
- package/node_modules/yaml/dist/schema/json/schema.d.ts +2 -0
- package/node_modules/yaml/dist/schema/json/schema.js +64 -0
- package/node_modules/yaml/dist/schema/json-schema.d.ts +69 -0
- package/node_modules/yaml/dist/schema/tags.d.ts +48 -0
- package/node_modules/yaml/dist/schema/tags.js +99 -0
- package/node_modules/yaml/dist/schema/types.d.ts +92 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +2 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +70 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +7 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +5 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.d.ts +9 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.js +71 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +22 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +77 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +10 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +82 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.js +41 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +28 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.js +96 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +6 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +34 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.js +151 -0
- package/node_modules/yaml/dist/stringify/stringify.d.ts +21 -0
- package/node_modules/yaml/dist/stringify/stringify.js +132 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +17 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.js +155 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.d.ts +10 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.js +24 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +4 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.js +87 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +2 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.js +27 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +3 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.js +152 -0
- package/node_modules/yaml/dist/stringify/stringifyString.d.ts +9 -0
- package/node_modules/yaml/dist/stringify/stringifyString.js +338 -0
- package/node_modules/yaml/dist/test-events.d.ts +4 -0
- package/node_modules/yaml/dist/test-events.js +134 -0
- package/node_modules/yaml/dist/util.d.ts +16 -0
- package/node_modules/yaml/dist/util.js +28 -0
- package/node_modules/yaml/dist/visit.d.ts +102 -0
- package/node_modules/yaml/dist/visit.js +236 -0
- package/node_modules/yaml/package.json +97 -0
- package/node_modules/yaml/util.js +2 -0
- package/package.json +21 -19
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/scripts/check-boundaries.ts +0 -12
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/scripts/run-root-owned-task.ts +0 -69
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db/test/global-setup.ts +0 -21
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db/vitest.config.ts +0 -7
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/devcontainer/docker-client.Dockerfile +0 -3
- package/node_modules/@ykdz/template-builtin-presets/templates/vue-hono-app/web/playwright.config.ts +0 -90
- package/node_modules/@ykdz/template-core/dist/toolchain-baseline-update.d.ts +0 -45
- package/node_modules/@ykdz/template-core/dist/toolchain-baseline-update.js +0 -27
- package/node_modules/@ykdz/template-core/dist/toolchain-resolution.d.ts +0 -37
- package/node_modules/@ykdz/template-core/dist/toolchain-resolution.js +0 -195
- package/node_modules/valibot/dist/index.min.cjs +0 -2
- package/node_modules/valibot/dist/index.min.mjs +0 -2
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/LICENSE +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/README.md +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/classes/comparator.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/classes/index.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/classes/range.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/classes/semver.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/functions/clean.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/functions/cmp.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/functions/coerce.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/functions/compare-build.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/functions/compare-loose.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/functions/compare.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/functions/diff.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/functions/eq.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/functions/gt.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/functions/gte.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/functions/inc.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/functions/lt.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/functions/lte.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/functions/major.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/functions/minor.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/functions/neq.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/functions/parse.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/functions/patch.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/functions/prerelease.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/functions/rcompare.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/functions/rsort.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/functions/satisfies.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/functions/sort.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/functions/truncate.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/functions/valid.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/index.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/internal/constants.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/internal/debug.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/internal/identifiers.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/internal/lrucache.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/internal/parse-options.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/internal/re.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/package.json +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/preload.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/range.bnf +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/ranges/gtr.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/ranges/intersects.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/ranges/ltr.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/ranges/max-satisfying.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/ranges/min-satisfying.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/ranges/min-version.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/ranges/outside.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/ranges/simplify.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/ranges/subset.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/ranges/to-comparators.js +0 -0
- /package/node_modules/{semver → @ykdz/template-builtin-presets/node_modules/semver}/ranges/valid.js +0 -0
- /package/node_modules/{valibot → @ykdz/template-builtin-presets/node_modules/valibot}/LICENSE.md +0 -0
- /package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db/src/{types.d.ts → types.ts} +0 -0
|
@@ -2,17 +2,21 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import { existsSync, readFileSync } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
5
|
+
import { isDeepStrictEqual } from "node:util";
|
|
6
|
+
import { composeCiDiagnosticArtifacts } from "@ykdz/template-core/ci-diagnostic-artifact";
|
|
7
|
+
import { collectGeneratedManifestCatalogReferences, selectTemplateDependencyCatalogEntries, } from "@ykdz/template-core/dependency-catalog";
|
|
8
|
+
import { planDevelopmentContainerToolLayersSync, } from "@ykdz/template-core/development-container-tool-layer";
|
|
9
|
+
import { editorCustomizationForCapabilities, loadEditorCustomizationDeclarations, } from "@ykdz/template-core/editor-customization";
|
|
10
|
+
import { normalizeEnvironmentNeeds, parseEnvironmentNeedsMetadata, playwrightBrowserAssetsEnvironmentNeed, renderDeploymentCheckCommand, renderFixCommand, renderRootCheckCommand, renderTurboRunCommand, shellCheckEnvironmentNeed, } from "@ykdz/template-core/module-graph";
|
|
11
|
+
import { assertPackageContribution, assertPackageContributionCommandNames, } from "@ykdz/template-core/package-contribution";
|
|
12
|
+
import { assertProjectBlueprint, assertProjectBlueprintDraft, isValidNewNpmPackageName, validateNewPackagePath, validateProjectBlueprint as validateCoreProjectBlueprint, } from "@ykdz/template-core/project-blueprint";
|
|
13
|
+
import { projectCheckWorkflowTemplateSource, projectCheckWorkflowTemplateReplacements, projectDependabotTemplateReplacements, } from "@ykdz/template-core/project-github";
|
|
14
|
+
import { canConsumeNodePackageNameImport, canLinkNodePackageRoles, canProvideSourceConditionPackageNameImport, planExplicitProjectLinks, } from "@ykdz/template-core/project-linking-v2";
|
|
15
|
+
import { validateProjectProjectionPlan } from "@ykdz/template-core/project-projection";
|
|
16
|
+
import { releaseToolchainSnapshot } from "@ykdz/template-core/release-toolchain-snapshot";
|
|
17
|
+
import { resolveTemplateSource, } from "@ykdz/template-core/renderer";
|
|
18
|
+
import { parse as parseToml } from "smol-toml";
|
|
19
|
+
import ts from "typescript";
|
|
16
20
|
import { isValidDefaultPackageScope, parseGenerationRecord, } from "./generation-record.js";
|
|
17
21
|
import { rustBinDefinition } from "./rust-bin/definition.js";
|
|
18
22
|
import { githubCliDevelopmentContainerToolLayer } from "./shared/development-container.js";
|
|
@@ -25,6 +29,20 @@ import { vikeAppDefinition } from "./vike-app/definition.js";
|
|
|
25
29
|
import { vueAppDefinition } from "./vue-app/definition.js";
|
|
26
30
|
import { vueHonoAppDefinition } from "./vue-hono-app/definition.js";
|
|
27
31
|
const localTemplateMetadataStateKey = Symbol("localTemplateMetadataState");
|
|
32
|
+
export class PackageAdditionBusinessConflict extends Error {
|
|
33
|
+
kind;
|
|
34
|
+
existing;
|
|
35
|
+
requested;
|
|
36
|
+
missingLink;
|
|
37
|
+
constructor(kind, existing, requested, missingLink) {
|
|
38
|
+
super("Package Addition business conflict");
|
|
39
|
+
this.kind = kind;
|
|
40
|
+
this.existing = existing;
|
|
41
|
+
this.requested = requested;
|
|
42
|
+
if (missingLink !== undefined)
|
|
43
|
+
this.missingLink = missingLink;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
28
46
|
const environmentNeedsPath = ".template/environment-needs.json";
|
|
29
47
|
const packageManifestKeyOrder = [
|
|
30
48
|
"name",
|
|
@@ -157,12 +175,123 @@ function readGenerationRecord(options) {
|
|
|
157
175
|
const generationPath = path.join(options.repositoryRoot, ".template/generation.json");
|
|
158
176
|
return parseGenerationRecord(readJsonFile(generationPath, "Generation Record facts"));
|
|
159
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Package Addition 的目标根 package.json 允许两种 Node 声明:旧仓库的纯大版本
|
|
180
|
+
* ("24")与精确版本("24.16.0"),两者都能派生大版本;范围表达式与两段版本拒绝。
|
|
181
|
+
*/
|
|
182
|
+
const nodeMajorOrExactVersionPattern = /^(\d+)(?:\.(\d+)\.(\d+))?$/u;
|
|
183
|
+
/** 与 npm packageManager 字段一致的精确 pnpm pin(可带预发布或构建元数据)。 */
|
|
184
|
+
const exactPnpmPinPattern = /^pnpm@\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/u;
|
|
185
|
+
/**
|
|
186
|
+
* 目标根现行版本声明缺失或形状错误时的显式带形状内部失败:点名文件与字段、实际值与修正动作,
|
|
187
|
+
* 由 Package Addition 准备边界传递给命令层;其他 metadata 错误保持通用。
|
|
188
|
+
*/
|
|
189
|
+
class PackageAdditionTargetDeclarationFailure extends Error {
|
|
190
|
+
field;
|
|
191
|
+
suggestion;
|
|
192
|
+
constructor(file, field, requirement, actualDeclaration, suggestion) {
|
|
193
|
+
super(`加包需要目标仓库根 ${file} 的 ${field} ${requirement},实际收到 ${actualDeclaration}。${suggestion}`);
|
|
194
|
+
this.field = field;
|
|
195
|
+
this.suggestion = suggestion;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Package Addition 的版本上下文来自目标仓库根 package.json 的当前声明,因此升级过
|
|
200
|
+
* Node 或 pnpm 的仓库会继续按自身版本加包;Generation Record 的 toolchain 只保留为
|
|
201
|
+
* 初始化历史。
|
|
202
|
+
*/
|
|
203
|
+
function readPackageAdditionVersionFacts(repositoryRoot) {
|
|
204
|
+
const manifest = readRepositoryJsonRecord({
|
|
205
|
+
repositoryRoot,
|
|
206
|
+
relativePath: "package.json",
|
|
207
|
+
label: "root Manifest",
|
|
208
|
+
});
|
|
209
|
+
const nodeDeclaration = isRecord(manifest.engines)
|
|
210
|
+
? manifest.engines.node
|
|
211
|
+
: undefined;
|
|
212
|
+
const nodeDeclarationMatch = typeof nodeDeclaration === "string"
|
|
213
|
+
? nodeMajorOrExactVersionPattern.exec(nodeDeclaration)
|
|
214
|
+
: undefined;
|
|
215
|
+
const nodeLtsMajor = nodeDeclarationMatch?.[1];
|
|
216
|
+
if (nodeLtsMajor === undefined || typeof nodeDeclaration !== "string") {
|
|
217
|
+
throw new PackageAdditionTargetDeclarationFailure("package.json", "engines.node", '声明单个 Node 大版本("24")或精确 Node 版本("24.16.0")', JSON.stringify(nodeDeclaration ?? null), "请先修改根 package.json 的 engines.node 声明再加包。");
|
|
218
|
+
}
|
|
219
|
+
const packageManagerDeclaration = manifest.packageManager;
|
|
220
|
+
if (typeof packageManagerDeclaration !== "string" ||
|
|
221
|
+
!exactPnpmPinPattern.test(packageManagerDeclaration)) {
|
|
222
|
+
throw new PackageAdditionTargetDeclarationFailure("package.json", "packageManager", '声明精确 pnpm 版本("pnpm@11.21.0")', JSON.stringify(packageManagerDeclaration ?? null), "请先修改根 package.json 的 packageManager 声明再加包。");
|
|
223
|
+
}
|
|
224
|
+
// 根只声明大版本时没有诚实的精确 patch 可传,保持缺省而不伪造。
|
|
225
|
+
return {
|
|
226
|
+
toolchain: {
|
|
227
|
+
nodeLtsMajor,
|
|
228
|
+
packageManagerPin: packageManagerDeclaration,
|
|
229
|
+
...(nodeDeclarationMatch?.[2] === undefined
|
|
230
|
+
? {}
|
|
231
|
+
: { nodeVersion: nodeDeclaration }),
|
|
232
|
+
},
|
|
233
|
+
rootNodeDeclaration: nodeDeclaration,
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
/** 生成仓库根 Rust 声明的唯一文件名;所有权判定与投影保留都只经这个接缝引用它。 */
|
|
237
|
+
const rootRustDeclarationFileName = "rust-toolchain.toml";
|
|
238
|
+
/**
|
|
239
|
+
* 已选用 Rust 的目标仓库由根 rust-toolchain.toml 的 channel 拥有后续 Rust 版本选择,因此加包
|
|
240
|
+
* 按该现行声明重放根投影与开发容器初值。声明缺失、非法 TOML 或 channel 形状错误时在此失败,
|
|
241
|
+
* 不回退 CLI 发版快照、Generation Record 历史或 ambient 环境。
|
|
242
|
+
*/
|
|
243
|
+
function readPackageAdditionTargetRustChannel(repositoryRoot) {
|
|
244
|
+
const relativePath = rootRustDeclarationFileName;
|
|
245
|
+
const filePath = path.join(repositoryRoot, relativePath);
|
|
246
|
+
if (!existsSync(filePath)) {
|
|
247
|
+
throw new PackageAdditionTargetDeclarationFailure(relativePath, "[toolchain].channel", "存在", "文件不存在", `请先创建根 ${relativePath},在 [toolchain] 表内声明 channel 再加包。`);
|
|
248
|
+
}
|
|
249
|
+
let declaration;
|
|
250
|
+
try {
|
|
251
|
+
declaration = parseToml(readFileSync(filePath, "utf8"));
|
|
252
|
+
}
|
|
253
|
+
catch (error) {
|
|
254
|
+
throw new PackageAdditionTargetDeclarationFailure(relativePath, "[toolchain].channel", "是有效 TOML 声明", `无法解析:${error instanceof Error ? error.message : String(error)}`, `请先修正根 ${relativePath} 的 TOML 语法,使 [toolchain] 表内声明 channel 再加包。`);
|
|
255
|
+
}
|
|
256
|
+
const toolchain = isRecord(declaration) ? declaration.toolchain : undefined;
|
|
257
|
+
const channel = isRecord(toolchain) ? toolchain.channel : undefined;
|
|
258
|
+
if (typeof channel !== "string" || channel.trim().length === 0) {
|
|
259
|
+
throw new PackageAdditionTargetDeclarationFailure(relativePath, "[toolchain].channel", "为非空字符串", JSON.stringify(channel ?? null), `请先在根 ${relativePath} 的 [toolchain] 表内写入 channel 再加包。`);
|
|
260
|
+
}
|
|
261
|
+
return channel;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Root Rust 来源的最小接缝:从 rust-toolchain.toml 正文结构化读出 `[toolchain].channel`。
|
|
265
|
+
* 复用加包路径同一 smol-toml 真源,供模板仓投影值门核对 M5;不引入第二套版本或文件名表。
|
|
266
|
+
* 正文非法 TOML 或缺少非空 channel 时返回不可解释,由调用方按缺失/漂移分类,不静默跳过。
|
|
267
|
+
*/
|
|
268
|
+
export function readRustToolchainChannelFromToml(contents) {
|
|
269
|
+
let declaration;
|
|
270
|
+
try {
|
|
271
|
+
declaration = parseToml(contents);
|
|
272
|
+
}
|
|
273
|
+
catch (error) {
|
|
274
|
+
return {
|
|
275
|
+
reason: `不是有效 TOML 声明:${error instanceof Error ? error.message : String(error)}`,
|
|
276
|
+
status: "unreadable",
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
const toolchain = isRecord(declaration) ? declaration.toolchain : undefined;
|
|
280
|
+
const channel = isRecord(toolchain) ? toolchain.channel : undefined;
|
|
281
|
+
if (typeof channel !== "string" || channel.trim().length === 0) {
|
|
282
|
+
return {
|
|
283
|
+
reason: `[toolchain].channel 必须是非空字符串,实际为 ${JSON.stringify(channel ?? null)}`,
|
|
284
|
+
status: "unreadable",
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
return { channel, status: "explained" };
|
|
288
|
+
}
|
|
160
289
|
function readJsonFile(filePath, label) {
|
|
161
290
|
try {
|
|
162
291
|
return JSON.parse(readFileSync(filePath, "utf8"));
|
|
163
292
|
}
|
|
164
293
|
catch (error) {
|
|
165
|
-
throw new Error(`Package Addition requires valid ${label}: ${error instanceof Error ? error.message : String(error)}
|
|
294
|
+
throw new Error(`Package Addition requires valid ${label}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
166
295
|
}
|
|
167
296
|
}
|
|
168
297
|
function barePackageDefinition(definition) {
|
|
@@ -309,7 +438,8 @@ export function loadLocalTemplateMetadata(repositoryRoot) {
|
|
|
309
438
|
blueprint,
|
|
310
439
|
generationRecord,
|
|
311
440
|
});
|
|
312
|
-
const
|
|
441
|
+
const rootVersions = readPackageAdditionVersionFacts(resolvedRoot);
|
|
442
|
+
const nodeFactsContext = {
|
|
313
443
|
targetDir: resolvedRoot,
|
|
314
444
|
repositoryName: generationRecord.repositoryName,
|
|
315
445
|
defaultPackageScope: generationRecord.defaultPackageScope,
|
|
@@ -318,16 +448,37 @@ export function loadLocalTemplateMetadata(repositoryRoot) {
|
|
|
318
448
|
name: preflight.foundationPackage.definition.name,
|
|
319
449
|
},
|
|
320
450
|
},
|
|
321
|
-
toolchain:
|
|
451
|
+
toolchain: rootVersions.toolchain,
|
|
322
452
|
};
|
|
323
|
-
|
|
324
|
-
|
|
453
|
+
let context = nodeFactsContext;
|
|
454
|
+
let planningState = replayLocalTemplateMetadata({
|
|
455
|
+
context: nodeFactsContext,
|
|
325
456
|
preflight,
|
|
326
457
|
});
|
|
458
|
+
// 已有 Rust 能力事实的目标仓库由自己的根 rust-toolchain.toml 拥有后续版本选择:读出该现行
|
|
459
|
+
// channel 后重放,使根声明与开发容器初值来自同一个目标根事实;首次引入 Rust 的仓库还没有
|
|
460
|
+
// 该声明,保持缺省上下文交由建源路径处理。
|
|
461
|
+
if (normalizeRustToolchain([
|
|
462
|
+
planningState.foundationContribution,
|
|
463
|
+
...planningState.packageContributions,
|
|
464
|
+
]) !== undefined) {
|
|
465
|
+
context = {
|
|
466
|
+
...nodeFactsContext,
|
|
467
|
+
toolchain: {
|
|
468
|
+
...nodeFactsContext.toolchain,
|
|
469
|
+
rustVersion: readPackageAdditionTargetRustChannel(resolvedRoot),
|
|
470
|
+
},
|
|
471
|
+
};
|
|
472
|
+
planningState = replayLocalTemplateMetadata({ context, preflight });
|
|
473
|
+
}
|
|
327
474
|
return {
|
|
328
475
|
blueprint,
|
|
329
476
|
context,
|
|
330
|
-
[localTemplateMetadataStateKey]: {
|
|
477
|
+
[localTemplateMetadataStateKey]: {
|
|
478
|
+
generationRecord,
|
|
479
|
+
rootNodeDeclaration: rootVersions.rootNodeDeclaration,
|
|
480
|
+
...planningState,
|
|
481
|
+
},
|
|
331
482
|
};
|
|
332
483
|
}
|
|
333
484
|
function requireReplayAdapter(options) {
|
|
@@ -405,7 +556,7 @@ function readPersistedEnvironmentNeeds(targetDir) {
|
|
|
405
556
|
value = JSON.parse(readFileSync(filePath, "utf8"));
|
|
406
557
|
}
|
|
407
558
|
catch (error) {
|
|
408
|
-
throw new Error(`Package Addition requires valid Check Environment Need facts: ${error instanceof Error ? error.message : String(error)}
|
|
559
|
+
throw new Error(`Package Addition requires valid Check Environment Need facts: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
409
560
|
}
|
|
410
561
|
try {
|
|
411
562
|
return parseEnvironmentNeedsMetadata(value);
|
|
@@ -419,8 +570,38 @@ function readExistingPackageAdditionState(options) {
|
|
|
419
570
|
const state = options.localTemplateMetadata[localTemplateMetadataStateKey];
|
|
420
571
|
const { foundationContribution, generationRecord, packageContributions: contributions, } = state;
|
|
421
572
|
const persistedEnvironmentNeeds = readPersistedEnvironmentNeeds(context.targetDir);
|
|
573
|
+
const allContributions = [foundationContribution, ...contributions];
|
|
574
|
+
const deploymentCheck = normalizeDeploymentCheck(allContributions);
|
|
575
|
+
const vueHonoJointE2e = normalizeVueHonoJointE2e(allContributions);
|
|
576
|
+
const databasePreparation = normalizeDatabasePreparation(allContributions);
|
|
422
577
|
const manifestTruthByPackagePath = new Map();
|
|
423
578
|
const requiredManifestTruthPackagePaths = new Set(options.requiredManifestTruthPackagePaths ?? []);
|
|
579
|
+
const packageByName = new Map(allContributions.map((contribution) => [
|
|
580
|
+
contribution.definition.name,
|
|
581
|
+
contribution,
|
|
582
|
+
]));
|
|
583
|
+
const capabilityPackageNames = [
|
|
584
|
+
...(databasePreparation === undefined
|
|
585
|
+
? []
|
|
586
|
+
: [
|
|
587
|
+
databasePreparation.databasePackageName,
|
|
588
|
+
databasePreparation.migrationPackageName,
|
|
589
|
+
...Object.values(databasePreparation.consumers),
|
|
590
|
+
]),
|
|
591
|
+
...(deploymentCheck === undefined
|
|
592
|
+
? []
|
|
593
|
+
: [
|
|
594
|
+
deploymentCheck.applicationPackageName,
|
|
595
|
+
deploymentCheck.databasePackageName,
|
|
596
|
+
deploymentCheck.migrationPackageName,
|
|
597
|
+
]),
|
|
598
|
+
];
|
|
599
|
+
for (const packageName of capabilityPackageNames) {
|
|
600
|
+
const contribution = packageByName.get(packageName);
|
|
601
|
+
if (contribution !== undefined) {
|
|
602
|
+
requiredManifestTruthPackagePaths.add(contribution.definition.path);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
424
605
|
for (const packagePath of requiredManifestTruthPackagePaths) {
|
|
425
606
|
if (!blueprint.packages.some((definition) => definition.path === packagePath)) {
|
|
426
607
|
throw new Error(`Package Addition requires manifest truth for unknown Package Path ${packagePath}`);
|
|
@@ -437,16 +618,26 @@ function readExistingPackageAdditionState(options) {
|
|
|
437
618
|
manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
438
619
|
}
|
|
439
620
|
catch (error) {
|
|
440
|
-
throw new Error(`Package Addition requires manifest truth for ${expectedDefinition.path}: ${error instanceof Error ? error.message : String(error)}
|
|
621
|
+
throw new Error(`Package Addition requires manifest truth for ${expectedDefinition.path}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
441
622
|
}
|
|
442
623
|
if (!isRecord(manifest) || manifest.name !== expectedDefinition.name) {
|
|
443
624
|
throw new Error(`Package Addition requires manifest truth for ${expectedDefinition.path}: expected name ${expectedDefinition.name}`);
|
|
444
625
|
}
|
|
445
626
|
manifestTruthByPackagePath.set(expectedDefinition.path, manifest);
|
|
446
627
|
}
|
|
628
|
+
assertCapabilityRepositoryTruth({
|
|
629
|
+
repositoryRoot: context.targetDir,
|
|
630
|
+
blueprint,
|
|
631
|
+
contributions: allContributions,
|
|
632
|
+
packageByName,
|
|
633
|
+
manifestTruthByPackagePath,
|
|
634
|
+
databasePreparation,
|
|
635
|
+
deploymentCheck,
|
|
636
|
+
vueHonoJointE2e,
|
|
637
|
+
});
|
|
447
638
|
const reconstructedEnvironmentNeeds = normalizeEnvironmentNeeds({
|
|
448
|
-
check:
|
|
449
|
-
deployment:
|
|
639
|
+
check: foundationCheckEnvironmentNeeds(allContributions, deploymentCheck, vueHonoJointE2e),
|
|
640
|
+
deployment: deploymentCheck?.environmentNeeds ?? [],
|
|
450
641
|
});
|
|
451
642
|
if (JSON.stringify(reconstructedEnvironmentNeeds) !==
|
|
452
643
|
JSON.stringify(persistedEnvironmentNeeds)) {
|
|
@@ -456,7 +647,6 @@ function readExistingPackageAdditionState(options) {
|
|
|
456
647
|
foundationContribution,
|
|
457
648
|
contributions,
|
|
458
649
|
manifestTruthByPackagePath,
|
|
459
|
-
deploymentEnvironmentNeeds: persistedEnvironmentNeeds.deployment,
|
|
460
650
|
generationRecord,
|
|
461
651
|
};
|
|
462
652
|
}
|
|
@@ -504,13 +694,14 @@ function contributedDevcontainerComposition(options) {
|
|
|
504
694
|
buildArguments: [
|
|
505
695
|
{
|
|
506
696
|
name: "NODE_VERSION",
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
{
|
|
510
|
-
name: "PACKAGE_MANAGER_PIN",
|
|
511
|
-
value: options.context.toolchain.packageManagerPin,
|
|
697
|
+
// 根 Node 声明原文是 M1 槽位唯一来源;major 与快照字段不得另作真源。
|
|
698
|
+
value: options.rootNodeDeclaration,
|
|
512
699
|
},
|
|
513
700
|
],
|
|
701
|
+
probes: [
|
|
702
|
+
{ identity: "procps", command: "ps", args: ["--version"] },
|
|
703
|
+
{ identity: "bubblewrap", command: "bwrap", args: ["--version"] },
|
|
704
|
+
],
|
|
514
705
|
mounts: [
|
|
515
706
|
{
|
|
516
707
|
identity: "pnpm-store",
|
|
@@ -531,8 +722,7 @@ function contributedDevcontainerComposition(options) {
|
|
|
531
722
|
to: ".devcontainer/devcontainer.json",
|
|
532
723
|
replacements: {
|
|
533
724
|
PROJECT_NAME: options.context.repositoryName,
|
|
534
|
-
|
|
535
|
-
PACKAGE_MANAGER_PIN: options.context.toolchain.packageManagerPin,
|
|
725
|
+
NODE_VERSION: options.rootNodeDeclaration,
|
|
536
726
|
},
|
|
537
727
|
},
|
|
538
728
|
{
|
|
@@ -573,191 +763,1088 @@ function contributedDevcontainerComposition(options) {
|
|
|
573
763
|
toolLayers: layerPlan.layers,
|
|
574
764
|
buildArguments: layerPlan.buildArguments,
|
|
575
765
|
mounts: layerPlan.mounts,
|
|
576
|
-
probes:
|
|
766
|
+
probes: [
|
|
767
|
+
...layerPlan.probes,
|
|
768
|
+
{
|
|
769
|
+
identity: "docker-daemon",
|
|
770
|
+
command: "docker",
|
|
771
|
+
args: ["version"],
|
|
772
|
+
failureMessage: "无法连接宿主 Docker;请检查宿主 daemon 是否运行,以及开发容器 Feature 的连接配置与权限。",
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
identity: "docker-buildx",
|
|
776
|
+
command: "docker",
|
|
777
|
+
args: ["buildx", "version"],
|
|
778
|
+
failureMessage: "Buildx 不可用;请重建开发容器以完成官方 Feature 安装。",
|
|
779
|
+
},
|
|
780
|
+
{
|
|
781
|
+
identity: "docker-compose",
|
|
782
|
+
command: "docker",
|
|
783
|
+
args: ["compose", "version"],
|
|
784
|
+
failureMessage: "Compose 不可用;请重建开发容器以完成官方 Feature 安装。",
|
|
785
|
+
},
|
|
786
|
+
],
|
|
577
787
|
};
|
|
578
788
|
}
|
|
579
|
-
function
|
|
580
|
-
const
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
if (
|
|
585
|
-
|
|
586
|
-
source: resolveTemplateSource(previous.source, previous.from),
|
|
587
|
-
from: previous.from,
|
|
588
|
-
to: previous.to,
|
|
589
|
-
replacements: previous.replacements ?? {},
|
|
590
|
-
});
|
|
591
|
-
const fingerprint = JSON.stringify({
|
|
592
|
-
source: resolveTemplateSource(file.source, file.from),
|
|
593
|
-
from: file.from,
|
|
594
|
-
to: file.to,
|
|
595
|
-
replacements: file.replacements ?? {},
|
|
596
|
-
});
|
|
597
|
-
if (fingerprint !== previousFingerprint) {
|
|
598
|
-
throw new Error(`Foundation Template File identity ${file.identity} has conflicting descriptors`);
|
|
599
|
-
}
|
|
600
|
-
continue;
|
|
789
|
+
function normalizeDatabasePreparation(contributions) {
|
|
790
|
+
const declarations = contributions.flatMap((contribution) => {
|
|
791
|
+
const capability = contribution.foundation.databasePreparation;
|
|
792
|
+
if (capability === undefined)
|
|
793
|
+
return [];
|
|
794
|
+
if (capability.kind !== "sqlite-database-preparation") {
|
|
795
|
+
throw new Error("Database Preparation has an unsupported capability kind");
|
|
601
796
|
}
|
|
602
|
-
const
|
|
603
|
-
|
|
604
|
-
|
|
797
|
+
const consumers = Object.fromEntries(capability.consumers.map((consumer) => [
|
|
798
|
+
consumer.kind,
|
|
799
|
+
consumer.packageName,
|
|
800
|
+
]));
|
|
801
|
+
if (capability.consumers.length !== 3 ||
|
|
802
|
+
new Set(capability.consumers.map((consumer) => consumer.kind)).size !==
|
|
803
|
+
3 ||
|
|
804
|
+
consumers["application-dev"] === undefined ||
|
|
805
|
+
consumers["database-test"] === undefined ||
|
|
806
|
+
consumers["application-e2e"] === undefined) {
|
|
807
|
+
throw new Error("Database Preparation must declare application-dev, database-test, and application-e2e consumers exactly once");
|
|
605
808
|
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
const rust = contribution.foundation.toolchains.rust;
|
|
622
|
-
return rust === undefined
|
|
623
|
-
? []
|
|
624
|
-
: [
|
|
625
|
-
JSON.stringify({
|
|
626
|
-
toolchain: rust.toolchain,
|
|
627
|
-
components: [...new Set(rust.components)].toSorted(),
|
|
809
|
+
const normalizedConsumers = {
|
|
810
|
+
"application-dev": consumers["application-dev"],
|
|
811
|
+
"database-test": consumers["database-test"],
|
|
812
|
+
"application-e2e": consumers["application-e2e"],
|
|
813
|
+
};
|
|
814
|
+
return [
|
|
815
|
+
{
|
|
816
|
+
databasePackageName: contribution.definition.name,
|
|
817
|
+
migrationPackageName: capability.migrationPackageName,
|
|
818
|
+
consumers: normalizedConsumers,
|
|
819
|
+
fingerprint: JSON.stringify({
|
|
820
|
+
databasePackageName: contribution.definition.name,
|
|
821
|
+
migrationPackageName: capability.migrationPackageName,
|
|
822
|
+
consumers: normalizedConsumers,
|
|
823
|
+
profiles: ["dev", "test", "e2e"],
|
|
628
824
|
}),
|
|
629
|
-
|
|
825
|
+
},
|
|
826
|
+
];
|
|
630
827
|
});
|
|
631
|
-
|
|
632
|
-
|
|
828
|
+
const first = declarations.at(0);
|
|
829
|
+
if (first === undefined)
|
|
830
|
+
return undefined;
|
|
831
|
+
if (declarations.some((item) => item.fingerprint !== first.fingerprint)) {
|
|
832
|
+
throw new Error("Database Preparation has conflicting capability declarations");
|
|
633
833
|
}
|
|
834
|
+
return first;
|
|
634
835
|
}
|
|
635
|
-
function
|
|
636
|
-
const
|
|
637
|
-
|
|
836
|
+
function databasePreparationCommands(preparation) {
|
|
837
|
+
const run = (profile, packageName, task) => `DATABASE_PROFILE=${profile} pnpm --filter ${packageName} run ${task}`;
|
|
838
|
+
return {
|
|
839
|
+
"database:prepare:dev": [
|
|
840
|
+
run("dev", preparation.migrationPackageName, "db:push"),
|
|
841
|
+
run("dev", preparation.databasePackageName, "db:seed:example"),
|
|
842
|
+
].join(" && "),
|
|
843
|
+
"database:prepare:test": [
|
|
844
|
+
run("test", preparation.databasePackageName, "db:reset"),
|
|
845
|
+
run("test", preparation.migrationPackageName, "db:push"),
|
|
846
|
+
run("test", preparation.databasePackageName, "db:seed:example"),
|
|
847
|
+
].join(" && "),
|
|
848
|
+
"database:prepare:e2e": [
|
|
849
|
+
run("e2e", preparation.databasePackageName, "db:reset"),
|
|
850
|
+
run("e2e", preparation.migrationPackageName, "db:push"),
|
|
851
|
+
run("e2e", preparation.databasePackageName, "db:seed:example"),
|
|
852
|
+
].join(" && "),
|
|
853
|
+
dev: `pnpm run database:prepare:dev && turbo watch dev --filter=${preparation.consumers["application-dev"]}`,
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
function databasePreparationTurboTasks(preparation) {
|
|
857
|
+
return {
|
|
858
|
+
"//#database:prepare:dev": { cache: false },
|
|
859
|
+
"//#database:prepare:test": { cache: false },
|
|
860
|
+
"//#database:prepare:e2e": { cache: false },
|
|
861
|
+
[`${preparation.databasePackageName}#test`]: {
|
|
862
|
+
dependsOn: ["//#database:prepare:test"],
|
|
863
|
+
},
|
|
864
|
+
[`${preparation.migrationPackageName}#typecheck`]: {
|
|
865
|
+
dependsOn: [`${preparation.databasePackageName}#build`],
|
|
866
|
+
},
|
|
867
|
+
[`${preparation.consumers["application-dev"]}#typecheck`]: {
|
|
868
|
+
dependsOn: [`${preparation.databasePackageName}#build`],
|
|
869
|
+
},
|
|
870
|
+
[`${preparation.consumers["application-dev"]}#dev`]: {
|
|
871
|
+
dependsOn: [`${preparation.databasePackageName}#build`],
|
|
872
|
+
cache: false,
|
|
873
|
+
persistent: true,
|
|
874
|
+
},
|
|
875
|
+
[`${preparation.consumers["application-e2e"]}#test:e2e`]: {
|
|
876
|
+
dependsOn: [
|
|
877
|
+
"//#database:prepare:e2e",
|
|
878
|
+
`${preparation.databasePackageName}#build`,
|
|
879
|
+
"build",
|
|
880
|
+
],
|
|
881
|
+
cache: false,
|
|
882
|
+
},
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
function deploymentTurboTasks(deploymentCheck) {
|
|
886
|
+
return {
|
|
887
|
+
"//#deployment": {
|
|
888
|
+
dependsOn: [
|
|
889
|
+
`${deploymentCheck.applicationPackageName}#build`,
|
|
890
|
+
`${deploymentCheck.databasePackageName}#build`,
|
|
891
|
+
`${deploymentCheck.migrationPackageName}#build`,
|
|
892
|
+
],
|
|
893
|
+
cache: false,
|
|
894
|
+
},
|
|
895
|
+
};
|
|
896
|
+
}
|
|
897
|
+
function vueHonoJointE2eTurboTasks(e2e) {
|
|
898
|
+
return {
|
|
899
|
+
"//#test:e2e": {
|
|
900
|
+
dependsOn: [`${e2e.apiPackageName}#build`, `${e2e.webPackageName}#build`],
|
|
901
|
+
cache: false,
|
|
902
|
+
},
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
function assertDatabasePreparationManifestTruth(options) {
|
|
906
|
+
const { preparation, packageByName, manifestTruthByPackagePath } = options;
|
|
907
|
+
if (preparation === undefined || manifestTruthByPackagePath === undefined) {
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
910
|
+
const expectedTasks = [
|
|
911
|
+
[preparation.databasePackageName, "build"],
|
|
912
|
+
[preparation.databasePackageName, "db:reset"],
|
|
913
|
+
[preparation.databasePackageName, "db:seed:example"],
|
|
914
|
+
[preparation.databasePackageName, "test"],
|
|
915
|
+
[preparation.migrationPackageName, "db:push"],
|
|
916
|
+
[preparation.migrationPackageName, "typecheck"],
|
|
917
|
+
[preparation.consumers["application-dev"], "dev"],
|
|
918
|
+
[preparation.consumers["application-dev"], "typecheck"],
|
|
919
|
+
[preparation.consumers["application-e2e"], "build"],
|
|
920
|
+
[preparation.consumers["application-e2e"], "test:e2e"],
|
|
638
921
|
];
|
|
639
|
-
const
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
const
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
922
|
+
for (const [packageName, taskName] of expectedTasks) {
|
|
923
|
+
const contribution = requireContributionByName(packageByName, packageName, "Database Preparation");
|
|
924
|
+
const manifest = requireManifestTruth(manifestTruthByPackagePath, contribution, "Database Preparation");
|
|
925
|
+
const actualScripts = manifest.scripts;
|
|
926
|
+
const expectedScripts = contribution.manifest.scripts;
|
|
927
|
+
const actual = isRecord(actualScripts)
|
|
928
|
+
? actualScripts[taskName]
|
|
929
|
+
: undefined;
|
|
930
|
+
const expected = isRecord(expectedScripts)
|
|
931
|
+
? expectedScripts[taskName]
|
|
932
|
+
: undefined;
|
|
933
|
+
if (actual !== expected) {
|
|
934
|
+
throw new Error(`Database Preparation requires exact ${packageName} script ${taskName}`);
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
function normalizeDeploymentCheck(contributions) {
|
|
939
|
+
const declarations = contributions.flatMap((contribution) => {
|
|
940
|
+
const check = contribution.foundation.deploymentCheck;
|
|
941
|
+
if (check === undefined)
|
|
942
|
+
return [];
|
|
943
|
+
if (check.kind !== "application-container-with-database-migrations") {
|
|
944
|
+
throw new Error("Deployment Check has an unsupported capability kind");
|
|
945
|
+
}
|
|
946
|
+
return [{ ...check, declaringPackagePath: contribution.definition.path }];
|
|
947
|
+
});
|
|
948
|
+
if (declarations.length > 1) {
|
|
949
|
+
throw new Error("Deployment Check has multiple capability declarations");
|
|
950
|
+
}
|
|
951
|
+
return declarations.at(0);
|
|
952
|
+
}
|
|
953
|
+
function normalizeVueHonoJointE2e(contributions) {
|
|
954
|
+
const declarations = contributions.flatMap((contribution) => {
|
|
955
|
+
const e2e = contribution.foundation.vueHonoJointE2e;
|
|
956
|
+
if (e2e === undefined)
|
|
957
|
+
return [];
|
|
958
|
+
if (e2e.kind !== "vue-hono-joint-e2e") {
|
|
959
|
+
throw new Error("Vue-Hono joint E2E has an unsupported capability kind");
|
|
960
|
+
}
|
|
961
|
+
return [
|
|
962
|
+
{
|
|
963
|
+
...e2e,
|
|
964
|
+
webPackageName: contribution.definition.name,
|
|
965
|
+
declaringPackagePath: contribution.definition.path,
|
|
966
|
+
},
|
|
651
967
|
];
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
if (extra.length > 0)
|
|
656
|
-
extraDirectories[ecosystem] = extra;
|
|
968
|
+
});
|
|
969
|
+
if (declarations.length > 1) {
|
|
970
|
+
throw new Error("Vue-Hono joint E2E has multiple capability declarations");
|
|
657
971
|
}
|
|
658
|
-
return
|
|
659
|
-
ecosystems,
|
|
660
|
-
...(Object.keys(directories).length === 0 ? {} : { directories }),
|
|
661
|
-
...(Object.keys(extraDirectories).length === 0 ? {} : { extraDirectories }),
|
|
662
|
-
interval: "weekly",
|
|
663
|
-
};
|
|
972
|
+
return declarations.at(0);
|
|
664
973
|
}
|
|
665
|
-
function
|
|
666
|
-
const
|
|
667
|
-
if (
|
|
668
|
-
throw new Error(
|
|
974
|
+
function requireContributionByName(packageByName, packageName, capability) {
|
|
975
|
+
const contribution = packageByName.get(packageName);
|
|
976
|
+
if (contribution === undefined) {
|
|
977
|
+
throw new Error(`${capability} references unknown Package ${packageName}`);
|
|
669
978
|
}
|
|
670
|
-
return
|
|
979
|
+
return contribution;
|
|
671
980
|
}
|
|
672
|
-
function
|
|
673
|
-
const
|
|
674
|
-
if (
|
|
675
|
-
throw new Error(
|
|
981
|
+
function requireManifestTruth(manifestTruthByPackagePath, contribution, capability) {
|
|
982
|
+
const manifest = manifestTruthByPackagePath.get(contribution.definition.path);
|
|
983
|
+
if (manifest === undefined) {
|
|
984
|
+
throw new Error(`${capability} requires manifest truth for ${contribution.definition.path}`);
|
|
676
985
|
}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
986
|
+
return manifest;
|
|
987
|
+
}
|
|
988
|
+
function assertExpectedRecordMembers(options) {
|
|
989
|
+
if (!isRecord(options.expected)) {
|
|
990
|
+
throw new Error(`${options.label} replay did not provide object truth`);
|
|
991
|
+
}
|
|
992
|
+
if (!isRecord(options.actual)) {
|
|
993
|
+
throw new Error(`${options.label} must be an object`);
|
|
994
|
+
}
|
|
995
|
+
for (const [key, expectedValue] of Object.entries(options.expected)) {
|
|
996
|
+
if (!isDeepStrictEqual(options.actual[key], expectedValue)) {
|
|
997
|
+
throw new Error(`${options.label} must preserve replayed member ${key}`);
|
|
998
|
+
}
|
|
680
999
|
}
|
|
681
|
-
return candidate;
|
|
682
1000
|
}
|
|
683
|
-
function
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
1001
|
+
function assertArtifactConditionOrder(options) {
|
|
1002
|
+
if (!isRecord(options.expected) || !isRecord(options.actual))
|
|
1003
|
+
return;
|
|
1004
|
+
const conditionNames = ["source", "types", "default"];
|
|
1005
|
+
const expectedConditions = Object.keys(options.expected).filter((name) => conditionNames.includes(name));
|
|
1006
|
+
if (!expectedConditions.includes("source") ||
|
|
1007
|
+
!expectedConditions.some((name) => name === "types" || name === "default")) {
|
|
1008
|
+
return;
|
|
1009
|
+
}
|
|
1010
|
+
const actualConditions = Object.keys(options.actual).filter((name) => expectedConditions.includes(name));
|
|
1011
|
+
if (!isDeepStrictEqual(actualConditions, expectedConditions)) {
|
|
1012
|
+
throw new Error(`${options.label} must preserve replayed condition order`);
|
|
1013
|
+
}
|
|
689
1014
|
}
|
|
690
|
-
function
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
const
|
|
694
|
-
|
|
695
|
-
|
|
1015
|
+
function assertDatabaseArtifactConditionTruth(options) {
|
|
1016
|
+
if (!isRecord(options.actual) || !isRecord(options.expected))
|
|
1017
|
+
return;
|
|
1018
|
+
for (const [memberName, expectedMember] of Object.entries(options.expected)) {
|
|
1019
|
+
assertArtifactConditionOrder({
|
|
1020
|
+
actual: options.actual[memberName],
|
|
1021
|
+
expected: expectedMember,
|
|
1022
|
+
label: `${options.label} ${memberName}`,
|
|
1023
|
+
});
|
|
696
1024
|
}
|
|
697
|
-
|
|
1025
|
+
}
|
|
1026
|
+
function assertDatabaseArtifactManifestTruth(options) {
|
|
1027
|
+
if (options.preparation === undefined)
|
|
1028
|
+
return;
|
|
1029
|
+
const database = requireContributionByName(options.packageByName, options.preparation.databasePackageName, "Database Preparation");
|
|
1030
|
+
const actual = requireManifestTruth(options.manifestTruthByPackagePath, database, "Database Preparation");
|
|
1031
|
+
const expected = database.manifest;
|
|
1032
|
+
if (actual.type !== expected.type || expected.type !== "module") {
|
|
1033
|
+
throw new Error(`Database Preparation requires ${database.definition.name} manifest type module`);
|
|
1034
|
+
}
|
|
1035
|
+
if (!Array.isArray(expected.files)) {
|
|
1036
|
+
throw new Error(`Database Preparation replay for ${database.definition.name} did not provide files truth`);
|
|
1037
|
+
}
|
|
1038
|
+
const actualFiles = actual.files;
|
|
1039
|
+
if (!Array.isArray(actualFiles) ||
|
|
1040
|
+
expected.files.some((expectedFile) => !actualFiles.some((actualFile) => isDeepStrictEqual(actualFile, expectedFile)))) {
|
|
1041
|
+
throw new Error(`Database Preparation requires ${database.definition.name} public build files`);
|
|
1042
|
+
}
|
|
1043
|
+
assertExpectedRecordMembers({
|
|
1044
|
+
actual: actual.exports,
|
|
1045
|
+
expected: expected.exports,
|
|
1046
|
+
label: `Database Preparation ${database.definition.name} exports`,
|
|
1047
|
+
});
|
|
1048
|
+
assertDatabaseArtifactConditionTruth({
|
|
1049
|
+
actual: actual.exports,
|
|
1050
|
+
expected: expected.exports,
|
|
1051
|
+
label: `Database Preparation ${database.definition.name} exports`,
|
|
1052
|
+
});
|
|
1053
|
+
assertExpectedRecordMembers({
|
|
1054
|
+
actual: actual.imports,
|
|
1055
|
+
expected: expected.imports,
|
|
1056
|
+
label: `Database Preparation ${database.definition.name} imports`,
|
|
1057
|
+
});
|
|
1058
|
+
assertDatabaseArtifactConditionTruth({
|
|
1059
|
+
actual: actual.imports,
|
|
1060
|
+
expected: expected.imports,
|
|
1061
|
+
label: `Database Preparation ${database.definition.name} imports`,
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1064
|
+
function assertDatabaseProjectLinkManifestTruth(options) {
|
|
1065
|
+
if (options.preparation === undefined)
|
|
1066
|
+
return;
|
|
1067
|
+
const database = requireContributionByName(options.packageByName, options.preparation.databasePackageName, "Database Preparation");
|
|
1068
|
+
const expectedLinks = planExplicitProjectLinks({
|
|
698
1069
|
blueprint: options.blueprint,
|
|
699
1070
|
contributions: options.contributions,
|
|
700
|
-
|
|
1071
|
+
});
|
|
1072
|
+
for (const intent of options.blueprint.packageLinkIntents ?? []) {
|
|
1073
|
+
if (intent.providerPackagePath !== database.definition.path)
|
|
1074
|
+
continue;
|
|
1075
|
+
const consumer = options.contributions.find((candidate) => candidate.definition.path === intent.consumerPackagePath);
|
|
1076
|
+
if (consumer === undefined) {
|
|
1077
|
+
throw new Error(`Database Preparation Project Link references unknown consumer ${intent.consumerPackagePath}`);
|
|
1078
|
+
}
|
|
1079
|
+
const actual = requireManifestTruth(options.manifestTruthByPackagePath, consumer, "Database Preparation Project Link");
|
|
1080
|
+
if (!isRecord(actual.dependencies) ||
|
|
1081
|
+
actual.dependencies[database.definition.name] !== "workspace:*") {
|
|
1082
|
+
throw new Error(`Database Preparation requires ${consumer.definition.name} to depend on ${database.definition.name} through workspace:*`);
|
|
1083
|
+
}
|
|
1084
|
+
const expectedMetadata = expectedLinks.manifestPatchesByPackagePath.get(consumer.definition.path)?.dependenciesMeta?.[database.definition.name];
|
|
1085
|
+
if (actual.dependenciesMeta !== undefined &&
|
|
1086
|
+
!isRecord(actual.dependenciesMeta)) {
|
|
1087
|
+
throw new Error(`Database Preparation requires valid dependency metadata in ${consumer.definition.name}`);
|
|
1088
|
+
}
|
|
1089
|
+
const actualMetadata = isRecord(actual.dependenciesMeta)
|
|
1090
|
+
? actual.dependenciesMeta[database.definition.name]
|
|
1091
|
+
: undefined;
|
|
1092
|
+
if (!isDeepStrictEqual(actualMetadata, expectedMetadata)) {
|
|
1093
|
+
throw new Error(`Database Preparation requires replayed Project Link metadata for ${consumer.definition.name} -> ${database.definition.name}`);
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
function assertDeploymentBuildManifestTruth(options) {
|
|
1098
|
+
if (options.deploymentCheck === undefined)
|
|
1099
|
+
return;
|
|
1100
|
+
for (const packageName of [
|
|
1101
|
+
options.deploymentCheck.applicationPackageName,
|
|
1102
|
+
options.deploymentCheck.databasePackageName,
|
|
1103
|
+
options.deploymentCheck.migrationPackageName,
|
|
1104
|
+
]) {
|
|
1105
|
+
const contribution = requireContributionByName(options.packageByName, packageName, "Deployment Check");
|
|
1106
|
+
const actual = requireManifestTruth(options.manifestTruthByPackagePath, contribution, "Deployment Check");
|
|
1107
|
+
const actualBuild = isRecord(actual.scripts)
|
|
1108
|
+
? actual.scripts.build
|
|
1109
|
+
: undefined;
|
|
1110
|
+
const expectedBuild = isRecord(contribution.manifest.scripts)
|
|
1111
|
+
? contribution.manifest.scripts.build
|
|
1112
|
+
: undefined;
|
|
1113
|
+
if (typeof expectedBuild !== "string" || actualBuild !== expectedBuild) {
|
|
1114
|
+
throw new Error(`Deployment Check requires exact ${packageName} manifest script build`);
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
function assertVueHonoJointE2eManifestTruth(options) {
|
|
1119
|
+
if (options.e2e === undefined)
|
|
1120
|
+
return;
|
|
1121
|
+
if (options.e2e.apiPackageName === options.e2e.webPackageName) {
|
|
1122
|
+
throw new Error("Vue-Hono joint E2E requires distinct API and web Packages");
|
|
1123
|
+
}
|
|
1124
|
+
const expectedTasks = [
|
|
1125
|
+
[options.e2e.apiPackageName, "build"],
|
|
1126
|
+
[options.e2e.apiPackageName, "start"],
|
|
1127
|
+
[options.e2e.webPackageName, "build"],
|
|
1128
|
+
[options.e2e.webPackageName, "preview"],
|
|
1129
|
+
];
|
|
1130
|
+
for (const [packageName, taskName] of expectedTasks) {
|
|
1131
|
+
const contribution = requireContributionByName(options.packageByName, packageName, "Vue-Hono joint E2E");
|
|
1132
|
+
const actual = requireManifestTruth(options.manifestTruthByPackagePath, contribution, "Vue-Hono joint E2E");
|
|
1133
|
+
const expected = isRecord(contribution.manifest.scripts)
|
|
1134
|
+
? contribution.manifest.scripts[taskName]
|
|
1135
|
+
: undefined;
|
|
1136
|
+
const actualScript = isRecord(actual.scripts)
|
|
1137
|
+
? actual.scripts[taskName]
|
|
1138
|
+
: undefined;
|
|
1139
|
+
if (typeof expected !== "string" || actualScript !== expected) {
|
|
1140
|
+
throw new Error(`Vue-Hono joint E2E requires exact ${packageName} manifest script ${taskName}`);
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
function readRepositoryJsonRecord(options) {
|
|
1145
|
+
const value = readJsonFile(path.join(options.repositoryRoot, options.relativePath), `${options.label} in ${options.relativePath}`);
|
|
1146
|
+
if (!isRecord(value)) {
|
|
1147
|
+
throw new Error(`Package Addition requires ${options.label} in ${options.relativePath} to be an object`);
|
|
1148
|
+
}
|
|
1149
|
+
return value;
|
|
1150
|
+
}
|
|
1151
|
+
function assertRootCapabilityManifestTruth(options) {
|
|
1152
|
+
if (options.databasePreparation === undefined &&
|
|
1153
|
+
options.deploymentCheck === undefined &&
|
|
1154
|
+
options.vueHonoJointE2e === undefined) {
|
|
1155
|
+
return;
|
|
1156
|
+
}
|
|
1157
|
+
const manifest = readRepositoryJsonRecord({
|
|
1158
|
+
repositoryRoot: options.repositoryRoot,
|
|
1159
|
+
relativePath: "package.json",
|
|
1160
|
+
label: "root Manifest Truth",
|
|
1161
|
+
});
|
|
1162
|
+
if (!isRecord(manifest.scripts)) {
|
|
1163
|
+
throw new Error("Package Addition requires root manifest scripts truth");
|
|
1164
|
+
}
|
|
1165
|
+
const expectedScripts = {
|
|
1166
|
+
...(options.databasePreparation === undefined
|
|
1167
|
+
? {}
|
|
1168
|
+
: databasePreparationCommands(options.databasePreparation)),
|
|
1169
|
+
...(options.deploymentCheck === undefined
|
|
701
1170
|
? {}
|
|
702
1171
|
: {
|
|
703
|
-
|
|
1172
|
+
deployment: "node --conditions=source scripts/check-standalone-deployment.ts",
|
|
1173
|
+
"check:deployment": renderDeploymentCheckCommand(),
|
|
704
1174
|
}),
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
const
|
|
710
|
-
|
|
711
|
-
|
|
1175
|
+
...(options.vueHonoJointE2e === undefined
|
|
1176
|
+
? {}
|
|
1177
|
+
: { "test:e2e": "playwright test" }),
|
|
1178
|
+
};
|
|
1179
|
+
for (const [scriptName, expectedCommand] of Object.entries(expectedScripts)) {
|
|
1180
|
+
if (manifest.scripts[scriptName] !== expectedCommand) {
|
|
1181
|
+
throw new Error(`Package Addition requires exact root manifest script ${scriptName}`);
|
|
1182
|
+
}
|
|
712
1183
|
}
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
1184
|
+
}
|
|
1185
|
+
function assertTurboTaskTruth(options) {
|
|
1186
|
+
if (!isRecord(options.config.tasks)) {
|
|
1187
|
+
throw new Error(`${options.label} requires Turbo tasks truth`);
|
|
1188
|
+
}
|
|
1189
|
+
for (const [taskName, expectedTask] of Object.entries(options.expectedTasks)) {
|
|
1190
|
+
const actualTask = options.config.tasks[taskName];
|
|
1191
|
+
if (!isRecord(actualTask)) {
|
|
1192
|
+
throw new Error(`${options.label} requires Turbo task ${taskName}`);
|
|
717
1193
|
}
|
|
718
|
-
const
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
1194
|
+
for (const [field, expectedValue] of Object.entries(expectedTask)) {
|
|
1195
|
+
const actualValue = actualTask[field];
|
|
1196
|
+
if (Array.isArray(expectedValue)) {
|
|
1197
|
+
if (!Array.isArray(actualValue) ||
|
|
1198
|
+
expectedValue.some((expectedMember) => !actualValue.includes(expectedMember))) {
|
|
1199
|
+
throw new Error(`${options.label} requires Turbo task ${taskName} ${field}`);
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
else if (!isDeepStrictEqual(actualValue, expectedValue)) {
|
|
1203
|
+
throw new Error(`${options.label} requires Turbo task ${taskName} ${field}`);
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
function assertCapabilityPackageTurboInheritanceTruth(options) {
|
|
1209
|
+
if (!Array.isArray(options.config.extends) ||
|
|
1210
|
+
options.config.extends.length !== 1 ||
|
|
1211
|
+
options.config.extends[0] !== "//") {
|
|
1212
|
+
throw new Error(`${options.label} requires exact Turbo extends truth`);
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
function effectiveCapabilityTaskDependencies(options) {
|
|
1216
|
+
if (options.localTask === undefined) {
|
|
1217
|
+
if (!isRecord(options.inheritedTask)) {
|
|
1218
|
+
throw new Error(`${options.label} requires Turbo task ${options.taskName}`);
|
|
1219
|
+
}
|
|
1220
|
+
return options.inheritedTask.dependsOn;
|
|
1221
|
+
}
|
|
1222
|
+
if (!isRecord(options.localTask)) {
|
|
1223
|
+
throw new Error(`${options.label} requires Turbo task ${options.taskName}`);
|
|
1224
|
+
}
|
|
1225
|
+
const extendsValue = options.localTask.extends;
|
|
1226
|
+
if (extendsValue !== undefined && typeof extendsValue !== "boolean") {
|
|
1227
|
+
throw new Error(`${options.label} requires Turbo task ${options.taskName} extends truth`);
|
|
1228
|
+
}
|
|
1229
|
+
if (extendsValue === false || options.localTask.dependsOn !== undefined) {
|
|
1230
|
+
return options.localTask.dependsOn;
|
|
1231
|
+
}
|
|
1232
|
+
if (!isRecord(options.inheritedTask)) {
|
|
1233
|
+
throw new Error(`${options.label} requires Turbo task ${options.taskName}`);
|
|
1234
|
+
}
|
|
1235
|
+
return options.inheritedTask.dependsOn;
|
|
1236
|
+
}
|
|
1237
|
+
function assertCapabilityConsumerTurboTruth(options) {
|
|
1238
|
+
const turboByPackagePath = new Map();
|
|
1239
|
+
for (const [qualifiedTaskName, expectedTask] of Object.entries(options.expectedTasks)) {
|
|
1240
|
+
if (expectedTask.dependsOn === undefined)
|
|
1241
|
+
continue;
|
|
1242
|
+
const separator = qualifiedTaskName.lastIndexOf("#");
|
|
1243
|
+
if (separator <= 0)
|
|
1244
|
+
continue;
|
|
1245
|
+
const packageName = qualifiedTaskName.slice(0, separator);
|
|
1246
|
+
const taskName = qualifiedTaskName.slice(separator + 1);
|
|
1247
|
+
const contribution = requireContributionByName(options.packageByName, packageName, "Database Preparation");
|
|
1248
|
+
const packageTurbo = turboByPackagePath.get(contribution.definition.path) ??
|
|
1249
|
+
readRepositoryJsonRecord({
|
|
1250
|
+
repositoryRoot: options.repositoryRoot,
|
|
1251
|
+
relativePath: `${contribution.definition.path}/turbo.json`,
|
|
1252
|
+
label: `${contribution.definition.name} Turbo Truth`,
|
|
1253
|
+
});
|
|
1254
|
+
turboByPackagePath.set(contribution.definition.path, packageTurbo);
|
|
1255
|
+
if (!isRecord(packageTurbo.tasks)) {
|
|
1256
|
+
throw new Error(`Package Addition ${contribution.definition.name} Turbo Truth requires Turbo tasks truth`);
|
|
1257
|
+
}
|
|
1258
|
+
assertCapabilityPackageTurboInheritanceTruth({
|
|
1259
|
+
config: packageTurbo,
|
|
1260
|
+
label: `Package Addition ${contribution.definition.name} Turbo Truth`,
|
|
1261
|
+
});
|
|
1262
|
+
const localTask = packageTurbo.tasks[taskName];
|
|
1263
|
+
const localDependencies = effectiveCapabilityTaskDependencies({
|
|
1264
|
+
localTask,
|
|
1265
|
+
inheritedTask: expectedTask,
|
|
1266
|
+
label: `Package Addition ${contribution.definition.name} Turbo Truth`,
|
|
1267
|
+
taskName,
|
|
1268
|
+
});
|
|
1269
|
+
if (!Array.isArray(localDependencies) ||
|
|
1270
|
+
expectedTask.dependsOn.some((expectedDependency) => !localDependencies.includes(expectedDependency))) {
|
|
1271
|
+
throw new Error(`Package Addition ${contribution.definition.name} Turbo Truth requires Turbo task ${taskName} dependsOn`);
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
for (const packageName of options.buildConsumerPackageNames) {
|
|
1275
|
+
const contribution = requireContributionByName(options.packageByName, packageName, "Database Preparation");
|
|
1276
|
+
const packageTurbo = turboByPackagePath.get(contribution.definition.path) ??
|
|
1277
|
+
readRepositoryJsonRecord({
|
|
1278
|
+
repositoryRoot: options.repositoryRoot,
|
|
1279
|
+
relativePath: `${contribution.definition.path}/turbo.json`,
|
|
1280
|
+
label: `${contribution.definition.name} Turbo Truth`,
|
|
1281
|
+
});
|
|
1282
|
+
turboByPackagePath.set(contribution.definition.path, packageTurbo);
|
|
1283
|
+
if (!isRecord(packageTurbo.tasks)) {
|
|
1284
|
+
throw new Error(`Package Addition ${contribution.definition.name} Turbo Truth requires Turbo tasks truth`);
|
|
1285
|
+
}
|
|
1286
|
+
assertCapabilityPackageTurboInheritanceTruth({
|
|
1287
|
+
config: packageTurbo,
|
|
1288
|
+
label: `Package Addition ${contribution.definition.name} Turbo Truth`,
|
|
1289
|
+
});
|
|
1290
|
+
const localBuild = packageTurbo.tasks.build;
|
|
1291
|
+
const qualifiedBuild = isRecord(options.rootTurbo.tasks)
|
|
1292
|
+
? options.rootTurbo.tasks[`${packageName}#build`]
|
|
1293
|
+
: undefined;
|
|
1294
|
+
const genericBuild = isRecord(options.rootTurbo.tasks)
|
|
1295
|
+
? options.rootTurbo.tasks.build
|
|
1296
|
+
: undefined;
|
|
1297
|
+
const dependencies = effectiveCapabilityTaskDependencies({
|
|
1298
|
+
localTask: localBuild,
|
|
1299
|
+
inheritedTask: qualifiedBuild === undefined ? genericBuild : qualifiedBuild,
|
|
1300
|
+
label: `Package Addition ${contribution.definition.name} Turbo Truth`,
|
|
1301
|
+
taskName: "build",
|
|
1302
|
+
});
|
|
1303
|
+
if (!Array.isArray(dependencies) ||
|
|
1304
|
+
!dependencies.some((dependency) => dependency === "^build" ||
|
|
1305
|
+
dependency === `${options.databasePackageName}#build`)) {
|
|
1306
|
+
throw new Error(`Package Addition ${contribution.definition.name} Turbo Truth requires Turbo task build dependsOn`);
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
function assertCapabilityTurboTruth(options) {
|
|
1311
|
+
if (options.databasePreparation === undefined &&
|
|
1312
|
+
options.deploymentCheck === undefined &&
|
|
1313
|
+
options.vueHonoJointE2e === undefined) {
|
|
1314
|
+
return;
|
|
1315
|
+
}
|
|
1316
|
+
const rootTurbo = readRepositoryJsonRecord({
|
|
1317
|
+
repositoryRoot: options.repositoryRoot,
|
|
1318
|
+
relativePath: "turbo.json",
|
|
1319
|
+
label: "root Turbo Truth",
|
|
1320
|
+
});
|
|
1321
|
+
assertTurboTaskTruth({
|
|
1322
|
+
config: rootTurbo,
|
|
1323
|
+
expectedTasks: {
|
|
1324
|
+
...(options.databasePreparation === undefined
|
|
1325
|
+
? {}
|
|
1326
|
+
: databasePreparationTurboTasks(options.databasePreparation)),
|
|
1327
|
+
...(options.deploymentCheck === undefined
|
|
1328
|
+
? {}
|
|
1329
|
+
: deploymentTurboTasks(options.deploymentCheck)),
|
|
1330
|
+
...(options.vueHonoJointE2e === undefined
|
|
1331
|
+
? {}
|
|
1332
|
+
: vueHonoJointE2eTurboTasks(options.vueHonoJointE2e)),
|
|
1333
|
+
},
|
|
1334
|
+
label: "Package Addition root Turbo Truth",
|
|
1335
|
+
});
|
|
1336
|
+
if (options.databasePreparation === undefined)
|
|
1337
|
+
return;
|
|
1338
|
+
const database = requireContributionByName(options.packageByName, options.databasePreparation.databasePackageName, "Database Preparation");
|
|
1339
|
+
const databaseTurbo = readRepositoryJsonRecord({
|
|
1340
|
+
repositoryRoot: options.repositoryRoot,
|
|
1341
|
+
relativePath: `${database.definition.path}/turbo.json`,
|
|
1342
|
+
label: `${database.definition.name} Turbo Truth`,
|
|
1343
|
+
});
|
|
1344
|
+
assertTurboTaskTruth({
|
|
1345
|
+
config: databaseTurbo,
|
|
1346
|
+
expectedTasks: { build: { outputs: ["dist/**"] } },
|
|
1347
|
+
label: `Package Addition ${database.definition.name} Turbo Truth`,
|
|
1348
|
+
});
|
|
1349
|
+
assertCapabilityConsumerTurboTruth({
|
|
1350
|
+
repositoryRoot: options.repositoryRoot,
|
|
1351
|
+
rootTurbo,
|
|
1352
|
+
expectedTasks: databasePreparationTurboTasks(options.databasePreparation),
|
|
1353
|
+
buildConsumerPackageNames: [
|
|
1354
|
+
options.databasePreparation.migrationPackageName,
|
|
1355
|
+
...new Set(Object.values(options.databasePreparation.consumers)),
|
|
1356
|
+
],
|
|
1357
|
+
databasePackageName: options.databasePreparation.databasePackageName,
|
|
1358
|
+
packageByName: options.packageByName,
|
|
1359
|
+
});
|
|
1360
|
+
}
|
|
1361
|
+
function unwrapTypeScriptExpression(expression) {
|
|
1362
|
+
return ts.isParenthesizedExpression(expression) ||
|
|
1363
|
+
ts.isAsExpression(expression) ||
|
|
1364
|
+
ts.isSatisfiesExpression(expression) ||
|
|
1365
|
+
ts.isTypeAssertionExpression(expression)
|
|
1366
|
+
? unwrapTypeScriptExpression(expression.expression)
|
|
1367
|
+
: expression;
|
|
1368
|
+
}
|
|
1369
|
+
function typeScriptPropertyName(name) {
|
|
1370
|
+
return ts.isIdentifier(name) || ts.isStringLiteralLike(name)
|
|
1371
|
+
? name.text
|
|
1372
|
+
: undefined;
|
|
1373
|
+
}
|
|
1374
|
+
function finalObjectLiteralPropertyValue(expression, propertyName) {
|
|
1375
|
+
let hasUnverifiableOverride = false;
|
|
1376
|
+
for (const property of [...expression.properties].reverse()) {
|
|
1377
|
+
if (ts.isSpreadAssignment(property)) {
|
|
1378
|
+
hasUnverifiableOverride = true;
|
|
1379
|
+
continue;
|
|
1380
|
+
}
|
|
1381
|
+
const name = typeScriptPropertyName(property.name);
|
|
1382
|
+
if (name === propertyName) {
|
|
1383
|
+
if (!ts.isPropertyAssignment(property) || hasUnverifiableOverride) {
|
|
1384
|
+
return undefined;
|
|
1385
|
+
}
|
|
1386
|
+
return property.initializer;
|
|
1387
|
+
}
|
|
1388
|
+
if (name === undefined) {
|
|
1389
|
+
hasUnverifiableOverride = true;
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
return undefined;
|
|
1393
|
+
}
|
|
1394
|
+
function assertDatabaseViteRuntimeTruth(options) {
|
|
1395
|
+
if (options.deploymentCheck === undefined)
|
|
1396
|
+
return;
|
|
1397
|
+
const application = requireContributionByName(options.packageByName, options.deploymentCheck.applicationPackageName, "Deployment Check");
|
|
1398
|
+
const configPath = `${application.definition.path}/vite.config.ts`;
|
|
1399
|
+
let sourceText;
|
|
1400
|
+
try {
|
|
1401
|
+
sourceText = readFileSync(path.join(options.repositoryRoot, configPath), "utf8");
|
|
1402
|
+
}
|
|
1403
|
+
catch (error) {
|
|
1404
|
+
throw new Error(`Package Addition requires Vite runtime truth in ${configPath}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
1405
|
+
}
|
|
1406
|
+
const sourceFile = ts.createSourceFile(configPath, sourceText, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
1407
|
+
if ((sourceFile.parseDiagnostics ?? []).length > 0) {
|
|
1408
|
+
throw new Error(`Package Addition requires valid Vite runtime truth in ${configPath}`);
|
|
1409
|
+
}
|
|
1410
|
+
const exportAssignment = sourceFile.statements.find((statement) => ts.isExportAssignment(statement) && !statement.isExportEquals);
|
|
1411
|
+
const exported = exportAssignment === undefined
|
|
1412
|
+
? undefined
|
|
1413
|
+
: unwrapTypeScriptExpression(exportAssignment.expression);
|
|
1414
|
+
const configCall = exported !== undefined &&
|
|
1415
|
+
ts.isCallExpression(exported) &&
|
|
1416
|
+
ts.isIdentifier(exported.expression) &&
|
|
1417
|
+
exported.expression.text === "defineConfig"
|
|
1418
|
+
? exported
|
|
1419
|
+
: undefined;
|
|
1420
|
+
const configArgument = configCall?.arguments[0];
|
|
1421
|
+
const config = configArgument === undefined
|
|
1422
|
+
? undefined
|
|
1423
|
+
: unwrapTypeScriptExpression(configArgument);
|
|
1424
|
+
const ssrValue = config !== undefined && ts.isObjectLiteralExpression(config)
|
|
1425
|
+
? finalObjectLiteralPropertyValue(config, "ssr")
|
|
1426
|
+
: undefined;
|
|
1427
|
+
const ssr = ssrValue === undefined ? undefined : unwrapTypeScriptExpression(ssrValue);
|
|
1428
|
+
const externalValue = ssr !== undefined && ts.isObjectLiteralExpression(ssr)
|
|
1429
|
+
? finalObjectLiteralPropertyValue(ssr, "external")
|
|
1430
|
+
: undefined;
|
|
1431
|
+
const external = externalValue === undefined
|
|
1432
|
+
? undefined
|
|
1433
|
+
: unwrapTypeScriptExpression(externalValue);
|
|
1434
|
+
const expectedPackageName = options.deploymentCheck.databasePackageName;
|
|
1435
|
+
const externalPackageNames = external !== undefined && ts.isArrayLiteralExpression(external)
|
|
1436
|
+
? external.elements.flatMap((element) => ts.isStringLiteralLike(element) ? [element.text] : [])
|
|
1437
|
+
: external !== undefined && ts.isStringLiteralLike(external)
|
|
1438
|
+
? [external.text]
|
|
1439
|
+
: [];
|
|
1440
|
+
if (!externalPackageNames.includes(expectedPackageName)) {
|
|
1441
|
+
throw new Error(`Package Addition requires ${configPath} to externalize ${expectedPackageName} through Vite SSR`);
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
function assertVueHonoJointE2ePlaywrightTruth(options) {
|
|
1445
|
+
if (options.e2e === undefined)
|
|
1446
|
+
return;
|
|
1447
|
+
const configPath = "playwright.config.ts";
|
|
1448
|
+
let sourceText;
|
|
1449
|
+
try {
|
|
1450
|
+
sourceText = readFileSync(path.join(options.repositoryRoot, configPath), "utf8");
|
|
1451
|
+
}
|
|
1452
|
+
catch (error) {
|
|
1453
|
+
throw new Error(`Package Addition requires Vue-Hono joint E2E root Playwright truth in ${configPath}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
1454
|
+
}
|
|
1455
|
+
const sourceFile = ts.createSourceFile(configPath, sourceText, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
1456
|
+
if ((sourceFile.parseDiagnostics ?? []).length > 0) {
|
|
1457
|
+
throw new Error(`Package Addition requires valid Vue-Hono joint E2E root Playwright truth in ${configPath}`);
|
|
1458
|
+
}
|
|
1459
|
+
const exportAssignment = sourceFile.statements.find((statement) => ts.isExportAssignment(statement) && !statement.isExportEquals);
|
|
1460
|
+
const exported = exportAssignment === undefined
|
|
1461
|
+
? undefined
|
|
1462
|
+
: unwrapTypeScriptExpression(exportAssignment.expression);
|
|
1463
|
+
const configCall = exported !== undefined &&
|
|
1464
|
+
ts.isCallExpression(exported) &&
|
|
1465
|
+
ts.isIdentifier(exported.expression) &&
|
|
1466
|
+
exported.expression.text === "defineConfig"
|
|
1467
|
+
? exported
|
|
1468
|
+
: undefined;
|
|
1469
|
+
const configArgument = configCall?.arguments[0];
|
|
1470
|
+
const config = configArgument === undefined
|
|
1471
|
+
? undefined
|
|
1472
|
+
: unwrapTypeScriptExpression(configArgument);
|
|
1473
|
+
const webServerValue = config !== undefined && ts.isObjectLiteralExpression(config)
|
|
1474
|
+
? finalObjectLiteralPropertyValue(config, "webServer")
|
|
1475
|
+
: undefined;
|
|
1476
|
+
const webServers = webServerValue === undefined
|
|
1477
|
+
? undefined
|
|
1478
|
+
: unwrapTypeScriptExpression(webServerValue);
|
|
1479
|
+
if (webServers === undefined ||
|
|
1480
|
+
!ts.isArrayLiteralExpression(webServers) ||
|
|
1481
|
+
webServers.elements.length !== 2) {
|
|
1482
|
+
throw new Error(`Package Addition requires two static Vue-Hono joint E2E web servers in ${configPath}`);
|
|
1483
|
+
}
|
|
1484
|
+
const expectedServers = [
|
|
1485
|
+
{
|
|
1486
|
+
command: `pnpm --filter ${options.e2e.apiPackageName} --fail-if-no-match run start`,
|
|
1487
|
+
portEnvironment: "PORT",
|
|
1488
|
+
portVariable: "apiPort",
|
|
1489
|
+
portInput: "PLAYWRIGHT_API_PORT",
|
|
1490
|
+
stdout: "/Hono API listening on (?<VITE_API_BASE_URL>http:\\/\\/localhost:\\d+)/",
|
|
1491
|
+
},
|
|
1492
|
+
{
|
|
1493
|
+
command: `pnpm --filter ${options.e2e.webPackageName} --fail-if-no-match run preview --host 127.0.0.1 --strictPort`,
|
|
1494
|
+
portEnvironment: "PLAYWRIGHT_WEB_PORT",
|
|
1495
|
+
portVariable: "webPort",
|
|
1496
|
+
portInput: "PLAYWRIGHT_WEB_PORT",
|
|
1497
|
+
stdout: "/Local:\\s+(?<PLAYWRIGHT_WEB_URL>http:\\/\\/127\\.0\\.0\\.1:\\d+)/",
|
|
1498
|
+
},
|
|
1499
|
+
];
|
|
1500
|
+
for (const [index, expected] of expectedServers.entries()) {
|
|
1501
|
+
const server = unwrapTypeScriptExpression(webServers.elements[index]);
|
|
1502
|
+
if (!ts.isObjectLiteralExpression(server)) {
|
|
1503
|
+
throw new Error(`Package Addition requires static Vue-Hono joint E2E web server ${index + 1} in ${configPath}`);
|
|
1504
|
+
}
|
|
1505
|
+
const command = finalObjectLiteralPropertyValue(server, "command");
|
|
1506
|
+
if (command === undefined ||
|
|
1507
|
+
!ts.isStringLiteralLike(command) ||
|
|
1508
|
+
command.text !== expected.command) {
|
|
1509
|
+
throw new Error(`Package Addition requires exact Vue-Hono joint E2E web server ${index + 1} command in ${configPath}`);
|
|
1510
|
+
}
|
|
1511
|
+
const environmentValue = finalObjectLiteralPropertyValue(server, "env");
|
|
1512
|
+
const environment = environmentValue === undefined
|
|
1513
|
+
? undefined
|
|
1514
|
+
: unwrapTypeScriptExpression(environmentValue);
|
|
1515
|
+
const environmentProperty = environment !== undefined && ts.isObjectLiteralExpression(environment)
|
|
1516
|
+
? environment.properties[0]
|
|
1517
|
+
: undefined;
|
|
1518
|
+
const portValue = environmentProperty !== undefined &&
|
|
1519
|
+
ts.isPropertyAssignment(environmentProperty) &&
|
|
1520
|
+
!ts.isComputedPropertyName(environmentProperty.name) &&
|
|
1521
|
+
(ts.isIdentifier(environmentProperty.name) ||
|
|
1522
|
+
ts.isStringLiteral(environmentProperty.name)) &&
|
|
1523
|
+
environmentProperty.name.text === expected.portEnvironment
|
|
1524
|
+
? unwrapTypeScriptExpression(environmentProperty.initializer)
|
|
1525
|
+
: undefined;
|
|
1526
|
+
if (environment === undefined ||
|
|
1527
|
+
!ts.isObjectLiteralExpression(environment) ||
|
|
1528
|
+
environment.properties.length !== 1 ||
|
|
1529
|
+
portValue === undefined ||
|
|
1530
|
+
!ts.isIdentifier(portValue) ||
|
|
1531
|
+
portValue.text !== expected.portVariable) {
|
|
1532
|
+
throw new Error(`Package Addition requires Vue-Hono joint E2E web server ${index + 1} ${expected.portEnvironment} environment in ${configPath}`);
|
|
1533
|
+
}
|
|
1534
|
+
const waitValue = finalObjectLiteralPropertyValue(server, "wait");
|
|
1535
|
+
const wait = waitValue === undefined
|
|
1536
|
+
? undefined
|
|
1537
|
+
: unwrapTypeScriptExpression(waitValue);
|
|
1538
|
+
const stdout = wait !== undefined && ts.isObjectLiteralExpression(wait)
|
|
1539
|
+
? finalObjectLiteralPropertyValue(wait, "stdout")
|
|
1540
|
+
: undefined;
|
|
1541
|
+
if (stdout === undefined ||
|
|
1542
|
+
!ts.isRegularExpressionLiteral(stdout) ||
|
|
1543
|
+
stdout.text !== expected.stdout) {
|
|
1544
|
+
throw new Error(`Package Addition requires static Vue-Hono joint E2E web server ${index + 1} stdout capture in ${configPath}`);
|
|
1545
|
+
}
|
|
1546
|
+
const reuseExistingServer = finalObjectLiteralPropertyValue(server, "reuseExistingServer");
|
|
1547
|
+
if (reuseExistingServer?.kind !== ts.SyntaxKind.FalseKeyword) {
|
|
1548
|
+
throw new Error(`Package Addition requires Vue-Hono joint E2E web server ${index + 1} native cleanup in ${configPath}`);
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
const expectedPortInputs = expectedServers.map(({ portVariable, portInput }) => ({ portVariable, portInput }));
|
|
1552
|
+
for (const expected of expectedPortInputs) {
|
|
1553
|
+
const declarations = sourceFile.statements
|
|
1554
|
+
.filter(ts.isVariableStatement)
|
|
1555
|
+
.flatMap((statement) => statement.declarationList.declarations.map((declaration) => ({
|
|
1556
|
+
declaration,
|
|
1557
|
+
declarationList: statement.declarationList,
|
|
1558
|
+
})))
|
|
1559
|
+
.filter(({ declaration }) => ts.isIdentifier(declaration.name) &&
|
|
1560
|
+
declaration.name.text === expected.portVariable);
|
|
1561
|
+
const declaration = declarations[0];
|
|
1562
|
+
if (declarations.length !== 1 ||
|
|
1563
|
+
declaration === undefined ||
|
|
1564
|
+
(declaration.declarationList.flags & ts.NodeFlags.Const) === 0) {
|
|
1565
|
+
throw new Error(`Package Addition requires one top-level const Vue-Hono joint E2E ${expected.portVariable} in ${configPath}`);
|
|
1566
|
+
}
|
|
1567
|
+
const initializer = declaration.declaration.initializer;
|
|
1568
|
+
const left = initializer !== undefined &&
|
|
1569
|
+
ts.isBinaryExpression(initializer) &&
|
|
1570
|
+
initializer.operatorToken.kind === ts.SyntaxKind.QuestionQuestionToken
|
|
1571
|
+
? initializer.left
|
|
1572
|
+
: undefined;
|
|
1573
|
+
const right = initializer !== undefined &&
|
|
1574
|
+
ts.isBinaryExpression(initializer) &&
|
|
1575
|
+
initializer.operatorToken.kind === ts.SyntaxKind.QuestionQuestionToken
|
|
1576
|
+
? initializer.right
|
|
1577
|
+
: undefined;
|
|
1578
|
+
const environmentInput = left !== undefined &&
|
|
1579
|
+
ts.isPropertyAccessExpression(left) &&
|
|
1580
|
+
ts.isPropertyAccessExpression(left.expression) &&
|
|
1581
|
+
ts.isIdentifier(left.expression.expression) &&
|
|
1582
|
+
left.expression.expression.text === "process" &&
|
|
1583
|
+
left.expression.name.text === "env"
|
|
1584
|
+
? left.name.text
|
|
1585
|
+
: undefined;
|
|
1586
|
+
if (environmentInput !== expected.portInput ||
|
|
1587
|
+
right === undefined ||
|
|
1588
|
+
!ts.isStringLiteralLike(right) ||
|
|
1589
|
+
right.text !== "0") {
|
|
1590
|
+
throw new Error(`Package Addition requires Vue-Hono joint E2E ${expected.portVariable} to read ${expected.portInput} or static port 0 in ${configPath}`);
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
function assertCapabilityRepositoryTruth(options) {
|
|
1595
|
+
assertDatabasePreparationManifestTruth({
|
|
1596
|
+
preparation: options.databasePreparation,
|
|
1597
|
+
packageByName: options.packageByName,
|
|
1598
|
+
manifestTruthByPackagePath: options.manifestTruthByPackagePath,
|
|
1599
|
+
});
|
|
1600
|
+
assertDatabaseArtifactManifestTruth({
|
|
1601
|
+
preparation: options.databasePreparation,
|
|
1602
|
+
packageByName: options.packageByName,
|
|
1603
|
+
manifestTruthByPackagePath: options.manifestTruthByPackagePath,
|
|
1604
|
+
});
|
|
1605
|
+
assertDatabaseProjectLinkManifestTruth({
|
|
1606
|
+
blueprint: options.blueprint,
|
|
1607
|
+
contributions: options.contributions,
|
|
1608
|
+
preparation: options.databasePreparation,
|
|
1609
|
+
packageByName: options.packageByName,
|
|
1610
|
+
manifestTruthByPackagePath: options.manifestTruthByPackagePath,
|
|
1611
|
+
});
|
|
1612
|
+
assertDeploymentBuildManifestTruth({
|
|
1613
|
+
deploymentCheck: options.deploymentCheck,
|
|
1614
|
+
packageByName: options.packageByName,
|
|
1615
|
+
manifestTruthByPackagePath: options.manifestTruthByPackagePath,
|
|
1616
|
+
});
|
|
1617
|
+
assertVueHonoJointE2eManifestTruth({
|
|
1618
|
+
e2e: options.vueHonoJointE2e,
|
|
1619
|
+
packageByName: options.packageByName,
|
|
1620
|
+
manifestTruthByPackagePath: options.manifestTruthByPackagePath,
|
|
1621
|
+
});
|
|
1622
|
+
assertVueHonoJointE2ePlaywrightTruth({
|
|
1623
|
+
repositoryRoot: options.repositoryRoot,
|
|
1624
|
+
e2e: options.vueHonoJointE2e,
|
|
1625
|
+
});
|
|
1626
|
+
assertRootCapabilityManifestTruth(options);
|
|
1627
|
+
assertCapabilityTurboTruth(options);
|
|
1628
|
+
assertDatabaseViteRuntimeTruth(options);
|
|
1629
|
+
}
|
|
1630
|
+
function foundationCheckEnvironmentNeeds(contributions, deploymentCheck, vueHonoJointE2e) {
|
|
1631
|
+
return [
|
|
1632
|
+
...contributions.flatMap((contribution) => contribution.environmentNeeds),
|
|
1633
|
+
...(vueHonoJointE2e === undefined
|
|
1634
|
+
? []
|
|
1635
|
+
: [
|
|
1636
|
+
playwrightBrowserAssetsEnvironmentNeed({
|
|
1637
|
+
browser: "chromium",
|
|
1638
|
+
owner: { kind: "workspace-orchestration", path: "." },
|
|
1639
|
+
}),
|
|
1640
|
+
]),
|
|
1641
|
+
...(deploymentCheck === undefined
|
|
1642
|
+
? []
|
|
1643
|
+
: [
|
|
1644
|
+
shellCheckEnvironmentNeed({
|
|
1645
|
+
kind: "workspace-orchestration",
|
|
1646
|
+
path: ".",
|
|
1647
|
+
}),
|
|
1648
|
+
]),
|
|
1649
|
+
];
|
|
1650
|
+
}
|
|
1651
|
+
function deploymentCheckDevelopmentContainerToolLayers(deploymentCheck) {
|
|
1652
|
+
if (deploymentCheck === undefined)
|
|
1653
|
+
return [];
|
|
1654
|
+
return [
|
|
1655
|
+
{
|
|
1656
|
+
identity: "shellcheck",
|
|
1657
|
+
dockerfile: deploymentCheck.sources.shellCheckDockerfile,
|
|
1658
|
+
requires: ["node-pnpm"],
|
|
1659
|
+
probes: [
|
|
1660
|
+
{
|
|
1661
|
+
identity: "shellcheck",
|
|
1662
|
+
command: "shellcheck",
|
|
1663
|
+
args: ["--version"],
|
|
1664
|
+
},
|
|
1665
|
+
],
|
|
1666
|
+
},
|
|
1667
|
+
];
|
|
1668
|
+
}
|
|
1669
|
+
function normalizeRustToolchain(contributions) {
|
|
1670
|
+
const declarations = contributions.flatMap((contribution) => {
|
|
1671
|
+
const rust = contribution.foundation.toolchains.rust;
|
|
1672
|
+
return rust === undefined
|
|
1673
|
+
? []
|
|
1674
|
+
: [
|
|
1675
|
+
{
|
|
1676
|
+
...rust,
|
|
1677
|
+
components: [...new Set(rust.components)].toSorted(),
|
|
1678
|
+
},
|
|
1679
|
+
];
|
|
1680
|
+
});
|
|
1681
|
+
const fingerprints = declarations.map((rust) => JSON.stringify({
|
|
1682
|
+
toolchain: rust.toolchain,
|
|
1683
|
+
components: rust.components,
|
|
1684
|
+
configurationSource: resolveTemplateSource(rust.configurationSource.source, rust.configurationSource.from),
|
|
1685
|
+
}));
|
|
1686
|
+
if (new Set(fingerprints).size > 1) {
|
|
1687
|
+
throw new Error("Foundation requires compatible Rust toolchain facts");
|
|
1688
|
+
}
|
|
1689
|
+
return declarations.at(0);
|
|
1690
|
+
}
|
|
1691
|
+
function composeDependencyMaintenancePolicy(contributions, deploymentCheck) {
|
|
1692
|
+
const ecosystems = [
|
|
1693
|
+
...new Set([
|
|
1694
|
+
"devcontainers",
|
|
1695
|
+
...contributions.flatMap((contribution) => contribution.foundation.dependencyMaintenance.ecosystems),
|
|
1696
|
+
...(deploymentCheck === undefined ? [] : ["docker"]),
|
|
1697
|
+
]),
|
|
1698
|
+
];
|
|
1699
|
+
const directories = {};
|
|
1700
|
+
const extraDirectories = {};
|
|
1701
|
+
for (const ecosystem of ecosystems) {
|
|
1702
|
+
const candidates = [
|
|
1703
|
+
...new Set([
|
|
1704
|
+
...contributions.flatMap((contribution) => {
|
|
1705
|
+
const policy = contribution.foundation.dependencyMaintenance;
|
|
1706
|
+
const primary = policy.directories?.[ecosystem];
|
|
1707
|
+
return [
|
|
1708
|
+
...(primary === undefined ? [] : [primary]),
|
|
1709
|
+
...(policy.extraDirectories?.[ecosystem] ?? []),
|
|
1710
|
+
];
|
|
1711
|
+
}),
|
|
1712
|
+
...(ecosystem === "docker" && deploymentCheck !== undefined
|
|
1713
|
+
? ["/"]
|
|
1714
|
+
: []),
|
|
1715
|
+
]),
|
|
1716
|
+
];
|
|
1717
|
+
const [primary, ...extra] = candidates;
|
|
1718
|
+
if (primary !== undefined)
|
|
1719
|
+
directories[ecosystem] = primary;
|
|
1720
|
+
if (extra.length > 0)
|
|
1721
|
+
extraDirectories[ecosystem] = extra;
|
|
1722
|
+
}
|
|
1723
|
+
return {
|
|
1724
|
+
ecosystems,
|
|
1725
|
+
...(Object.keys(directories).length === 0 ? {} : { directories }),
|
|
1726
|
+
...(Object.keys(extraDirectories).length === 0 ? {} : { extraDirectories }),
|
|
1727
|
+
interval: "weekly",
|
|
1728
|
+
};
|
|
1729
|
+
}
|
|
1730
|
+
function localTypescriptConfigurationSpecifier(options) {
|
|
1731
|
+
const relativePackagePath = path.posix.relative(options.consumerPackagePath, options.configurationPackagePath);
|
|
1732
|
+
if (relativePackagePath.length === 0) {
|
|
1733
|
+
throw new Error("TypeScript Configuration Package must have a distinct Package Path");
|
|
1734
|
+
}
|
|
1735
|
+
return `link:${relativePackagePath}`;
|
|
1736
|
+
}
|
|
1737
|
+
function publicCliCandidate(contributions) {
|
|
1738
|
+
const candidates = contributions.filter((contribution) => contribution.foundation.npmPublication?.kind === "public-cli-candidate");
|
|
1739
|
+
if (candidates.length > 1) {
|
|
1740
|
+
throw new Error(`Generated Repository Plan supports at most one public CLI candidate; found ${candidates.map((candidate) => `${candidate.definition.name} at ${candidate.definition.path}`).join(", ")}`);
|
|
1741
|
+
}
|
|
1742
|
+
const candidate = candidates[0];
|
|
1743
|
+
if (candidate !== undefined && candidate.definition.role !== "cli-tool") {
|
|
1744
|
+
throw new Error(`Public CLI candidate ${candidate.definition.name} must use the cli-tool Package role`);
|
|
1745
|
+
}
|
|
1746
|
+
return candidate;
|
|
1747
|
+
}
|
|
1748
|
+
function renderPublicationRootCheckCommand(candidatePackagePath) {
|
|
1749
|
+
return [
|
|
1750
|
+
"pnpm run boundaries",
|
|
1751
|
+
renderTurboRunCommand(["format:check", "lint", "typecheck", "test"], [], {
|
|
1752
|
+
continueAfterFailure: true,
|
|
1753
|
+
taskPrefix: true,
|
|
1754
|
+
}),
|
|
1755
|
+
renderTurboRunCommand(["build", "test:e2e"], [`--filter=!./${candidatePackagePath}`], { continueAfterFailure: true, taskPrefix: true }),
|
|
1756
|
+
"pnpm run publication:artifact",
|
|
1757
|
+
].join(" && ");
|
|
1758
|
+
}
|
|
1759
|
+
/**
|
|
1760
|
+
* 票 26 清单单源:把 plan 声明的镜像槽位集合投影成生成检查器携带的清单文本。
|
|
1761
|
+
* 转义 `$` 是必要的:清单文本注入模板字面量,未转义的 `$` 会被当成 TypeScript 插值。
|
|
1762
|
+
*/
|
|
1763
|
+
function renderToolchainMirrorSlotManifest(reconciliation) {
|
|
1764
|
+
const slots = reconciliation.flatMap((policy) => policy.driver === "canonical"
|
|
1765
|
+
? []
|
|
1766
|
+
: (policy.mirrorSlots ?? []).map((slot) => ({
|
|
1767
|
+
id: slot.id,
|
|
1768
|
+
path: policy.path,
|
|
1769
|
+
location: slot.location,
|
|
1770
|
+
})));
|
|
1771
|
+
return JSON.stringify(slots, null, 2).replaceAll("$", String.raw `\$`);
|
|
1772
|
+
}
|
|
1773
|
+
function foundationPlan(options) {
|
|
1774
|
+
assertProjectBlueprint(options.blueprint);
|
|
1775
|
+
const configContribution = options.foundationContribution;
|
|
1776
|
+
const configDefinition = configContribution.definition;
|
|
1777
|
+
if (!options.blueprint.packages.some((definition) => packageDefinitionsEqual(definition, configDefinition))) {
|
|
1778
|
+
throw new Error("Project Blueprint must contain the Foundation TypeScript configuration Package Definition");
|
|
1779
|
+
}
|
|
1780
|
+
const initialProjectLinkPlan = planExplicitProjectLinks({
|
|
1781
|
+
blueprint: options.blueprint,
|
|
1782
|
+
contributions: options.contributions,
|
|
1783
|
+
...(options.manifestTruthByPackagePath === undefined
|
|
1784
|
+
? {}
|
|
1785
|
+
: {
|
|
1786
|
+
manifestTruthByPackagePath: options.manifestTruthByPackagePath,
|
|
1787
|
+
}),
|
|
1788
|
+
});
|
|
1789
|
+
const injectedProviderNames = new Set([...initialProjectLinkPlan.manifestPatchesByPackagePath.values()].flatMap((patch) => Object.entries(patch.dependenciesMeta ?? {})
|
|
1790
|
+
.filter(([, metadata]) => metadata.injected)
|
|
1791
|
+
.map(([name]) => name)));
|
|
1792
|
+
const configPackageName = options.context.foundationPackages.typescriptConfiguration.name;
|
|
1793
|
+
if (configDefinition.name !== configPackageName) {
|
|
1794
|
+
throw new Error(`Generation Context TypeScript Configuration Package ${configPackageName} conflicts with Blueprint Package Definition ${configDefinition.name}`);
|
|
1795
|
+
}
|
|
1796
|
+
const publicationCandidate = publicCliCandidate(options.contributions);
|
|
1797
|
+
const packageContributions = options.contributions.map((contribution) => {
|
|
1798
|
+
if (contribution.foundation.typescriptConfigurationPackage === undefined) {
|
|
1799
|
+
return contribution;
|
|
1800
|
+
}
|
|
1801
|
+
const dependencyField = injectedProviderNames.has(contribution.definition.name)
|
|
1802
|
+
? "dependencies"
|
|
1803
|
+
: "devDependencies";
|
|
1804
|
+
const dependencySpecifier = dependencyField === "devDependencies" &&
|
|
1805
|
+
(contribution.manifest.private !== true ||
|
|
1806
|
+
publicationCandidate?.definition.path === contribution.definition.path)
|
|
1807
|
+
? localTypescriptConfigurationSpecifier({
|
|
1808
|
+
consumerPackagePath: contribution.definition.path,
|
|
1809
|
+
configurationPackagePath: configDefinition.path,
|
|
1810
|
+
})
|
|
1811
|
+
: "workspace:*";
|
|
1812
|
+
const existingDependencies = contribution.manifest[dependencyField];
|
|
1813
|
+
return {
|
|
1814
|
+
...contribution,
|
|
1815
|
+
manifest: {
|
|
1816
|
+
...contribution.manifest,
|
|
1817
|
+
[dependencyField]: {
|
|
1818
|
+
...(isRecord(existingDependencies) ? existingDependencies : {}),
|
|
1819
|
+
[configPackageName]: dependencySpecifier,
|
|
1820
|
+
},
|
|
1821
|
+
},
|
|
1822
|
+
};
|
|
1823
|
+
});
|
|
1824
|
+
const requiresPackingHook = packageContributions.some((contribution) => {
|
|
1825
|
+
const developmentDependencies = contribution.manifest.devDependencies;
|
|
1826
|
+
return (isRecord(developmentDependencies) &&
|
|
1827
|
+
typeof developmentDependencies[configPackageName] === "string" &&
|
|
1828
|
+
developmentDependencies[configPackageName].startsWith("link:"));
|
|
1829
|
+
});
|
|
1830
|
+
const contributions = [configContribution, ...packageContributions];
|
|
1831
|
+
assertPackageContributionCommandNames(contributions.map((contribution) => {
|
|
1832
|
+
const manifest = options.manifestTruthByPackagePath?.get(contribution.definition.path);
|
|
1833
|
+
return manifest === undefined
|
|
1834
|
+
? contribution
|
|
1835
|
+
: { ...contribution, manifest };
|
|
1836
|
+
}));
|
|
1837
|
+
const candidateRecord = options.generationRecord ?? {
|
|
1838
|
+
schemaVersion: 2,
|
|
756
1839
|
repositoryName: options.context.repositoryName,
|
|
757
1840
|
defaultPackageScope: options.context.defaultPackageScope,
|
|
758
1841
|
preset: options.definition.metadata.name,
|
|
759
1842
|
templateVersion: "0.0.0",
|
|
760
|
-
|
|
1843
|
+
// 显式只投影 v2 的两个历史字段,上下文里的精确 Node 事实不得进入持久记录。
|
|
1844
|
+
toolchain: {
|
|
1845
|
+
nodeLtsMajor: options.context.toolchain.nodeLtsMajor,
|
|
1846
|
+
packageManagerPin: options.context.toolchain.packageManagerPin,
|
|
1847
|
+
},
|
|
761
1848
|
packages: [
|
|
762
1849
|
...options.contributions.map((contribution) => {
|
|
763
1850
|
const planningContribution = options.mode === "initialization"
|
|
@@ -785,21 +1872,82 @@ function foundationPlan(options) {
|
|
|
785
1872
|
],
|
|
786
1873
|
};
|
|
787
1874
|
const generationRecord = parseGenerationRecord(candidateRecord);
|
|
1875
|
+
const deploymentCheck = normalizeDeploymentCheck(contributions);
|
|
1876
|
+
const vueHonoJointE2e = normalizeVueHonoJointE2e(contributions);
|
|
1877
|
+
const databasePreparation = normalizeDatabasePreparation(contributions);
|
|
1878
|
+
const rustToolchain = normalizeRustToolchain(contributions);
|
|
1879
|
+
const packageByName = new Map(contributions.map((contribution) => [
|
|
1880
|
+
contribution.definition.name,
|
|
1881
|
+
contribution,
|
|
1882
|
+
]));
|
|
1883
|
+
const deploymentPackages = deploymentCheck === undefined
|
|
1884
|
+
? undefined
|
|
1885
|
+
: {
|
|
1886
|
+
application: requireContributionByName(packageByName, deploymentCheck.applicationPackageName, "Deployment Check"),
|
|
1887
|
+
database: requireContributionByName(packageByName, deploymentCheck.databasePackageName, "Deployment Check"),
|
|
1888
|
+
migration: requireContributionByName(packageByName, deploymentCheck.migrationPackageName, "Deployment Check"),
|
|
1889
|
+
};
|
|
1890
|
+
if (databasePreparation !== undefined) {
|
|
1891
|
+
const migration = packageByName.get(databasePreparation.migrationPackageName);
|
|
1892
|
+
if (migration === undefined) {
|
|
1893
|
+
throw new Error("Database Preparation references an unknown migration Package");
|
|
1894
|
+
}
|
|
1895
|
+
for (const packageName of Object.values(databasePreparation.consumers)) {
|
|
1896
|
+
if (!packageByName.has(packageName)) {
|
|
1897
|
+
throw new Error("Database Preparation references an unknown consumer Package");
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
if (databasePreparation.consumers["database-test"] !==
|
|
1901
|
+
databasePreparation.databasePackageName) {
|
|
1902
|
+
throw new Error("Database Preparation database-test consumer must be its owner");
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
assertDatabasePreparationManifestTruth({
|
|
1906
|
+
preparation: databasePreparation,
|
|
1907
|
+
packageByName,
|
|
1908
|
+
manifestTruthByPackagePath: options.manifestTruthByPackagePath,
|
|
1909
|
+
});
|
|
1910
|
+
if (deploymentCheck !== undefined) {
|
|
1911
|
+
const deploymentPackageNames = [
|
|
1912
|
+
deploymentCheck.applicationPackageName,
|
|
1913
|
+
deploymentCheck.databasePackageName,
|
|
1914
|
+
deploymentCheck.migrationPackageName,
|
|
1915
|
+
];
|
|
1916
|
+
if (new Set(deploymentPackageNames).size !== 3) {
|
|
1917
|
+
throw new Error("Deployment Check requires three distinct Packages");
|
|
1918
|
+
}
|
|
1919
|
+
if (deploymentPackages?.application.definition.path !==
|
|
1920
|
+
deploymentCheck.declaringPackagePath) {
|
|
1921
|
+
throw new Error("Deployment Check must be declared by its application Package");
|
|
1922
|
+
}
|
|
1923
|
+
if (databasePreparation !== undefined &&
|
|
1924
|
+
(databasePreparation.databasePackageName !==
|
|
1925
|
+
deploymentCheck.databasePackageName ||
|
|
1926
|
+
databasePreparation.migrationPackageName !==
|
|
1927
|
+
deploymentCheck.migrationPackageName)) {
|
|
1928
|
+
throw new Error("Deployment Check must use the Database Preparation Packages");
|
|
1929
|
+
}
|
|
1930
|
+
for (const packageName of deploymentPackageNames) {
|
|
1931
|
+
const contribution = requireContributionByName(packageByName, packageName, "Deployment Check");
|
|
1932
|
+
const manifest = options.manifestTruthByPackagePath?.get(contribution.definition.path) ??
|
|
1933
|
+
contribution.manifest;
|
|
1934
|
+
const expectedBuild = isRecord(contribution.manifest.scripts)
|
|
1935
|
+
? contribution.manifest.scripts.build
|
|
1936
|
+
: undefined;
|
|
1937
|
+
const actualBuild = isRecord(manifest.scripts)
|
|
1938
|
+
? manifest.scripts.build
|
|
1939
|
+
: undefined;
|
|
1940
|
+
if (typeof expectedBuild !== "string" || actualBuild !== expectedBuild) {
|
|
1941
|
+
throw new Error(`Deployment Check requires exact ${packageName} manifest script build`);
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
788
1945
|
const persistedEnvironmentNeeds = normalizeEnvironmentNeeds({
|
|
789
|
-
check: contributions
|
|
790
|
-
deployment: [
|
|
791
|
-
...(options.existingDeploymentEnvironmentNeeds ?? []),
|
|
792
|
-
...contributions.flatMap((item) => item.deploymentEnvironmentNeeds ?? []),
|
|
793
|
-
],
|
|
1946
|
+
check: foundationCheckEnvironmentNeeds(contributions, deploymentCheck, vueHonoJointE2e),
|
|
1947
|
+
deployment: deploymentCheck?.environmentNeeds ?? [],
|
|
794
1948
|
});
|
|
795
1949
|
const environmentNeeds = persistedEnvironmentNeeds.check;
|
|
796
1950
|
const deploymentEnvironmentNeeds = persistedEnvironmentNeeds.deployment;
|
|
797
|
-
const hasDeploymentTask = contributions.some((contribution) => {
|
|
798
|
-
const scripts = contribution.manifest.scripts;
|
|
799
|
-
return (typeof scripts === "object" &&
|
|
800
|
-
scripts !== null &&
|
|
801
|
-
typeof scripts.deployment === "string");
|
|
802
|
-
});
|
|
803
1951
|
const contributionPackagePaths = contributions.map((contribution) => contribution.definition.path);
|
|
804
1952
|
if (new Set(contributionPackagePaths).size !== contributionPackagePaths.length)
|
|
805
1953
|
throw new Error("Package Contributions must have unique Package Paths");
|
|
@@ -814,13 +1962,26 @@ function foundationPlan(options) {
|
|
|
814
1962
|
const ciDiagnosticArtifactDeclarations = contributions.flatMap((contribution) => contribution.ciDiagnosticArtifacts ?? []);
|
|
815
1963
|
const ciDiagnosticArtifacts = composeCiDiagnosticArtifacts({
|
|
816
1964
|
packagePaths: blueprintPackagePaths,
|
|
817
|
-
declarations:
|
|
1965
|
+
declarations: [
|
|
1966
|
+
...ciDiagnosticArtifactDeclarations,
|
|
1967
|
+
...(vueHonoJointE2e === undefined
|
|
1968
|
+
? []
|
|
1969
|
+
: [
|
|
1970
|
+
{
|
|
1971
|
+
kind: "playwright",
|
|
1972
|
+
owner: { kind: "workspace-orchestration", path: "." },
|
|
1973
|
+
},
|
|
1974
|
+
]),
|
|
1975
|
+
],
|
|
818
1976
|
});
|
|
819
|
-
assertCompatibleRustToolchainFacts(contributions);
|
|
820
1977
|
const contributedToolLayers = contributions.flatMap((contribution) => contribution.foundation.developmentContainerToolLayers ?? []);
|
|
821
1978
|
const developmentContainer = contributedDevcontainerComposition({
|
|
822
1979
|
context: options.context,
|
|
823
|
-
|
|
1980
|
+
rootNodeDeclaration: options.rootNodeDeclaration,
|
|
1981
|
+
layers: [
|
|
1982
|
+
...contributedToolLayers,
|
|
1983
|
+
...deploymentCheckDevelopmentContainerToolLayers(deploymentCheck),
|
|
1984
|
+
],
|
|
824
1985
|
});
|
|
825
1986
|
const workspacePackageGlobs = [
|
|
826
1987
|
"apps/*",
|
|
@@ -835,7 +1996,9 @@ function foundationPlan(options) {
|
|
|
835
1996
|
]),
|
|
836
1997
|
];
|
|
837
1998
|
const editorCustomization = editorCustomizationForCapabilities(contributions.flatMap((contribution) => contribution.foundation.editorCapabilities), loadEditorCustomizationDeclarations(resolveTemplateSource(templateSources.editorCustomization, "capabilities.json")));
|
|
838
|
-
const dependencyMaintenancePolicy = composeDependencyMaintenancePolicy(contributions);
|
|
1999
|
+
const dependencyMaintenancePolicy = composeDependencyMaintenancePolicy(contributions, deploymentCheck);
|
|
2000
|
+
const rootOwnedE2e = vueHonoJointE2e !== undefined;
|
|
2001
|
+
const rootAutomationPaths = rootOwnedE2e ? "scripts test" : "scripts";
|
|
839
2002
|
const rootManifest = {
|
|
840
2003
|
name: options.context.repositoryName,
|
|
841
2004
|
private: true,
|
|
@@ -851,25 +2014,39 @@ function foundationPlan(options) {
|
|
|
851
2014
|
check: publicationCandidate === undefined
|
|
852
2015
|
? renderRootCheckCommand()
|
|
853
2016
|
: renderPublicationRootCheckCommand(publicationCandidate.definition.path),
|
|
854
|
-
|
|
2017
|
+
// Cargo 会在首次代理调用时按根 rust-toolchain.toml 安装版本与组件;先经唯一根任务完成解析,再并行运行各 Rust 包的 Cargo 检查。
|
|
2018
|
+
...(rustToolchain === undefined
|
|
2019
|
+
? {}
|
|
2020
|
+
: { "toolchain:prepare": "cargo --version" }),
|
|
2021
|
+
boundaries: "turbo boundaries --no-color && node --conditions=source scripts/check-toolchain-versions.ts",
|
|
2022
|
+
...(databasePreparation === undefined
|
|
2023
|
+
? {}
|
|
2024
|
+
: databasePreparationCommands(databasePreparation)),
|
|
855
2025
|
...(publicationCandidate === undefined
|
|
856
2026
|
? {}
|
|
857
2027
|
: {
|
|
858
2028
|
"publication:readiness": "node --conditions=source scripts/npm-publication/check-readiness.ts",
|
|
859
2029
|
"publication:artifact": "node --conditions=source scripts/npm-publication/check-artifact.ts",
|
|
860
2030
|
}),
|
|
861
|
-
...(
|
|
862
|
-
? {
|
|
863
|
-
: {
|
|
2031
|
+
...(deploymentCheck === undefined
|
|
2032
|
+
? {}
|
|
2033
|
+
: {
|
|
2034
|
+
deployment: "node --conditions=source scripts/check-standalone-deployment.ts",
|
|
2035
|
+
"check:deployment": renderDeploymentCheckCommand(),
|
|
2036
|
+
}),
|
|
2037
|
+
...(rootOwnedE2e ? { "test:e2e": "playwright test" } : {}),
|
|
864
2038
|
fix: renderFixCommand(),
|
|
865
|
-
"format:check":
|
|
866
|
-
"format:write":
|
|
867
|
-
lint:
|
|
868
|
-
|
|
2039
|
+
"format:check": `oxfmt --list-different --no-error-on-unmatched-pattern package.json pnpm-workspace.yaml pnpm-lock.yaml turbo.json tsconfig.json tsconfig.config.json *.config.ts .pnpmfile.mjs .gitignore .dockerignore Dockerfile TODO.md rust-toolchain.toml .vscode .github .devcontainer ${rootAutomationPaths}`,
|
|
2040
|
+
"format:write": `oxfmt --write --no-error-on-unmatched-pattern package.json pnpm-workspace.yaml pnpm-lock.yaml turbo.json tsconfig.json tsconfig.config.json *.config.ts .pnpmfile.mjs .gitignore .dockerignore Dockerfile TODO.md rust-toolchain.toml .vscode .github .devcontainer ${rootAutomationPaths}`,
|
|
2041
|
+
lint: deploymentCheck === undefined
|
|
2042
|
+
? `oxlint --quiet --format=unix --no-error-on-unmatched-pattern *.config.ts .pnpmfile.mjs ${rootAutomationPaths}`
|
|
2043
|
+
: `shellcheck scripts/container-entrypoint.sh && oxlint --quiet --format=unix --no-error-on-unmatched-pattern *.config.ts .pnpmfile.mjs ${rootAutomationPaths}`,
|
|
2044
|
+
"lint:fix": `oxlint --format=unix --no-error-on-unmatched-pattern *.config.ts .pnpmfile.mjs ${rootAutomationPaths} --fix`,
|
|
869
2045
|
typecheck: "tsc -p tsconfig.json --noEmit --pretty false",
|
|
870
2046
|
},
|
|
871
2047
|
devDependencies: {
|
|
872
2048
|
"@types/node": "catalog:",
|
|
2049
|
+
...(rootOwnedE2e ? { "@playwright/test": "catalog:" } : {}),
|
|
873
2050
|
...(publicationCandidate === undefined
|
|
874
2051
|
? {}
|
|
875
2052
|
: {
|
|
@@ -879,6 +2056,7 @@ function foundationPlan(options) {
|
|
|
879
2056
|
oxfmt: "catalog:",
|
|
880
2057
|
oxlint: "catalog:",
|
|
881
2058
|
"oxlint-tsgolint": "catalog:",
|
|
2059
|
+
"smol-toml": "catalog:",
|
|
882
2060
|
...(publicationCandidate === undefined
|
|
883
2061
|
? {}
|
|
884
2062
|
: {
|
|
@@ -890,7 +2068,7 @@ function foundationPlan(options) {
|
|
|
890
2068
|
turbo: "catalog:",
|
|
891
2069
|
"typescript-7": "catalog:",
|
|
892
2070
|
},
|
|
893
|
-
engines: { node: options.
|
|
2071
|
+
engines: { node: options.rootNodeDeclaration },
|
|
894
2072
|
packageManager: options.context.toolchain.packageManagerPin,
|
|
895
2073
|
};
|
|
896
2074
|
const dependencyCatalog = selectTemplateDependencyCatalogEntries(collectGeneratedManifestCatalogReferences([
|
|
@@ -930,8 +2108,7 @@ function foundationPlan(options) {
|
|
|
930
2108
|
};
|
|
931
2109
|
const workflowTemplateSource = projectCheckWorkflowTemplateSource({
|
|
932
2110
|
packagePaths: blueprintPackagePaths,
|
|
933
|
-
|
|
934
|
-
hasDeploymentTask,
|
|
2111
|
+
deploymentCheck,
|
|
935
2112
|
diagnosticArtifacts: ciDiagnosticArtifacts,
|
|
936
2113
|
});
|
|
937
2114
|
const workflowOperation = ciDiagnosticArtifacts.length === 0
|
|
@@ -973,6 +2150,70 @@ function foundationPlan(options) {
|
|
|
973
2150
|
];
|
|
974
2151
|
const projectLinkPlan = initialProjectLinkPlan;
|
|
975
2152
|
const turboBoundaryTags = turboBoundaryTagsForContributions(contributions);
|
|
2153
|
+
const reconciliation = [
|
|
2154
|
+
{ path: "tsconfig.json", driver: "structured" },
|
|
2155
|
+
{ path: "turbo.json", driver: "structured" },
|
|
2156
|
+
{
|
|
2157
|
+
path: ".devcontainer/devcontainer.json",
|
|
2158
|
+
driver: "structured",
|
|
2159
|
+
identitySets: [developmentContainer.mountIdentitySet],
|
|
2160
|
+
// M1:根 engines.node 原文拥有的静态镜像槽位;Core 只见位置,不见文件语义。
|
|
2161
|
+
// 设计写作 /build.args/NODE_VERSION;RFC 6901 下点号不是分隔符,取同位置的标准形。
|
|
2162
|
+
mirrorSlots: [
|
|
2163
|
+
{
|
|
2164
|
+
id: "node-version-build-arg",
|
|
2165
|
+
location: {
|
|
2166
|
+
kind: "json-pointer",
|
|
2167
|
+
pointer: "/build/args/NODE_VERSION",
|
|
2168
|
+
},
|
|
2169
|
+
},
|
|
2170
|
+
// M5:仅当本 plan 选用 Rust 时接入同一机制,值由根 rust-toolchain.toml channel 拥有。
|
|
2171
|
+
// 声明只给位置、不含版本值,故已含 Rust 的目标在加包时 Before/After 清单逐字节相同,
|
|
2172
|
+
// reconciliationPoliciesCompatible 不因 M5 扩展把合法加包变成策略不兼容。
|
|
2173
|
+
...(rustToolchain === undefined
|
|
2174
|
+
? []
|
|
2175
|
+
: [
|
|
2176
|
+
{
|
|
2177
|
+
id: "rust-toolchain-build-arg",
|
|
2178
|
+
location: {
|
|
2179
|
+
kind: "json-pointer",
|
|
2180
|
+
pointer: "/build/args/RUST_TOOLCHAIN",
|
|
2181
|
+
},
|
|
2182
|
+
},
|
|
2183
|
+
]),
|
|
2184
|
+
],
|
|
2185
|
+
},
|
|
2186
|
+
...(deploymentCheck === undefined || deploymentPackages === undefined
|
|
2187
|
+
? []
|
|
2188
|
+
: [
|
|
2189
|
+
{
|
|
2190
|
+
path: "Dockerfile",
|
|
2191
|
+
driver: "text",
|
|
2192
|
+
// M2:同一 rootNodeDeclaration 投影的锚定 ARG 默认值。
|
|
2193
|
+
mirrorSlots: [
|
|
2194
|
+
{
|
|
2195
|
+
id: "node-version-deployment-arg",
|
|
2196
|
+
location: { kind: "text-anchor", name: "NODE_VERSION" },
|
|
2197
|
+
},
|
|
2198
|
+
],
|
|
2199
|
+
},
|
|
2200
|
+
]),
|
|
2201
|
+
{
|
|
2202
|
+
path: ".vscode/extensions.json",
|
|
2203
|
+
driver: "structured",
|
|
2204
|
+
identitySets: [
|
|
2205
|
+
{
|
|
2206
|
+
location: "/recommendations",
|
|
2207
|
+
identity: { kind: "self" },
|
|
2208
|
+
},
|
|
2209
|
+
],
|
|
2210
|
+
},
|
|
2211
|
+
{ path: ".template/blueprint.json", driver: "canonical" },
|
|
2212
|
+
{ path: environmentNeedsPath, driver: "canonical" },
|
|
2213
|
+
{ path: ".template/generation.json", driver: "canonical" },
|
|
2214
|
+
];
|
|
2215
|
+
// 票 26 清单单源:生成检查器携带的槽位清单是上面声明的投影,不是第二份真源。
|
|
2216
|
+
const toolchainMirrorSlotManifest = renderToolchainMirrorSlotManifest(reconciliation);
|
|
976
2217
|
const initializationFoundationOperations = [
|
|
977
2218
|
{
|
|
978
2219
|
kind: "writeJson",
|
|
@@ -998,12 +2239,57 @@ function foundationPlan(options) {
|
|
|
998
2239
|
from: "gitignore",
|
|
999
2240
|
to: ".gitignore",
|
|
1000
2241
|
},
|
|
2242
|
+
{
|
|
2243
|
+
kind: "copyFile",
|
|
2244
|
+
source: templateSources.foundation,
|
|
2245
|
+
from: "AGENTS.md.template",
|
|
2246
|
+
to: "AGENTS.md",
|
|
2247
|
+
},
|
|
1001
2248
|
{
|
|
1002
2249
|
kind: "copyFile",
|
|
1003
2250
|
source: templateSources.foundation,
|
|
1004
2251
|
from: "turbo.json",
|
|
1005
2252
|
to: "turbo.json",
|
|
1006
2253
|
},
|
|
2254
|
+
...(vueHonoJointE2e === undefined
|
|
2255
|
+
? []
|
|
2256
|
+
: [
|
|
2257
|
+
{
|
|
2258
|
+
kind: "mergeJson",
|
|
2259
|
+
to: "turbo.json",
|
|
2260
|
+
value: { tasks: vueHonoJointE2eTurboTasks(vueHonoJointE2e) },
|
|
2261
|
+
multilineArrays: ["tasks.//#test:e2e.dependsOn"],
|
|
2262
|
+
},
|
|
2263
|
+
]),
|
|
2264
|
+
...(deploymentCheck === undefined
|
|
2265
|
+
? []
|
|
2266
|
+
: [
|
|
2267
|
+
{
|
|
2268
|
+
kind: "mergeJson",
|
|
2269
|
+
to: "turbo.json",
|
|
2270
|
+
value: {
|
|
2271
|
+
tasks: deploymentTurboTasks(deploymentCheck),
|
|
2272
|
+
},
|
|
2273
|
+
multilineArrays: ["tasks.//#deployment.dependsOn"],
|
|
2274
|
+
},
|
|
2275
|
+
]),
|
|
2276
|
+
...(databasePreparation === undefined
|
|
2277
|
+
? []
|
|
2278
|
+
: [
|
|
2279
|
+
{
|
|
2280
|
+
kind: "mergeJson",
|
|
2281
|
+
to: "turbo.json",
|
|
2282
|
+
value: {
|
|
2283
|
+
tasks: databasePreparationTurboTasks(databasePreparation),
|
|
2284
|
+
},
|
|
2285
|
+
multilineArrays: [
|
|
2286
|
+
`tasks.${databasePreparation.migrationPackageName}#typecheck.dependsOn`,
|
|
2287
|
+
`tasks.${databasePreparation.consumers["application-dev"]}#typecheck.dependsOn`,
|
|
2288
|
+
`tasks.${databasePreparation.consumers["application-dev"]}#dev.dependsOn`,
|
|
2289
|
+
`tasks.${databasePreparation.consumers["application-e2e"]}#test:e2e.dependsOn`,
|
|
2290
|
+
],
|
|
2291
|
+
},
|
|
2292
|
+
]),
|
|
1007
2293
|
...(publicationCandidate === undefined
|
|
1008
2294
|
? []
|
|
1009
2295
|
: [
|
|
@@ -1019,18 +2305,16 @@ function foundationPlan(options) {
|
|
|
1019
2305
|
source: templateSources.foundation,
|
|
1020
2306
|
from: `turbo-boundary-tags/${tag}.json`,
|
|
1021
2307
|
to: "turbo.json",
|
|
2308
|
+
multilineArrays: deploymentCheck === undefined ? [] : ["tasks.//#deployment.dependsOn"],
|
|
1022
2309
|
})),
|
|
1023
2310
|
{
|
|
1024
|
-
kind: "
|
|
1025
|
-
source: templateSources.foundation,
|
|
1026
|
-
from: "scripts/check-boundaries.ts",
|
|
1027
|
-
to: "scripts/check-boundaries.ts",
|
|
1028
|
-
},
|
|
1029
|
-
{
|
|
1030
|
-
kind: "copyFile",
|
|
2311
|
+
kind: "writeTextTemplate",
|
|
1031
2312
|
source: templateSources.foundation,
|
|
1032
|
-
from: "scripts/
|
|
1033
|
-
to: "scripts/
|
|
2313
|
+
from: "scripts/check-toolchain-versions.ts",
|
|
2314
|
+
to: "scripts/check-toolchain-versions.ts",
|
|
2315
|
+
replacements: {
|
|
2316
|
+
TOOLCHAIN_MIRROR_SLOT_MANIFEST: toolchainMirrorSlotManifest,
|
|
2317
|
+
},
|
|
1034
2318
|
},
|
|
1035
2319
|
{
|
|
1036
2320
|
kind: "copyFile",
|
|
@@ -1038,6 +2322,38 @@ function foundationPlan(options) {
|
|
|
1038
2322
|
from: "tsconfig.json",
|
|
1039
2323
|
to: "tsconfig.json",
|
|
1040
2324
|
},
|
|
2325
|
+
...(vueHonoJointE2e === undefined
|
|
2326
|
+
? []
|
|
2327
|
+
: [
|
|
2328
|
+
{
|
|
2329
|
+
kind: "mergeJsonTemplate",
|
|
2330
|
+
source: templateSources.vueHonoApp,
|
|
2331
|
+
from: "root/tsconfig.json",
|
|
2332
|
+
to: "tsconfig.json",
|
|
2333
|
+
},
|
|
2334
|
+
{
|
|
2335
|
+
kind: "writeTextTemplate",
|
|
2336
|
+
source: templateSources.vueHonoApp,
|
|
2337
|
+
from: "root/playwright.config.ts",
|
|
2338
|
+
to: "playwright.config.ts",
|
|
2339
|
+
replacements: {
|
|
2340
|
+
API_PACKAGE_NAME: vueHonoJointE2e.apiPackageName,
|
|
2341
|
+
WEB_PACKAGE_NAME: vueHonoJointE2e.webPackageName,
|
|
2342
|
+
},
|
|
2343
|
+
},
|
|
2344
|
+
{
|
|
2345
|
+
kind: "copyFile",
|
|
2346
|
+
source: templateSources.vueHonoApp,
|
|
2347
|
+
from: "root/test/e2e/fixtures.ts",
|
|
2348
|
+
to: "test/e2e/fixtures.ts",
|
|
2349
|
+
},
|
|
2350
|
+
{
|
|
2351
|
+
kind: "copyFile",
|
|
2352
|
+
source: templateSources.vueHonoApp,
|
|
2353
|
+
from: "root/test/e2e/app.spec.ts",
|
|
2354
|
+
to: "test/e2e/app.spec.ts",
|
|
2355
|
+
},
|
|
2356
|
+
]),
|
|
1041
2357
|
...(publicationCandidate === undefined
|
|
1042
2358
|
? []
|
|
1043
2359
|
: [
|
|
@@ -1046,7 +2362,6 @@ function foundationPlan(options) {
|
|
|
1046
2362
|
source: templateSources.tsCli,
|
|
1047
2363
|
from: "publication/root-tsconfig.json",
|
|
1048
2364
|
to: "tsconfig.json",
|
|
1049
|
-
multilineArrays: ["include"],
|
|
1050
2365
|
},
|
|
1051
2366
|
]),
|
|
1052
2367
|
...(requiresPackingHook && publicationCandidate === undefined
|
|
@@ -1220,7 +2535,67 @@ function foundationPlan(options) {
|
|
|
1220
2535
|
value: editorCustomization.settings,
|
|
1221
2536
|
},
|
|
1222
2537
|
...developmentContainer.operations,
|
|
1223
|
-
...
|
|
2538
|
+
...(rustToolchain === undefined
|
|
2539
|
+
? []
|
|
2540
|
+
: [
|
|
2541
|
+
{
|
|
2542
|
+
kind: "writeTextTemplate",
|
|
2543
|
+
source: rustToolchain.configurationSource.source,
|
|
2544
|
+
from: rustToolchain.configurationSource.from,
|
|
2545
|
+
to: "rust-toolchain.toml",
|
|
2546
|
+
replacements: { RUST_TOOLCHAIN: rustToolchain.toolchain },
|
|
2547
|
+
},
|
|
2548
|
+
]),
|
|
2549
|
+
...(deploymentCheck === undefined || deploymentPackages === undefined
|
|
2550
|
+
? []
|
|
2551
|
+
: [
|
|
2552
|
+
{
|
|
2553
|
+
kind: "writeTextTemplate",
|
|
2554
|
+
source: deploymentCheck.sources.dockerfile.source,
|
|
2555
|
+
from: deploymentCheck.sources.dockerfile.from,
|
|
2556
|
+
to: "Dockerfile",
|
|
2557
|
+
replacements: {
|
|
2558
|
+
NODE_VERSION: options.rootNodeDeclaration,
|
|
2559
|
+
APPLICATION_PACKAGE_NAME: deploymentPackages.application.definition.name,
|
|
2560
|
+
APPLICATION_PACKAGE_PATH: deploymentPackages.application.definition.path,
|
|
2561
|
+
DATABASE_PACKAGE_NAME: deploymentPackages.database.definition.name,
|
|
2562
|
+
DATABASE_PACKAGE_PATH: deploymentPackages.database.definition.path,
|
|
2563
|
+
MIGRATION_PACKAGE_NAME: deploymentPackages.migration.definition.name,
|
|
2564
|
+
MIGRATION_PACKAGE_PATH: deploymentPackages.migration.definition.path,
|
|
2565
|
+
TYPESCRIPT_CONFIG_PACKAGE_PATH: configDefinition.path,
|
|
2566
|
+
},
|
|
2567
|
+
},
|
|
2568
|
+
{
|
|
2569
|
+
kind: "writeTextTemplate",
|
|
2570
|
+
source: deploymentCheck.sources.dockerIgnore.source,
|
|
2571
|
+
from: deploymentCheck.sources.dockerIgnore.from,
|
|
2572
|
+
to: ".dockerignore",
|
|
2573
|
+
replacements: {
|
|
2574
|
+
APPLICATION_PACKAGE_PATH: deploymentPackages.application.definition.path,
|
|
2575
|
+
DATABASE_PACKAGE_PATH: deploymentPackages.database.definition.path,
|
|
2576
|
+
},
|
|
2577
|
+
},
|
|
2578
|
+
{
|
|
2579
|
+
kind: "writeTextTemplate",
|
|
2580
|
+
source: deploymentCheck.sources.checker.source,
|
|
2581
|
+
from: deploymentCheck.sources.checker.from,
|
|
2582
|
+
to: "scripts/check-standalone-deployment.ts",
|
|
2583
|
+
replacements: {
|
|
2584
|
+
APPLICATION_PACKAGE_NAME: deploymentPackages.application.definition.name,
|
|
2585
|
+
},
|
|
2586
|
+
},
|
|
2587
|
+
{
|
|
2588
|
+
kind: "copyFile",
|
|
2589
|
+
source: deploymentCheck.sources.controlScript.source,
|
|
2590
|
+
from: deploymentCheck.sources.controlScript.from,
|
|
2591
|
+
to: "scripts/container-entrypoint.sh",
|
|
2592
|
+
},
|
|
2593
|
+
{
|
|
2594
|
+
kind: "setExecutable",
|
|
2595
|
+
path: "scripts/container-entrypoint.sh",
|
|
2596
|
+
executable: true,
|
|
2597
|
+
},
|
|
2598
|
+
]),
|
|
1224
2599
|
...workflowOperations,
|
|
1225
2600
|
{
|
|
1226
2601
|
kind: "writeJson",
|
|
@@ -1293,60 +2668,173 @@ function foundationPlan(options) {
|
|
|
1293
2668
|
...plannedFoundationOperations.map((operation) => withProvenance(operation, foundationProvenance)),
|
|
1294
2669
|
...linkOperations.map((operation) => withProvenance(operation, foundationProvenance)),
|
|
1295
2670
|
];
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
2671
|
+
return {
|
|
2672
|
+
definitionName: options.definition.metadata.name,
|
|
2673
|
+
plannerSourceFile: options.definition.plannerSourceFile,
|
|
2674
|
+
planningContribution: options.mode === "addition"
|
|
2675
|
+
? "planPackageAddition"
|
|
2676
|
+
: "planInitialization",
|
|
2677
|
+
blueprint: options.blueprint,
|
|
2678
|
+
generationRecord,
|
|
2679
|
+
packageContributions,
|
|
2680
|
+
operations,
|
|
2681
|
+
reconciliation,
|
|
2682
|
+
developmentContainer: {
|
|
2683
|
+
toolLayers: developmentContainer.toolLayers,
|
|
2684
|
+
buildArguments: developmentContainer.buildArguments,
|
|
2685
|
+
mounts: developmentContainer.mounts,
|
|
2686
|
+
probes: developmentContainer.probes,
|
|
1303
2687
|
},
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
2688
|
+
environmentNeeds,
|
|
2689
|
+
deploymentCheck: deploymentCheck === undefined
|
|
2690
|
+
? undefined
|
|
2691
|
+
: {
|
|
2692
|
+
kind: deploymentCheck.kind,
|
|
2693
|
+
applicationPackageName: deploymentCheck.applicationPackageName,
|
|
2694
|
+
databasePackageName: deploymentCheck.databasePackageName,
|
|
2695
|
+
migrationPackageName: deploymentCheck.migrationPackageName,
|
|
2696
|
+
environmentNeeds: deploymentCheck.environmentNeeds,
|
|
2697
|
+
},
|
|
2698
|
+
vueHonoJointE2e: vueHonoJointE2e === undefined
|
|
2699
|
+
? undefined
|
|
2700
|
+
: {
|
|
2701
|
+
kind: vueHonoJointE2e.kind,
|
|
2702
|
+
apiPackageName: vueHonoJointE2e.apiPackageName,
|
|
2703
|
+
},
|
|
2704
|
+
deploymentEnvironmentNeeds,
|
|
2705
|
+
ciDiagnosticArtifacts,
|
|
2706
|
+
manifests: [...contributions.map((item) => item.manifest), rootManifest],
|
|
2707
|
+
dependencyCatalog,
|
|
2708
|
+
dependencyMaintenancePolicy,
|
|
2709
|
+
nextStepInstructions: [
|
|
2710
|
+
{ display: "pnpm install" },
|
|
2711
|
+
{ display: "pnpm run fix" },
|
|
2712
|
+
{ display: "pnpm run check" },
|
|
2713
|
+
],
|
|
2714
|
+
};
|
|
2715
|
+
}
|
|
2716
|
+
function hasConfigurablePrimaryPackage(definition) {
|
|
2717
|
+
return definition.initialPrimaryPackage !== undefined;
|
|
2718
|
+
}
|
|
2719
|
+
function deduplicateInitializationInputIssues(issues) {
|
|
2720
|
+
return issues.filter((issue, index) => issues.findIndex((candidate) => candidate.code === issue.code) === index);
|
|
2721
|
+
}
|
|
2722
|
+
function collectInitializationInput(options) {
|
|
2723
|
+
const issues = [];
|
|
2724
|
+
const definition = options.definition ??
|
|
2725
|
+
(options.preset === undefined
|
|
2726
|
+
? undefined
|
|
2727
|
+
: builtInPresetRegistry
|
|
2728
|
+
.all()
|
|
2729
|
+
.find((candidate) => candidate.metadata.name === options.preset));
|
|
2730
|
+
if (definition === undefined) {
|
|
2731
|
+
return {
|
|
2732
|
+
status: "input-invalid",
|
|
2733
|
+
issues: [{ code: "PRESET_UNKNOWN" }],
|
|
2734
|
+
};
|
|
2735
|
+
}
|
|
2736
|
+
const scopeOverride = options.overrides?.scope;
|
|
2737
|
+
const normalizedScope = scopeOverride?.startsWith("@") === true
|
|
2738
|
+
? scopeOverride.slice(1)
|
|
2739
|
+
: scopeOverride;
|
|
2740
|
+
const nameOverride = options.overrides?.name;
|
|
2741
|
+
const pathOverride = options.overrides?.path;
|
|
2742
|
+
const repositoryName = path.basename(path.resolve(options.targetDir));
|
|
2743
|
+
const configurablePrimaryPackage = definition.initialPrimaryPackage !== undefined;
|
|
2744
|
+
if (!configurablePrimaryPackage &&
|
|
2745
|
+
(nameOverride !== undefined || pathOverride !== undefined)) {
|
|
2746
|
+
issues.push({ code: "FIXED_TOPOLOGY_OVERRIDE" });
|
|
2747
|
+
}
|
|
2748
|
+
let validNameOverride = nameOverride !== undefined &&
|
|
2749
|
+
isValidNewNpmPackageName(`@x/${nameOverride}`);
|
|
2750
|
+
if (nameOverride !== undefined && !validNameOverride) {
|
|
2751
|
+
issues.push({ code: "INVALID_PACKAGE_NAME" });
|
|
2752
|
+
}
|
|
2753
|
+
if (pathOverride !== undefined) {
|
|
2754
|
+
const pathValidation = validateNewPackagePath(pathOverride);
|
|
2755
|
+
if (!pathValidation.hasValidShape) {
|
|
2756
|
+
issues.push({ code: "INVALID_PACKAGE_PATH" });
|
|
2757
|
+
}
|
|
2758
|
+
if (pathValidation.reservedWorkspaceCollection !== undefined) {
|
|
2759
|
+
issues.push({ code: "RESERVED_PACKAGE_PATH" });
|
|
2760
|
+
}
|
|
2761
|
+
}
|
|
2762
|
+
let validScopeOverride = normalizedScope !== undefined &&
|
|
2763
|
+
scopeOverride === scopeOverride?.trim() &&
|
|
2764
|
+
isValidDefaultPackageScope(normalizedScope) &&
|
|
2765
|
+
isValidNewNpmPackageName(`@${normalizedScope}/typescript-config`);
|
|
2766
|
+
if (normalizedScope !== undefined && !validScopeOverride) {
|
|
2767
|
+
issues.push({ code: "INVALID_PACKAGE_SCOPE" });
|
|
2768
|
+
}
|
|
2769
|
+
let validRepositoryScope = isValidDefaultPackageScope(repositoryName) &&
|
|
2770
|
+
isValidNewNpmPackageName(`@${repositoryName}/typescript-config`);
|
|
2771
|
+
if (normalizedScope === undefined && !validRepositoryScope) {
|
|
2772
|
+
issues.push({ code: "INVALID_REPOSITORY_SCOPE" });
|
|
2773
|
+
}
|
|
2774
|
+
const resolvedScope = validScopeOverride
|
|
2775
|
+
? (normalizedScope ?? "repository")
|
|
2776
|
+
: validRepositoryScope
|
|
2777
|
+
? repositoryName
|
|
2778
|
+
: "repository";
|
|
2779
|
+
const resolvedLeaf = configurablePrimaryPackage &&
|
|
2780
|
+
nameOverride !== undefined &&
|
|
2781
|
+
validNameOverride
|
|
2782
|
+
? nameOverride
|
|
2783
|
+
: configurablePrimaryPackage
|
|
2784
|
+
? definition.initialPrimaryPackage?.defaultLeafName
|
|
2785
|
+
: undefined;
|
|
2786
|
+
if (resolvedLeaf !== undefined &&
|
|
2787
|
+
!isValidNewNpmPackageName(`@${resolvedScope}/${resolvedLeaf}`)) {
|
|
2788
|
+
if (nameOverride !== undefined) {
|
|
2789
|
+
validNameOverride = false;
|
|
2790
|
+
issues.push({ code: "INVALID_PACKAGE_NAME" });
|
|
2791
|
+
}
|
|
2792
|
+
else if (scopeOverride !== undefined) {
|
|
2793
|
+
validScopeOverride = false;
|
|
2794
|
+
issues.push({ code: "INVALID_PACKAGE_SCOPE" });
|
|
2795
|
+
}
|
|
2796
|
+
else {
|
|
2797
|
+
validRepositoryScope = false;
|
|
2798
|
+
issues.push({ code: "INVALID_REPOSITORY_SCOPE" });
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2801
|
+
const initialPrimaryPackage = definition.initialPrimaryPackage;
|
|
2802
|
+
const foundationDefinition = typescriptConfigPackageDefinition({
|
|
2803
|
+
foundationPackages: {
|
|
2804
|
+
typescriptConfiguration: {
|
|
2805
|
+
name: `@${resolvedScope}/typescript-config`,
|
|
2806
|
+
},
|
|
1313
2807
|
},
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
{
|
|
1317
|
-
|
|
2808
|
+
});
|
|
2809
|
+
if ((nameOverride !== undefined &&
|
|
2810
|
+
`@${resolvedScope}/${nameOverride}` === foundationDefinition.name) ||
|
|
2811
|
+
pathOverride === foundationDefinition.path) {
|
|
2812
|
+
issues.push({ code: "CONFLICTING_PACKAGE_IDENTITY" });
|
|
2813
|
+
}
|
|
2814
|
+
if (issues.length > 0) {
|
|
2815
|
+
return {
|
|
2816
|
+
status: "input-invalid",
|
|
2817
|
+
issues: deduplicateInitializationInputIssues(issues),
|
|
2818
|
+
};
|
|
2819
|
+
}
|
|
1318
2820
|
return {
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
buildArguments: developmentContainer.buildArguments,
|
|
1332
|
-
mounts: developmentContainer.mounts,
|
|
1333
|
-
probes: developmentContainer.probes,
|
|
1334
|
-
},
|
|
1335
|
-
environmentNeeds,
|
|
1336
|
-
deploymentEnvironmentNeeds,
|
|
1337
|
-
ciDiagnosticArtifacts,
|
|
1338
|
-
manifests: [...contributions.map((item) => item.manifest), rootManifest],
|
|
1339
|
-
dependencyCatalog,
|
|
1340
|
-
dependencyMaintenancePolicy,
|
|
1341
|
-
nextStepInstructions: [
|
|
1342
|
-
{ display: "pnpm install" },
|
|
1343
|
-
{ display: "pnpm run fix" },
|
|
1344
|
-
{ display: "pnpm run check" },
|
|
1345
|
-
],
|
|
2821
|
+
status: "valid",
|
|
2822
|
+
definition,
|
|
2823
|
+
normalizedScope,
|
|
2824
|
+
nameOverride,
|
|
2825
|
+
pathOverride,
|
|
2826
|
+
repositoryName,
|
|
2827
|
+
configurablePrimaryPackage,
|
|
2828
|
+
validScopeOverride,
|
|
2829
|
+
validRepositoryScope,
|
|
2830
|
+
resolvedScope,
|
|
2831
|
+
initialPrimaryPackage,
|
|
2832
|
+
foundationDefinition,
|
|
1346
2833
|
};
|
|
1347
2834
|
}
|
|
1348
|
-
function
|
|
1349
|
-
|
|
2835
|
+
export function validateGeneratedRepositoryInitializationInput(options) {
|
|
2836
|
+
const input = collectInitializationInput(options);
|
|
2837
|
+
return input.status === "input-invalid" ? input : { status: "valid" };
|
|
1350
2838
|
}
|
|
1351
2839
|
function errorDiagnostics(error) {
|
|
1352
2840
|
return (error instanceof Error ? error.message : String(error))
|
|
@@ -1476,6 +2964,7 @@ function planPreparedRepositoryInitialization(options) {
|
|
|
1476
2964
|
foundationContribution: typescriptConfigReplayAdapter.identify(typescriptConfigContribution(options.context, configDefinition)),
|
|
1477
2965
|
contributions,
|
|
1478
2966
|
mode: "initialization",
|
|
2967
|
+
rootNodeDeclaration: options.rootNodeDeclaration,
|
|
1479
2968
|
});
|
|
1480
2969
|
}
|
|
1481
2970
|
function assertPreflightedInitializationPlan(plan) {
|
|
@@ -1488,6 +2977,28 @@ function assertPreflightedInitializationPlan(plan) {
|
|
|
1488
2977
|
}
|
|
1489
2978
|
return plan;
|
|
1490
2979
|
}
|
|
2980
|
+
/** 精确 Node 事实必须是有三段补丁号的版本,不接受纯大版本或两段形式。 */
|
|
2981
|
+
const exactNodeVersionPattern = /^\d+\.\d+\.\d+$/u;
|
|
2982
|
+
/**
|
|
2983
|
+
* 私有根的 Node 声明:上下文带已知精确值时沿用该精确值,并校验其大版本与 nodeLtsMajor 一致;
|
|
2984
|
+
* 缺省时沿用原有大版本声明。这条缺省路径不作为新生成公开包范围的推导来源。
|
|
2985
|
+
*/
|
|
2986
|
+
function resolvePrivateRootNodeDeclaration(toolchain) {
|
|
2987
|
+
const { nodeLtsMajor, nodeVersion } = toolchain;
|
|
2988
|
+
if (nodeVersion === undefined)
|
|
2989
|
+
return nodeLtsMajor;
|
|
2990
|
+
if (!exactNodeVersionPattern.test(nodeVersion)) {
|
|
2991
|
+
throw new Error(`Generation Context 的 toolchain.nodeVersion 必须是精确三段 Node 版本("24.16.0"),实际收到 ${JSON.stringify(nodeVersion)}。`);
|
|
2992
|
+
}
|
|
2993
|
+
if (nodeVersion.slice(0, nodeVersion.indexOf(".")) !== nodeLtsMajor) {
|
|
2994
|
+
throw new Error(`Generation Context 的 toolchain.nodeVersion ${nodeVersion} 与 nodeLtsMajor ${nodeLtsMajor} 大版本不一致。`);
|
|
2995
|
+
}
|
|
2996
|
+
return nodeVersion;
|
|
2997
|
+
}
|
|
2998
|
+
/**
|
|
2999
|
+
* 直接规划接缝:调用方自带 Generation Context,私有根沿用其 Node 声明;上下文带精确事实时
|
|
3000
|
+
* 私有根得到精确版本。生产初始化由 prepareGeneratedRepositoryInitialization 投影 CLI 发版快照。
|
|
3001
|
+
*/
|
|
1491
3002
|
export function planGeneratedRepositoryInitialization(options) {
|
|
1492
3003
|
const prepared = preparePresetInitialization(options);
|
|
1493
3004
|
return assertPreflightedInitializationPlan(planPreparedRepositoryInitialization({
|
|
@@ -1495,79 +3006,46 @@ export function planGeneratedRepositoryInitialization(options) {
|
|
|
1495
3006
|
context: options.context,
|
|
1496
3007
|
presetBlueprint: prepared.presetBlueprint,
|
|
1497
3008
|
contributions: prepared.contributions,
|
|
3009
|
+
rootNodeDeclaration: resolvePrivateRootNodeDeclaration(options.context.toolchain),
|
|
1498
3010
|
}));
|
|
1499
3011
|
}
|
|
3012
|
+
/**
|
|
3013
|
+
* 初始化只消费随 CLI 发版的不可变工具链快照:私有根得到精确 Node 与 pnpm pin,
|
|
3014
|
+
* 选用 Rust 的仓库根 toolchain 声明得到快照的精确 Rust 版本,Generation Record 与容器等
|
|
3015
|
+
* 消费者继续得到派生的大版本。不读在线版本源,也不接受调用方版本。
|
|
3016
|
+
*/
|
|
3017
|
+
const initializationSnapshotToolchain = {
|
|
3018
|
+
nodeLtsMajor: releaseToolchainSnapshot.nodeVersion.slice(0, releaseToolchainSnapshot.nodeVersion.indexOf(".")),
|
|
3019
|
+
packageManagerPin: releaseToolchainSnapshot.packageManagerPin,
|
|
3020
|
+
nodeVersion: releaseToolchainSnapshot.nodeVersion,
|
|
3021
|
+
rustVersion: releaseToolchainSnapshot.rustVersion,
|
|
3022
|
+
};
|
|
1500
3023
|
export function prepareGeneratedRepositoryInitialization(options) {
|
|
1501
|
-
const
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
};
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
const repositoryName = path.basename(path.resolve(options.targetDir));
|
|
1512
|
-
const configurablePrimaryPackage = options.definition.initialPrimaryPackage !== undefined;
|
|
1513
|
-
if (!configurablePrimaryPackage &&
|
|
1514
|
-
(nameOverride !== undefined || pathOverride !== undefined)) {
|
|
1515
|
-
diagnostics.push(`Built-in Preset ${options.definition.metadata.name} has fixed initial package topology and does not accept --name or --path`);
|
|
1516
|
-
}
|
|
1517
|
-
let validNameOverride = nameOverride !== undefined &&
|
|
1518
|
-
isValidNewNpmPackageName(`@x/${nameOverride}`);
|
|
1519
|
-
if (nameOverride !== undefined && !validNameOverride) {
|
|
1520
|
-
diagnostics.push("--name must be an unscoped package leaf name");
|
|
1521
|
-
}
|
|
1522
|
-
let validPathOverride = pathOverride !== undefined;
|
|
1523
|
-
if (pathOverride !== undefined) {
|
|
1524
|
-
const pathValidation = validateNewPackagePath(pathOverride);
|
|
1525
|
-
if (!pathValidation.hasValidShape) {
|
|
1526
|
-
diagnostics.push("--path must be exactly two safe path segments");
|
|
1527
|
-
validPathOverride = false;
|
|
1528
|
-
}
|
|
1529
|
-
if (pathValidation.reservedWorkspaceCollection !== undefined) {
|
|
1530
|
-
diagnostics.push(`--path ${pathOverride} uses reserved workspace collection ${pathValidation.reservedWorkspaceCollection}`);
|
|
1531
|
-
validPathOverride = false;
|
|
3024
|
+
const input = collectInitializationInput(options);
|
|
3025
|
+
if (input.status === "input-invalid")
|
|
3026
|
+
return input;
|
|
3027
|
+
const { definition, normalizedScope, nameOverride, pathOverride, repositoryName, configurablePrimaryPackage, validScopeOverride, validRepositoryScope, resolvedScope, initialPrimaryPackage, foundationDefinition, } = input;
|
|
3028
|
+
let derivedPackagePath;
|
|
3029
|
+
if (initialPrimaryPackage !== undefined) {
|
|
3030
|
+
try {
|
|
3031
|
+
derivedPackagePath = initialPrimaryPackage.defaultPackagePath({
|
|
3032
|
+
packageLeafName: nameOverride ?? initialPrimaryPackage.defaultLeafName,
|
|
3033
|
+
});
|
|
1532
3034
|
}
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
scopeOverride === scopeOverride?.trim() &&
|
|
1536
|
-
isValidDefaultPackageScope(normalizedScope) &&
|
|
1537
|
-
isValidNewNpmPackageName(`@${normalizedScope}/typescript-config`);
|
|
1538
|
-
if (normalizedScope !== undefined && !validScopeOverride) {
|
|
1539
|
-
diagnostics.push("--scope must be a valid npm scope without whitespace");
|
|
1540
|
-
}
|
|
1541
|
-
let validRepositoryScope = isValidDefaultPackageScope(repositoryName) &&
|
|
1542
|
-
isValidNewNpmPackageName(`@${repositoryName}/typescript-config`);
|
|
1543
|
-
if (normalizedScope === undefined && !validRepositoryScope) {
|
|
1544
|
-
diagnostics.push(`Repository Identity ${repositoryName} is not a valid default package scope; pass --scope with a valid npm scope`);
|
|
1545
|
-
}
|
|
1546
|
-
const resolvedScope = validScopeOverride
|
|
1547
|
-
? (normalizedScope ?? "repository")
|
|
1548
|
-
: validRepositoryScope
|
|
1549
|
-
? repositoryName
|
|
1550
|
-
: "repository";
|
|
1551
|
-
const resolvedLeaf = configurablePrimaryPackage &&
|
|
1552
|
-
nameOverride !== undefined &&
|
|
1553
|
-
validNameOverride
|
|
1554
|
-
? nameOverride
|
|
1555
|
-
: configurablePrimaryPackage
|
|
1556
|
-
? options.definition.initialPrimaryPackage?.defaultLeafName
|
|
1557
|
-
: undefined;
|
|
1558
|
-
if (resolvedLeaf !== undefined &&
|
|
1559
|
-
!isValidNewNpmPackageName(`@${resolvedScope}/${resolvedLeaf}`)) {
|
|
1560
|
-
if (nameOverride !== undefined) {
|
|
1561
|
-
validNameOverride = false;
|
|
1562
|
-
diagnostics.push("--name must be an unscoped package leaf name");
|
|
3035
|
+
catch {
|
|
3036
|
+
return { status: "operation-failure", phase: "preset" };
|
|
1563
3037
|
}
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
3038
|
+
const derivedPathValidation = validateNewPackagePath(derivedPackagePath);
|
|
3039
|
+
if (!derivedPathValidation.hasValidShape ||
|
|
3040
|
+
derivedPathValidation.reservedWorkspaceCollection !== undefined) {
|
|
3041
|
+
return { status: "operation-failure", phase: "preset" };
|
|
1567
3042
|
}
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
3043
|
+
if ((nameOverride === undefined &&
|
|
3044
|
+
`@${resolvedScope}/${initialPrimaryPackage.defaultLeafName}` ===
|
|
3045
|
+
foundationDefinition.name) ||
|
|
3046
|
+
(pathOverride === undefined &&
|
|
3047
|
+
derivedPackagePath === foundationDefinition.path)) {
|
|
3048
|
+
return { status: "operation-failure", phase: "preset" };
|
|
1571
3049
|
}
|
|
1572
3050
|
}
|
|
1573
3051
|
const context = createGenerationContext({
|
|
@@ -1577,77 +3055,56 @@ export function prepareGeneratedRepositoryInitialization(options) {
|
|
|
1577
3055
|
: validRepositoryScope
|
|
1578
3056
|
? repositoryName
|
|
1579
3057
|
: "repository",
|
|
1580
|
-
toolchain:
|
|
3058
|
+
toolchain: initializationSnapshotToolchain,
|
|
1581
3059
|
});
|
|
1582
|
-
const safeNameOverride = configurablePrimaryPackage && nameOverride !== undefined
|
|
1583
|
-
? validNameOverride
|
|
1584
|
-
? nameOverride
|
|
1585
|
-
: "x"
|
|
1586
|
-
: undefined;
|
|
1587
|
-
let safeDerivedPathOverride;
|
|
1588
|
-
const initialPrimaryPackage = options.definition.initialPrimaryPackage;
|
|
1589
|
-
if (initialPrimaryPackage !== undefined && pathOverride === undefined) {
|
|
1590
|
-
const safeLeafName = safeNameOverride ?? initialPrimaryPackage.defaultLeafName;
|
|
1591
|
-
const derivedPackagePath = initialPrimaryPackage.defaultPackagePath({
|
|
1592
|
-
packageLeafName: safeLeafName,
|
|
1593
|
-
});
|
|
1594
|
-
const derivedPathValidation = validateNewPackagePath(derivedPackagePath);
|
|
1595
|
-
if (!derivedPathValidation.hasValidShape ||
|
|
1596
|
-
derivedPathValidation.reservedWorkspaceCollection !== undefined) {
|
|
1597
|
-
diagnostics.push(`Preset-derived Package Path ${derivedPackagePath} is unsafe; pass --path with exactly two safe path segments`);
|
|
1598
|
-
safeDerivedPathOverride = "packages/invalid";
|
|
1599
|
-
}
|
|
1600
|
-
}
|
|
1601
3060
|
const safeIdentityOverrides = {
|
|
1602
|
-
...(
|
|
3061
|
+
...(configurablePrimaryPackage && nameOverride !== undefined
|
|
3062
|
+
? { name: nameOverride }
|
|
3063
|
+
: {}),
|
|
1603
3064
|
...(configurablePrimaryPackage && pathOverride !== undefined
|
|
1604
|
-
? { path:
|
|
1605
|
-
:
|
|
3065
|
+
? { path: pathOverride }
|
|
3066
|
+
: derivedPackagePath === undefined
|
|
1606
3067
|
? {}
|
|
1607
|
-
: { path:
|
|
3068
|
+
: { path: derivedPackagePath }),
|
|
1608
3069
|
};
|
|
1609
3070
|
let prepared;
|
|
1610
3071
|
try {
|
|
1611
3072
|
prepared = preparePresetInitialization({
|
|
1612
|
-
definition
|
|
3073
|
+
definition,
|
|
1613
3074
|
context,
|
|
1614
3075
|
...(Object.keys(safeIdentityOverrides).length === 0
|
|
1615
3076
|
? {}
|
|
1616
3077
|
: { overrides: safeIdentityOverrides }),
|
|
1617
3078
|
});
|
|
1618
3079
|
}
|
|
1619
|
-
catch
|
|
1620
|
-
|
|
3080
|
+
catch {
|
|
3081
|
+
return { status: "operation-failure", phase: "preset" };
|
|
1621
3082
|
}
|
|
1622
3083
|
let plan;
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
}
|
|
1632
|
-
|
|
1633
|
-
appendDiagnostics(error);
|
|
1634
|
-
}
|
|
1635
|
-
}
|
|
1636
|
-
if (plan !== undefined) {
|
|
1637
|
-
diagnostics.push(...validateProjectProjectionPlan({
|
|
3084
|
+
try {
|
|
3085
|
+
plan = planPreparedRepositoryInitialization({
|
|
3086
|
+
definition,
|
|
3087
|
+
context,
|
|
3088
|
+
presetBlueprint: prepared.presetBlueprint,
|
|
3089
|
+
contributions: prepared.contributions,
|
|
3090
|
+
// 私有根与上下文共用同一精确 Node 事实的推导点,避免根声明与上下文出现两个来源。
|
|
3091
|
+
rootNodeDeclaration: resolvePrivateRootNodeDeclaration(context.toolchain),
|
|
3092
|
+
});
|
|
3093
|
+
if (validateProjectProjectionPlan({
|
|
1638
3094
|
operations: plan.operations,
|
|
1639
3095
|
reconciliation: plan.reconciliation,
|
|
1640
|
-
}))
|
|
3096
|
+
}).length > 0) {
|
|
3097
|
+
return { status: "operation-failure", phase: "preflight" };
|
|
3098
|
+
}
|
|
1641
3099
|
}
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
if (prepared === undefined || plan === undefined) {
|
|
1645
|
-
throw new Error("Initialization preparation did not produce a plan");
|
|
3100
|
+
catch {
|
|
3101
|
+
return { status: "operation-failure", phase: "planning" };
|
|
1646
3102
|
}
|
|
1647
3103
|
return {
|
|
3104
|
+
status: "ready",
|
|
1648
3105
|
context,
|
|
1649
3106
|
resolved: {
|
|
1650
|
-
preset:
|
|
3107
|
+
preset: definition.metadata.name,
|
|
1651
3108
|
topology: prepared.resolvedPackageIdentity === undefined
|
|
1652
3109
|
? "fixed"
|
|
1653
3110
|
: "configurable-primary-package",
|
|
@@ -1666,24 +3123,11 @@ export function prepareGeneratedRepositoryInitialization(options) {
|
|
|
1666
3123
|
: { command: "./scripts/npm-publication-setup/setup.sh" },
|
|
1667
3124
|
};
|
|
1668
3125
|
}
|
|
1669
|
-
|
|
3126
|
+
function planGeneratedRepositoryPackageAdditionFromPreparedContribution(options) {
|
|
1670
3127
|
const { blueprint: persistedBlueprint, context } = options.localTemplateMetadata;
|
|
3128
|
+
const { rootNodeDeclaration } = options.localTemplateMetadata[localTemplateMetadataStateKey];
|
|
1671
3129
|
assertProjectBlueprint(persistedBlueprint);
|
|
1672
|
-
|
|
1673
|
-
throw new Error(`Built-in Preset ${options.definition.metadata.name} does not support Package Addition`);
|
|
1674
|
-
const packagePath = options.packagePath ??
|
|
1675
|
-
options.definition.defaultPackagePath?.({
|
|
1676
|
-
context,
|
|
1677
|
-
packageLeafName: options.packageLeafName,
|
|
1678
|
-
});
|
|
1679
|
-
if (packagePath === undefined) {
|
|
1680
|
-
throw new Error(`Built-in Preset ${options.definition.metadata.name} must own a default Package Path or receive an explicit Package Path`);
|
|
1681
|
-
}
|
|
1682
|
-
const contribution = options.definition.planPackageAddition({
|
|
1683
|
-
context,
|
|
1684
|
-
packageLeafName: options.packageLeafName,
|
|
1685
|
-
packagePath,
|
|
1686
|
-
});
|
|
3130
|
+
const contribution = options.contribution;
|
|
1687
3131
|
const requestedPackageLinkIntents = [...new Set(options.linkFrom ?? [])].map((consumerPackagePath) => ({
|
|
1688
3132
|
consumerPackagePath,
|
|
1689
3133
|
providerPackagePath: contribution.definition.path,
|
|
@@ -1703,10 +3147,10 @@ export function planGeneratedRepositoryPackageAddition(options) {
|
|
|
1703
3147
|
foundationContribution: existing.foundationContribution,
|
|
1704
3148
|
contributions: existing.contributions,
|
|
1705
3149
|
renderContributions: [],
|
|
1706
|
-
existingDeploymentEnvironmentNeeds: existing.deploymentEnvironmentNeeds,
|
|
1707
3150
|
manifestTruthByPackagePath: existing.manifestTruthByPackagePath,
|
|
1708
3151
|
generationRecord: existing.generationRecord,
|
|
1709
3152
|
mode: "addition",
|
|
3153
|
+
rootNodeDeclaration,
|
|
1710
3154
|
});
|
|
1711
3155
|
const currentProjection = foundationPlan({
|
|
1712
3156
|
definition: options.definition,
|
|
@@ -1714,9 +3158,9 @@ export function planGeneratedRepositoryPackageAddition(options) {
|
|
|
1714
3158
|
blueprint: persistedBlueprint,
|
|
1715
3159
|
foundationContribution: existing.foundationContribution,
|
|
1716
3160
|
contributions: existing.contributions,
|
|
1717
|
-
existingDeploymentEnvironmentNeeds: existing.deploymentEnvironmentNeeds,
|
|
1718
3161
|
generationRecord: existing.generationRecord,
|
|
1719
3162
|
mode: "initialization",
|
|
3163
|
+
rootNodeDeclaration,
|
|
1720
3164
|
});
|
|
1721
3165
|
return {
|
|
1722
3166
|
...plan,
|
|
@@ -1735,9 +3179,9 @@ export function planGeneratedRepositoryPackageAddition(options) {
|
|
|
1735
3179
|
};
|
|
1736
3180
|
}
|
|
1737
3181
|
if (isExactPackageDefinition) {
|
|
1738
|
-
throw new
|
|
3182
|
+
throw new PackageAdditionBusinessConflict("missing-link", conflictingPackage, contribution.definition, missingPackageLinkIntent);
|
|
1739
3183
|
}
|
|
1740
|
-
throw new
|
|
3184
|
+
throw new PackageAdditionBusinessConflict("identity", conflictingPackage, contribution.definition);
|
|
1741
3185
|
}
|
|
1742
3186
|
const contributionIdentity = requireReplayAdapter({
|
|
1743
3187
|
owner: options.definition.metadata.name,
|
|
@@ -1798,9 +3242,9 @@ export function planGeneratedRepositoryPackageAddition(options) {
|
|
|
1798
3242
|
blueprint: persistedBlueprint,
|
|
1799
3243
|
foundationContribution: existing.foundationContribution,
|
|
1800
3244
|
contributions: existing.contributions,
|
|
1801
|
-
existingDeploymentEnvironmentNeeds: existing.deploymentEnvironmentNeeds,
|
|
1802
3245
|
generationRecord: existing.generationRecord,
|
|
1803
3246
|
mode: "initialization",
|
|
3247
|
+
rootNodeDeclaration,
|
|
1804
3248
|
});
|
|
1805
3249
|
const afterProjection = foundationPlan({
|
|
1806
3250
|
definition: options.definition,
|
|
@@ -1808,10 +3252,10 @@ export function planGeneratedRepositoryPackageAddition(options) {
|
|
|
1808
3252
|
blueprint,
|
|
1809
3253
|
foundationContribution: existing.foundationContribution,
|
|
1810
3254
|
contributions: [...existing.contributions, contribution],
|
|
1811
|
-
existingDeploymentEnvironmentNeeds: existing.deploymentEnvironmentNeeds,
|
|
1812
3255
|
manifestTruthByPackagePath: existing.manifestTruthByPackagePath,
|
|
1813
3256
|
generationRecord,
|
|
1814
3257
|
mode: "initialization",
|
|
3258
|
+
rootNodeDeclaration,
|
|
1815
3259
|
});
|
|
1816
3260
|
const plan = foundationPlan({
|
|
1817
3261
|
definition: options.definition,
|
|
@@ -1820,20 +3264,35 @@ export function planGeneratedRepositoryPackageAddition(options) {
|
|
|
1820
3264
|
foundationContribution: existing.foundationContribution,
|
|
1821
3265
|
contributions: [...existing.contributions, contribution],
|
|
1822
3266
|
renderContributions: [contribution],
|
|
1823
|
-
existingDeploymentEnvironmentNeeds: existing.deploymentEnvironmentNeeds,
|
|
1824
3267
|
manifestTruthByPackagePath: existing.manifestTruthByPackagePath,
|
|
1825
3268
|
generationRecord,
|
|
1826
3269
|
mode: "addition",
|
|
3270
|
+
rootNodeDeclaration,
|
|
1827
3271
|
});
|
|
3272
|
+
let beforeOperations = beforeProjection.operations;
|
|
3273
|
+
let afterOperations = afterProjection.operations;
|
|
3274
|
+
if (options.existingRootRustDeclaration !== undefined) {
|
|
3275
|
+
const preserveOperation = {
|
|
3276
|
+
kind: "writeText",
|
|
3277
|
+
to: rootRustDeclarationFileName,
|
|
3278
|
+
text: options.existingRootRustDeclaration,
|
|
3279
|
+
};
|
|
3280
|
+
beforeOperations = [...beforeProjection.operations, preserveOperation];
|
|
3281
|
+
afterOperations = afterProjection.operations.map((operation) => operation.kind === "writeTextTemplate" &&
|
|
3282
|
+
"to" in operation &&
|
|
3283
|
+
operation.to === rootRustDeclarationFileName
|
|
3284
|
+
? preserveOperation
|
|
3285
|
+
: operation);
|
|
3286
|
+
}
|
|
1828
3287
|
return {
|
|
1829
3288
|
...plan,
|
|
1830
3289
|
projectProjections: {
|
|
1831
3290
|
before: {
|
|
1832
|
-
operations:
|
|
3291
|
+
operations: beforeOperations,
|
|
1833
3292
|
reconciliation: beforeProjection.reconciliation,
|
|
1834
3293
|
},
|
|
1835
3294
|
after: {
|
|
1836
|
-
operations:
|
|
3295
|
+
operations: afterOperations,
|
|
1837
3296
|
reconciliation: afterProjection.reconciliation,
|
|
1838
3297
|
},
|
|
1839
3298
|
preconditions: [
|
|
@@ -1846,3 +3305,215 @@ export function planGeneratedRepositoryPackageAddition(options) {
|
|
|
1846
3305
|
},
|
|
1847
3306
|
};
|
|
1848
3307
|
}
|
|
3308
|
+
export function planGeneratedRepositoryPackageAddition(options) {
|
|
3309
|
+
const { context } = options.localTemplateMetadata;
|
|
3310
|
+
if (options.definition.planPackageAddition === undefined) {
|
|
3311
|
+
throw new Error(`Built-in Preset ${options.definition.metadata.name} does not support Package Addition`);
|
|
3312
|
+
}
|
|
3313
|
+
const packagePath = options.packagePath ??
|
|
3314
|
+
options.definition.defaultPackagePath?.({
|
|
3315
|
+
context,
|
|
3316
|
+
packageLeafName: options.packageLeafName,
|
|
3317
|
+
});
|
|
3318
|
+
if (packagePath === undefined) {
|
|
3319
|
+
throw new Error(`Built-in Preset ${options.definition.metadata.name} must own a default Package Path or receive an explicit Package Path`);
|
|
3320
|
+
}
|
|
3321
|
+
const contribution = options.definition.planPackageAddition({
|
|
3322
|
+
context,
|
|
3323
|
+
packageLeafName: options.packageLeafName,
|
|
3324
|
+
packagePath,
|
|
3325
|
+
});
|
|
3326
|
+
return planGeneratedRepositoryPackageAdditionFromPreparedContribution({
|
|
3327
|
+
...options,
|
|
3328
|
+
packagePath,
|
|
3329
|
+
contribution,
|
|
3330
|
+
});
|
|
3331
|
+
}
|
|
3332
|
+
function collectPackageAdditionInput(options) {
|
|
3333
|
+
const issues = [];
|
|
3334
|
+
const definition = builtInPresetRegistry
|
|
3335
|
+
.all()
|
|
3336
|
+
.find((candidate) => candidate.metadata.name === options.preset);
|
|
3337
|
+
if (definition === undefined)
|
|
3338
|
+
issues.push({ code: "PRESET_UNKNOWN" });
|
|
3339
|
+
else if (definition.planPackageAddition === undefined)
|
|
3340
|
+
issues.push({ code: "PRESET_NOT_ADDABLE" });
|
|
3341
|
+
if (!isValidNewNpmPackageName(`@x/${options.packageLeafName}`)) {
|
|
3342
|
+
issues.push({ code: "INVALID_PACKAGE_NAME" });
|
|
3343
|
+
}
|
|
3344
|
+
if (options.packagePath !== undefined) {
|
|
3345
|
+
const validation = validateNewPackagePath(options.packagePath);
|
|
3346
|
+
if (!validation.hasValidShape)
|
|
3347
|
+
issues.push({ code: "INVALID_PACKAGE_PATH" });
|
|
3348
|
+
if (validation.reservedWorkspaceCollection !== undefined) {
|
|
3349
|
+
issues.push({ code: "RESERVED_PACKAGE_PATH" });
|
|
3350
|
+
}
|
|
3351
|
+
}
|
|
3352
|
+
const linkFrom = [...new Set(options.linkFrom ?? [])];
|
|
3353
|
+
for (const consumerPackagePath of linkFrom) {
|
|
3354
|
+
const validation = validateNewPackagePath(consumerPackagePath);
|
|
3355
|
+
if (!validation.hasValidShape) {
|
|
3356
|
+
issues.push({ code: "INVALID_LINK_FROM" });
|
|
3357
|
+
}
|
|
3358
|
+
if (validation.reservedWorkspaceCollection !== undefined)
|
|
3359
|
+
issues.push({ code: "RESERVED_LINK_FROM" });
|
|
3360
|
+
}
|
|
3361
|
+
if (issues.length > 0 || definition === undefined) {
|
|
3362
|
+
return { status: "input-invalid", issues };
|
|
3363
|
+
}
|
|
3364
|
+
return { status: "valid", definition, linkFrom };
|
|
3365
|
+
}
|
|
3366
|
+
/**
|
|
3367
|
+
* Command-owned preparation: user input is checked before local metadata or any
|
|
3368
|
+
* Preset default/planner work; all remaining failures are deliberately bounded.
|
|
3369
|
+
*/
|
|
3370
|
+
export function prepareGeneratedRepositoryPackageAddition(options) {
|
|
3371
|
+
const input = collectPackageAdditionInput(options);
|
|
3372
|
+
if (input.status === "input-invalid")
|
|
3373
|
+
return input;
|
|
3374
|
+
let localTemplateMetadata;
|
|
3375
|
+
try {
|
|
3376
|
+
localTemplateMetadata = loadLocalTemplateMetadata(options.repositoryRoot);
|
|
3377
|
+
}
|
|
3378
|
+
catch (error) {
|
|
3379
|
+
if (error instanceof PackageAdditionTargetDeclarationFailure) {
|
|
3380
|
+
return {
|
|
3381
|
+
status: "operation-failure",
|
|
3382
|
+
phase: "metadata",
|
|
3383
|
+
diagnostic: { message: error.message, suggestion: error.suggestion },
|
|
3384
|
+
};
|
|
3385
|
+
}
|
|
3386
|
+
return { status: "operation-failure", phase: "metadata" };
|
|
3387
|
+
}
|
|
3388
|
+
if (input.linkFrom.some((consumerPackagePath) => !localTemplateMetadata.blueprint.packages.some((candidate) => candidate.path === consumerPackagePath))) {
|
|
3389
|
+
return {
|
|
3390
|
+
status: "input-invalid",
|
|
3391
|
+
issues: [{ code: "UNKNOWN_LINK_FROM" }],
|
|
3392
|
+
};
|
|
3393
|
+
}
|
|
3394
|
+
let packagePath = options.packagePath;
|
|
3395
|
+
if (packagePath === undefined) {
|
|
3396
|
+
try {
|
|
3397
|
+
packagePath = input.definition.defaultPackagePath?.({
|
|
3398
|
+
context: localTemplateMetadata.context,
|
|
3399
|
+
packageLeafName: options.packageLeafName,
|
|
3400
|
+
});
|
|
3401
|
+
}
|
|
3402
|
+
catch {
|
|
3403
|
+
return { status: "operation-failure", phase: "default" };
|
|
3404
|
+
}
|
|
3405
|
+
const defaultPathValidation = packagePath === undefined
|
|
3406
|
+
? undefined
|
|
3407
|
+
: validateNewPackagePath(packagePath);
|
|
3408
|
+
if (defaultPathValidation === undefined ||
|
|
3409
|
+
!defaultPathValidation.hasValidShape ||
|
|
3410
|
+
defaultPathValidation.reservedWorkspaceCollection !== undefined) {
|
|
3411
|
+
return { status: "operation-failure", phase: "default" };
|
|
3412
|
+
}
|
|
3413
|
+
}
|
|
3414
|
+
if (packagePath === undefined) {
|
|
3415
|
+
return { status: "operation-failure", phase: "default" };
|
|
3416
|
+
}
|
|
3417
|
+
let provider;
|
|
3418
|
+
try {
|
|
3419
|
+
provider = input.definition.planPackageAddition({
|
|
3420
|
+
context: localTemplateMetadata.context,
|
|
3421
|
+
packageLeafName: options.packageLeafName,
|
|
3422
|
+
packagePath,
|
|
3423
|
+
});
|
|
3424
|
+
}
|
|
3425
|
+
catch {
|
|
3426
|
+
return { status: "operation-failure", phase: "planning" };
|
|
3427
|
+
}
|
|
3428
|
+
// 首次引入 Rust 的加包按目标事实二选一:已有合法根声明由该声明拥有版本并原正文保留;
|
|
3429
|
+
// 没有根声明才以当前 CLI 已验证快照建源。已有 Rust 能力的仓库在 loadLocalTemplateMetadata
|
|
3430
|
+
// 已由根 channel 重放(缺真源在那里失败),不进入这条路径;不可解释的声明在此可行动失败,
|
|
3431
|
+
// 不用快照掩盖。非 Rust 加包不读无关根文件。
|
|
3432
|
+
let additionMetadata = localTemplateMetadata;
|
|
3433
|
+
let preservedRootRustDeclaration;
|
|
3434
|
+
if (provider.foundation.toolchains.rust !== undefined &&
|
|
3435
|
+
localTemplateMetadata.context.toolchain.rustVersion === undefined) {
|
|
3436
|
+
const repositoryRoot = localTemplateMetadata.context.targetDir;
|
|
3437
|
+
const rootDeclarationPath = path.join(repositoryRoot, rootRustDeclarationFileName);
|
|
3438
|
+
const existingDeclaration = existsSync(rootDeclarationPath)
|
|
3439
|
+
? readFileSync(rootDeclarationPath, "utf8")
|
|
3440
|
+
: undefined;
|
|
3441
|
+
let rustVersion;
|
|
3442
|
+
try {
|
|
3443
|
+
if (existingDeclaration === undefined) {
|
|
3444
|
+
rustVersion = releaseToolchainSnapshot.rustVersion;
|
|
3445
|
+
}
|
|
3446
|
+
else {
|
|
3447
|
+
rustVersion = readPackageAdditionTargetRustChannel(repositoryRoot);
|
|
3448
|
+
preservedRootRustDeclaration = existingDeclaration;
|
|
3449
|
+
}
|
|
3450
|
+
}
|
|
3451
|
+
catch (error) {
|
|
3452
|
+
if (error instanceof PackageAdditionTargetDeclarationFailure) {
|
|
3453
|
+
return {
|
|
3454
|
+
status: "operation-failure",
|
|
3455
|
+
phase: "metadata",
|
|
3456
|
+
diagnostic: { message: error.message, suggestion: error.suggestion },
|
|
3457
|
+
};
|
|
3458
|
+
}
|
|
3459
|
+
return { status: "operation-failure", phase: "metadata" };
|
|
3460
|
+
}
|
|
3461
|
+
additionMetadata = {
|
|
3462
|
+
...localTemplateMetadata,
|
|
3463
|
+
context: {
|
|
3464
|
+
...localTemplateMetadata.context,
|
|
3465
|
+
toolchain: {
|
|
3466
|
+
...localTemplateMetadata.context.toolchain,
|
|
3467
|
+
rustVersion,
|
|
3468
|
+
},
|
|
3469
|
+
},
|
|
3470
|
+
};
|
|
3471
|
+
try {
|
|
3472
|
+
provider = input.definition.planPackageAddition({
|
|
3473
|
+
context: additionMetadata.context,
|
|
3474
|
+
packageLeafName: options.packageLeafName,
|
|
3475
|
+
packagePath,
|
|
3476
|
+
});
|
|
3477
|
+
}
|
|
3478
|
+
catch {
|
|
3479
|
+
return { status: "operation-failure", phase: "planning" };
|
|
3480
|
+
}
|
|
3481
|
+
}
|
|
3482
|
+
const contributionsByPath = new Map(localTemplateMetadata[localTemplateMetadataStateKey].packageContributions.map((contribution) => [
|
|
3483
|
+
contribution.definition.path,
|
|
3484
|
+
contribution,
|
|
3485
|
+
]));
|
|
3486
|
+
if (input.linkFrom.length > 0 &&
|
|
3487
|
+
(!canProvideSourceConditionPackageNameImport(provider) ||
|
|
3488
|
+
input.linkFrom.some((consumerPackagePath) => {
|
|
3489
|
+
const consumer = contributionsByPath.get(consumerPackagePath);
|
|
3490
|
+
return (consumer === undefined ||
|
|
3491
|
+
!canConsumeNodePackageNameImport(consumer) ||
|
|
3492
|
+
!canLinkNodePackageRoles(consumer.definition.role, provider.definition.role));
|
|
3493
|
+
}))) {
|
|
3494
|
+
return { status: "input-invalid", issues: [{ code: "UNSUPPORTED_LINK" }] };
|
|
3495
|
+
}
|
|
3496
|
+
try {
|
|
3497
|
+
return {
|
|
3498
|
+
status: "ready",
|
|
3499
|
+
definition: input.definition,
|
|
3500
|
+
plan: planGeneratedRepositoryPackageAdditionFromPreparedContribution({
|
|
3501
|
+
definition: input.definition,
|
|
3502
|
+
localTemplateMetadata: additionMetadata,
|
|
3503
|
+
packageLeafName: options.packageLeafName,
|
|
3504
|
+
packagePath,
|
|
3505
|
+
contribution: provider,
|
|
3506
|
+
...(input.linkFrom.length === 0 ? {} : { linkFrom: input.linkFrom }),
|
|
3507
|
+
...(preservedRootRustDeclaration === undefined
|
|
3508
|
+
? {}
|
|
3509
|
+
: { existingRootRustDeclaration: preservedRootRustDeclaration }),
|
|
3510
|
+
}),
|
|
3511
|
+
};
|
|
3512
|
+
}
|
|
3513
|
+
catch (error) {
|
|
3514
|
+
if (error instanceof PackageAdditionBusinessConflict) {
|
|
3515
|
+
return { status: "conflict", conflict: error };
|
|
3516
|
+
}
|
|
3517
|
+
return { status: "operation-failure", phase: "planning" };
|
|
3518
|
+
}
|
|
3519
|
+
}
|