@orkestrel/scaffold 0.0.4 → 0.0.6
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/bin/scaffold.js +57 -22
- package/dist/bin/scaffold.js.map +1 -1
- package/dist/host/CLAUDE.md +18 -4
- package/dist/host/claude/agents/codex.md +16 -0
- package/dist/host/claude/rules/workspace.md +8 -8
- package/dist/host/guides/src/scaffold.md +144 -42
- package/dist/host/scripts/codex.sh +5 -0
- package/dist/host/tests/setupPolicy.ts +178 -4
- package/dist/src/core/index.cjs +285 -129
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +109 -25
- package/dist/src/core/index.d.ts +109 -25
- package/dist/src/core/index.js +283 -130
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +11 -5
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +4 -2
- package/dist/src/server/index.d.ts +4 -2
- package/dist/src/server/index.js +12 -6
- package/dist/src/server/index.js.map +1 -1
- package/package.json +5 -5
package/dist/src/core/index.cjs
CHANGED
|
@@ -104,9 +104,12 @@ var APP_MATRIX = Object.freeze({
|
|
|
104
104
|
* The root docs (`AGENTS.md` / `CLAUDE.md`), `LICENSE`, `.agents`, `.claude`, `.codex`,
|
|
105
105
|
* the four SessionStart hook scripts (`scripts/deps.sh` / `scripts/cursor.sh` /
|
|
106
106
|
* `scripts/codex.sh` / `scripts/ollama.sh`), the repository coding-law policy module,
|
|
107
|
-
* the line's seven byte-identical root dotfiles, and the two guides-grouped
|
|
108
|
-
* dev-tooling guide
|
|
109
|
-
* scaffold engine's own self-guide
|
|
107
|
+
* the line's seven byte-identical root dotfiles, and the two guides-grouped
|
|
108
|
+
* mirror candidates: the line-wide dev-tooling guide
|
|
109
|
+
* (`guides/src/guide.md`) and the scaffold engine's own self-guide
|
|
110
|
+
* (`guides/src/scaffold.md`). `stageHost` vendors both; each plan carries the
|
|
111
|
+
* subset selected by `selectHostPaths`, omitting the target blueprint's own
|
|
112
|
+
* guide.
|
|
110
113
|
*/
|
|
111
114
|
var HOST_PATHS = Object.freeze([
|
|
112
115
|
"AGENTS.md",
|
|
@@ -218,15 +221,15 @@ var DEFAULT_VERSION = "0.0.1";
|
|
|
218
221
|
/** The `engines.node` range the `blueprint` builder fills. */
|
|
219
222
|
var DEFAULT_ENGINES = `>=${MINIMUM_NODE_VERSION}`;
|
|
220
223
|
/** The devDependency range generated packages pin `@orkestrel/scaffold` at. */
|
|
221
|
-
var SCAFFOLD_RANGE = "^0.0.
|
|
224
|
+
var SCAFFOLD_RANGE = "^0.0.6";
|
|
222
225
|
/** Tooling versions shared by scaffold and every generated workspace. */
|
|
223
226
|
var BASE_DEV_DEPENDENCIES = Object.freeze({
|
|
224
227
|
"@microsoft/api-extractor": "^7.58.12",
|
|
225
228
|
"@orkestrel/guide": "^0.0.5",
|
|
226
229
|
"@orkestrel/scaffold": SCAFFOLD_RANGE,
|
|
227
|
-
"@types/node": "^26.1.
|
|
228
|
-
oxfmt: "^0.
|
|
229
|
-
oxlint: "^1.
|
|
230
|
+
"@types/node": "^26.1.2",
|
|
231
|
+
oxfmt: "^0.61.0",
|
|
232
|
+
oxlint: "^1.76.0",
|
|
230
233
|
typescript: "^6.0.3",
|
|
231
234
|
vite: "^8.1.5",
|
|
232
235
|
"vite-plugin-dts": "^5.0.3",
|
|
@@ -1140,6 +1143,22 @@ function snapshotOf(current) {
|
|
|
1140
1143
|
return Object.fromEntries(entries);
|
|
1141
1144
|
}
|
|
1142
1145
|
/**
|
|
1146
|
+
* Select host paths without the guide owned by the target blueprint.
|
|
1147
|
+
*
|
|
1148
|
+
* @param paths - Host artifact paths in deterministic input order.
|
|
1149
|
+
* @param name - The target blueprint's unscoped package name.
|
|
1150
|
+
* @returns Every host path except `guides/src/<name>.md`, in input order.
|
|
1151
|
+
*
|
|
1152
|
+
* @example
|
|
1153
|
+
* ```ts
|
|
1154
|
+
* selectHostPaths(['guides/src/guide.md', 'LICENSE'], 'guide') // ['LICENSE']
|
|
1155
|
+
* ```
|
|
1156
|
+
*/
|
|
1157
|
+
function selectHostPaths(paths, name) {
|
|
1158
|
+
const guide = `guides/src/${name}.md`;
|
|
1159
|
+
return paths.filter((path) => path !== guide);
|
|
1160
|
+
}
|
|
1161
|
+
/**
|
|
1143
1162
|
* Find the first exact or portable case-insensitive path collision.
|
|
1144
1163
|
*
|
|
1145
1164
|
* @param paths - Portable paths in deterministic input order.
|
|
@@ -1442,6 +1461,29 @@ function manifestToDependencies(manifestText) {
|
|
|
1442
1461
|
return dependencies;
|
|
1443
1462
|
}
|
|
1444
1463
|
/**
|
|
1464
|
+
* Project a `package.json` text to its own string `name`.
|
|
1465
|
+
*
|
|
1466
|
+
* @param manifest - The `package.json` file content.
|
|
1467
|
+
* @returns The own string `name`, or `undefined` when the manifest exceeds its
|
|
1468
|
+
* byte ceiling, is malformed, has a non-object root, or has no own string
|
|
1469
|
+
* `name`.
|
|
1470
|
+
*
|
|
1471
|
+
* @example
|
|
1472
|
+
* ```ts
|
|
1473
|
+
* import { manifestToName } from '@orkestrel/scaffold'
|
|
1474
|
+
*
|
|
1475
|
+
* manifestToName('{"name":"@orkestrel/router"}') // '@orkestrel/router'
|
|
1476
|
+
* manifestToName('{}') // undefined
|
|
1477
|
+
* ```
|
|
1478
|
+
*/
|
|
1479
|
+
function manifestToName(manifest) {
|
|
1480
|
+
if (manifest.length > 1048576 || contentByteLength(manifest) > 1048576) return;
|
|
1481
|
+
const parsed = (0, _orkestrel_contract.parseJSON)(manifest);
|
|
1482
|
+
if (!(0, _orkestrel_contract.isRecord)(parsed)) return void 0;
|
|
1483
|
+
const name = ownDataValue(parsed, "name");
|
|
1484
|
+
return typeof name === "string" ? name : void 0;
|
|
1485
|
+
}
|
|
1486
|
+
/**
|
|
1445
1487
|
* Compare a declared range to the registry latest.
|
|
1446
1488
|
*
|
|
1447
1489
|
* @param range - The declared semver range.
|
|
@@ -2146,6 +2188,7 @@ var isPlan = (0, _orkestrel_contract.andOf)((0, _orkestrel_contract.andOf)((0, _
|
|
|
2146
2188
|
function validatePlan(plan) {
|
|
2147
2189
|
const blueprintValidation = validateBlueprint(plan.blueprint);
|
|
2148
2190
|
const questions = [...blueprintValidation.questions];
|
|
2191
|
+
const warnings = [...blueprintValidation.warnings];
|
|
2149
2192
|
if (!hasValidPlanBytes(plan)) questions.push({
|
|
2150
2193
|
field: "artifacts",
|
|
2151
2194
|
text: "Plan artifact content exceeds the retained byte limits",
|
|
@@ -2170,16 +2213,20 @@ function validatePlan(plan) {
|
|
|
2170
2213
|
});
|
|
2171
2214
|
continue;
|
|
2172
2215
|
}
|
|
2173
|
-
if (artifact.path === "package.json")
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2216
|
+
if (artifact.path === "package.json") {
|
|
2217
|
+
questions.push({
|
|
2218
|
+
field: "overrides",
|
|
2219
|
+
text: "Override path \"package.json\" targets the blueprint-owned publication boundary",
|
|
2220
|
+
blocking: true
|
|
2221
|
+
});
|
|
2222
|
+
continue;
|
|
2223
|
+
}
|
|
2224
|
+
warnings.push(`Override path "${item.path}" replaces its planned artifact content`);
|
|
2178
2225
|
}
|
|
2179
2226
|
return {
|
|
2180
2227
|
valid: questions.length === 0,
|
|
2181
2228
|
questions,
|
|
2182
|
-
warnings
|
|
2229
|
+
warnings
|
|
2183
2230
|
};
|
|
2184
2231
|
}
|
|
2185
2232
|
/** Determine whether every guide body fits the public UTF-8 artifact byte limit. */
|
|
@@ -5685,30 +5732,69 @@ function rootTsconfig(src, app = []) {
|
|
|
5685
5732
|
});
|
|
5686
5733
|
}
|
|
5687
5734
|
/**
|
|
5735
|
+
* Derive which host-specific machinery a workspace's generated root
|
|
5736
|
+
* `vite.config.ts` carries from its declared environments.
|
|
5737
|
+
*
|
|
5738
|
+
* @remarks
|
|
5739
|
+
* This is the SOLE derivation of that set; `rootViteConfig`,
|
|
5740
|
+
* `singleSrcViteConfig`, `applicationViteConfig`, and `configArtifacts` all
|
|
5741
|
+
* read it rather than recomputing an axis of their own. Nothing here selects
|
|
5742
|
+
* a boundary GUARANTEE — the environment-boundary plugin, its module-graph
|
|
5743
|
+
* AST audit, and stylesheet rejection ship in every shape.
|
|
5744
|
+
*
|
|
5745
|
+
* @param src - The declared published `Environment[]`.
|
|
5746
|
+
* @param app - The declared application `Environment[]`, defaulting to none.
|
|
5747
|
+
* @param engine - Whether the workspace also builds its own executable.
|
|
5748
|
+
* @returns The machinery set the generated header renders.
|
|
5749
|
+
*
|
|
5750
|
+
* @example
|
|
5751
|
+
* ```ts
|
|
5752
|
+
* viteMachinery(['core']) // { browser: false, vue: false, output: true }
|
|
5753
|
+
* viteMachinery([], ['core']) // { browser: false, vue: false, output: false }
|
|
5754
|
+
* ```
|
|
5755
|
+
*/
|
|
5756
|
+
function viteMachinery(src, app = [], engine = false) {
|
|
5757
|
+
const unbuilt = src.length === 0 && app.length > 0 && !engine && app.every((environment) => environment === "core");
|
|
5758
|
+
return {
|
|
5759
|
+
browser: src.includes("browser") || app.includes("browser"),
|
|
5760
|
+
vue: app.includes("browser"),
|
|
5761
|
+
output: !unbuilt
|
|
5762
|
+
};
|
|
5763
|
+
}
|
|
5764
|
+
/**
|
|
5688
5765
|
* The rendered import / `resolve` header block every `rootViteConfig` shape
|
|
5689
|
-
* prefixes — the
|
|
5690
|
-
* `
|
|
5691
|
-
*
|
|
5692
|
-
*
|
|
5693
|
-
* `core
|
|
5694
|
-
*
|
|
5695
|
-
*
|
|
5696
|
-
* @param
|
|
5766
|
+
* prefixes — the environment boundary and every guarantee it enforces ship
|
|
5767
|
+
* unconditionally; `machinery` selects only the host-specific pipelines layered
|
|
5768
|
+
* over them, per the three grounded `rootViteConfig` shapes: browser machinery
|
|
5769
|
+
* unconditional for a multi-environment blueprint carrying `browser`,
|
|
5770
|
+
* conditional on the sole environment being `'browser'` for a single non-`core`
|
|
5771
|
+
* environment, absent for `core`-only.
|
|
5772
|
+
*
|
|
5773
|
+
* @param machinery - The host-specific machinery this shape carries, from `viteMachinery`.
|
|
5697
5774
|
* @returns The rendered header block, newline-terminated.
|
|
5698
5775
|
*
|
|
5699
5776
|
* @example
|
|
5700
5777
|
* ```ts
|
|
5701
|
-
* viteHeader(
|
|
5702
|
-
* viteHeader(
|
|
5778
|
+
* viteHeader(viteMachinery(['core'])).includes('@vitest/browser-playwright') // false
|
|
5779
|
+
* viteHeader(viteMachinery(['core', 'browser'])).includes('@vitest/browser-playwright') // true
|
|
5703
5780
|
* ```
|
|
5704
5781
|
*/
|
|
5705
|
-
function viteHeader(
|
|
5706
|
-
const
|
|
5782
|
+
function viteHeader(machinery) {
|
|
5783
|
+
const { browser: needsBrowser, vue: needsVue, output: needsOutput } = machinery;
|
|
5784
|
+
const playwrightImports = needsBrowser ? `import { playwright } from '@vitest/browser-playwright'
|
|
5707
5785
|
import { chromium } from 'playwright'
|
|
5708
5786
|
` : "";
|
|
5709
5787
|
const vueImports = needsVue ? `import vue from '@vitejs/plugin-vue'
|
|
5710
5788
|
import { parse as parseVue } from 'vue/compiler-sfc'
|
|
5711
5789
|
` : "";
|
|
5790
|
+
const viteTypeImports = needsVue ? `import type {
|
|
5791
|
+
CSSOptions,
|
|
5792
|
+
HtmlAssetSource,
|
|
5793
|
+
HTMLOptions,
|
|
5794
|
+
Plugin,
|
|
5795
|
+
ResolvedConfig,
|
|
5796
|
+
UserConfig,
|
|
5797
|
+
} from 'vite'` : needsBrowser ? `import type { CSSOptions, Plugin, ResolvedConfig, UserConfig } from 'vite'` : `import type { Plugin, UserConfig } from 'vite'`;
|
|
5712
5798
|
const vueBoundary = needsVue ? `,
|
|
5713
5799
|
transform: {
|
|
5714
5800
|
order: 'pre',
|
|
@@ -5868,11 +5954,10 @@ import { parse as parseVue } from 'vue/compiler-sfc'
|
|
|
5868
5954
|
}
|
|
5869
5955
|
return restored === code ? null : restored
|
|
5870
5956
|
},
|
|
5871
|
-
}` : `,
|
|
5957
|
+
}` : needsBrowser ? `,
|
|
5872
5958
|
transform: {
|
|
5873
5959
|
order: 'pre',
|
|
5874
5960
|
async handler(code, id) {
|
|
5875
|
-
const restored = /[?&]html-proxy(?:[=&]|$)/.test(id) ? restoreIgnoredHtml(code) : code
|
|
5876
5961
|
const target = workspacePath(id)
|
|
5877
5962
|
const physicalImporter = physicalPath(id)
|
|
5878
5963
|
const importerPackageRoot = trustedPackageRootFor(physicalImporter, trustedPackageRoots)
|
|
@@ -5886,15 +5971,13 @@ import { parse as parseVue } from 'vue/compiler-sfc'
|
|
|
5886
5971
|
}
|
|
5887
5972
|
const environmentModule =
|
|
5888
5973
|
target !== undefined && /^(?:app|src)\\/(?:core|browser|server)\\//.test(target)
|
|
5889
|
-
if (!environmentModule && importerPackageRoot === undefined)
|
|
5890
|
-
return restored === code ? null : restored
|
|
5891
|
-
}
|
|
5974
|
+
if (!environmentModule && importerPackageRoot === undefined) return null
|
|
5892
5975
|
if (isCSSRequest(id)) {
|
|
5893
5976
|
const config = resolvedConfig
|
|
5894
5977
|
if (config === undefined) {
|
|
5895
5978
|
this.error('Environment boundary requires resolved Vite configuration')
|
|
5896
5979
|
}
|
|
5897
|
-
const stylesheet = await preprocessCSS(
|
|
5980
|
+
const stylesheet = await preprocessCSS(code, id, config)
|
|
5898
5981
|
for (const dependency of stylesheet.deps ?? []) {
|
|
5899
5982
|
const physicalDependency = physicalPath(dependency)
|
|
5900
5983
|
const dependencyTarget = workspacePath(physicalDependency)
|
|
@@ -5908,7 +5991,7 @@ import { parse as parseVue } from 'vue/compiler-sfc'
|
|
|
5908
5991
|
if (dependencyError !== undefined) this.error(dependencyError)
|
|
5909
5992
|
}
|
|
5910
5993
|
}
|
|
5911
|
-
for (const source of await environmentAssetSources(
|
|
5994
|
+
for (const source of await environmentAssetSources(code, id)) {
|
|
5912
5995
|
const normalizedSource = source.replaceAll('\\\\', '/')
|
|
5913
5996
|
const sourceError = environmentSourceError(owner, normalizedSource)
|
|
5914
5997
|
if (sourceError !== undefined) this.error(sourceError)
|
|
@@ -5951,12 +6034,74 @@ import { parse as parseVue } from 'vue/compiler-sfc'
|
|
|
5951
6034
|
const assetError = environmentPathError(owner, resolvedSource)
|
|
5952
6035
|
if (assetError !== undefined) this.error(assetError)
|
|
5953
6036
|
}
|
|
5954
|
-
return
|
|
6037
|
+
return null
|
|
6038
|
+
},
|
|
6039
|
+
}` : `,
|
|
6040
|
+
transform: {
|
|
6041
|
+
order: 'pre',
|
|
6042
|
+
async handler(code, id) {
|
|
6043
|
+
const target = workspacePath(id)
|
|
6044
|
+
const physicalImporter = physicalPath(id)
|
|
6045
|
+
const importerPackageRoot = trustedPackageRootFor(physicalImporter, trustedPackageRoots)
|
|
6046
|
+
if (target === undefined) {
|
|
6047
|
+
if (isOutsideWorkspacePath(id) && importerPackageRoot === undefined) {
|
|
6048
|
+
this.error('Environment modules cannot import files outside the workspace')
|
|
6049
|
+
}
|
|
6050
|
+
} else {
|
|
6051
|
+
const pathError = environmentPathError(owner, target)
|
|
6052
|
+
if (pathError !== undefined) this.error(pathError)
|
|
6053
|
+
}
|
|
6054
|
+
const environmentModule =
|
|
6055
|
+
target !== undefined && /^(?:app|src)\\/(?:core|browser|server)\\//.test(target)
|
|
6056
|
+
if (!environmentModule && importerPackageRoot === undefined) return null
|
|
6057
|
+
for (const source of await environmentAssetSources(code, id)) {
|
|
6058
|
+
const normalizedSource = source.replaceAll('\\\\', '/')
|
|
6059
|
+
const sourceError = environmentSourceError(owner, normalizedSource)
|
|
6060
|
+
if (sourceError !== undefined) this.error(sourceError)
|
|
6061
|
+
const [sourcePath] = normalizedSource.split(/[?#]/)
|
|
6062
|
+
if (sourcePath !== undefined && isBuiltin(sourcePath)) continue
|
|
6063
|
+
const resolution = await this.resolve(normalizedSource, id, { skipSelf: true })
|
|
6064
|
+
const fallbackSource = sourceFallback(physicalImporter, normalizedSource)
|
|
6065
|
+
const physicalSource = physicalPath(resolution?.id ?? fallbackSource)
|
|
6066
|
+
if (importerPackageRoot !== undefined) {
|
|
6067
|
+
const pathLike =
|
|
6068
|
+
normalizedSource.startsWith('.') ||
|
|
6069
|
+
normalizedSource.startsWith('/') ||
|
|
6070
|
+
/^file:/i.test(normalizedSource) ||
|
|
6071
|
+
/^[A-Za-z]:[\\\\/]/.test(normalizedSource)
|
|
6072
|
+
if (pathLike && !containedPath(importerPackageRoot, physicalSource)) {
|
|
6073
|
+
this.error(
|
|
6074
|
+
'Dependency modules cannot import files outside their physical package root',
|
|
6075
|
+
)
|
|
6076
|
+
}
|
|
6077
|
+
if (!pathLike && !containedPath(importerPackageRoot, physicalSource)) {
|
|
6078
|
+
const packageName = packageNameOf(normalizedSource)
|
|
6079
|
+
const packageRoot = normalizedSource.startsWith('#')
|
|
6080
|
+
? workspacePath(physicalSource) === undefined
|
|
6081
|
+
? packageRootForResolved(physicalSource)
|
|
6082
|
+
: undefined
|
|
6083
|
+
: packageName === undefined
|
|
6084
|
+
? undefined
|
|
6085
|
+
: packageRootOf(packageName, physicalSource)
|
|
6086
|
+
if (packageRoot === undefined || !containedPath(packageRoot, physicalSource)) {
|
|
6087
|
+
this.error('Resolved dependencies must remain inside their physical package root')
|
|
6088
|
+
}
|
|
6089
|
+
trustedPackageRoots.add(packageRoot)
|
|
6090
|
+
}
|
|
6091
|
+
continue
|
|
6092
|
+
}
|
|
6093
|
+
const resolvedSource = workspacePath(physicalSource)
|
|
6094
|
+
if (resolvedSource === undefined) {
|
|
6095
|
+
this.error('Environment modules cannot import files outside the workspace')
|
|
6096
|
+
}
|
|
6097
|
+
const assetError = environmentPathError(owner, resolvedSource)
|
|
6098
|
+
if (assetError !== undefined) this.error(assetError)
|
|
6099
|
+
}
|
|
6100
|
+
return null
|
|
5955
6101
|
},
|
|
5956
6102
|
}`;
|
|
5957
6103
|
const environmentBoundary = `
|
|
5958
|
-
${CONST_KEYWORD} WORKSPACE_ROOT = realpathSync.native(dirname(fileURLToPath(import.meta.url)))
|
|
5959
|
-
${EXPORT_KEYWORD} ${CONST_KEYWORD} IMPORT_META_ENV_PREFIX = 'import.meta.env.'
|
|
6104
|
+
${CONST_KEYWORD} WORKSPACE_ROOT = realpathSync.native(dirname(fileURLToPath(import.meta.url)))${needsVue ? `\n${EXPORT_KEYWORD} ${CONST_KEYWORD} IMPORT_META_ENV_PREFIX = 'import.meta.env.'` : ""}
|
|
5960
6105
|
|
|
5961
6106
|
${EXPORT_KEYWORD} function physicalPath(path: string): string {
|
|
5962
6107
|
const [pathWithoutQuery] = path.split('?')
|
|
@@ -6001,9 +6146,9 @@ ${EXPORT_KEYWORD} function containedPath(root: string, target: string): boolean
|
|
|
6001
6146
|
relativePath === '' ||
|
|
6002
6147
|
(relativePath !== '..' && !relativePath.startsWith(\`..\${sep}\`) && !isAbsolute(relativePath))
|
|
6003
6148
|
)
|
|
6004
|
-
}
|
|
6149
|
+
}${needsVue ? `
|
|
6005
6150
|
|
|
6006
|
-
${
|
|
6151
|
+
${EXPORT_KEYWORD} function browserServerRoots(): readonly string[] {
|
|
6007
6152
|
const roots: string[] = []
|
|
6008
6153
|
for (const path of [
|
|
6009
6154
|
'app/browser',
|
|
@@ -6285,7 +6430,7 @@ ${EXPORT_KEYWORD} function environmentSourceError(owner: string, source: string)
|
|
|
6285
6430
|
return undefined
|
|
6286
6431
|
}
|
|
6287
6432
|
|
|
6288
|
-
${EXPORT_KEYWORD} function stylesheetAssetError(
|
|
6433
|
+
${needsBrowser ? `${EXPORT_KEYWORD} function stylesheetAssetError(
|
|
6289
6434
|
source: string | undefined,
|
|
6290
6435
|
value: string,
|
|
6291
6436
|
): string | undefined {
|
|
@@ -6332,7 +6477,7 @@ ${EXPORT_KEYWORD} function stylesheetAssetError(
|
|
|
6332
6477
|
return undefined
|
|
6333
6478
|
}
|
|
6334
6479
|
|
|
6335
|
-
${EXPORT_KEYWORD} function enforceOutputPath(configured: string, expected: string): void {
|
|
6480
|
+
` : ""}${needsOutput ? `${EXPORT_KEYWORD} function enforceOutputPath(configured: string, expected: string): void {
|
|
6336
6481
|
if (relative(expected, configured) !== '') {
|
|
6337
6482
|
throw new Error(
|
|
6338
6483
|
'[orkestrel-output-boundary] Build output must use its exact configured workspace directory',
|
|
@@ -6399,7 +6544,7 @@ ${EXPORT_KEYWORD} function outputBoundary(output: string): Plugin {
|
|
|
6399
6544
|
}
|
|
6400
6545
|
}
|
|
6401
6546
|
|
|
6402
|
-
${EXPORT_KEYWORD} function decodeAssetSource(source: string): string | undefined {
|
|
6547
|
+
` : ""}${EXPORT_KEYWORD} function decodeAssetSource(source: string): string | undefined {
|
|
6403
6548
|
try {
|
|
6404
6549
|
return decodeURI(source)
|
|
6405
6550
|
} catch {
|
|
@@ -6407,7 +6552,7 @@ ${EXPORT_KEYWORD} function decodeAssetSource(source: string): string | undefined
|
|
|
6407
6552
|
}
|
|
6408
6553
|
}
|
|
6409
6554
|
|
|
6410
|
-
${EXPORT_KEYWORD} function filterHtmlAssetSource(
|
|
6555
|
+
${needsVue ? `${EXPORT_KEYWORD} function filterHtmlAssetSource(
|
|
6411
6556
|
data: Parameters<NonNullable<HtmlAssetSource['filter']>>[0],
|
|
6412
6557
|
): boolean {
|
|
6413
6558
|
const decoded = decodeAssetSource(data.value)
|
|
@@ -6552,7 +6697,7 @@ ${EXPORT_KEYWORD} function maskIgnoredHtml(environmentKeys: ReadonlySet<string>,
|
|
|
6552
6697
|
)
|
|
6553
6698
|
}
|
|
6554
6699
|
|
|
6555
|
-
${EXPORT_KEYWORD} function restoreIgnoredHtml(code: string): string {
|
|
6700
|
+
` : ""}${needsVue ? `${EXPORT_KEYWORD} function restoreIgnoredHtml(code: string): string {
|
|
6556
6701
|
const literals = code.replace(
|
|
6557
6702
|
/(?<prefix>[vV][iI][tT][eE])-(?<suffix>[iI][gG][nN][oO][rR][eE])/gu,
|
|
6558
6703
|
'$<prefix>-$<suffix>',
|
|
@@ -6608,7 +6753,7 @@ ${EXPORT_KEYWORD} function finalizeHtml(): Plugin {
|
|
|
6608
6753
|
}
|
|
6609
6754
|
}
|
|
6610
6755
|
|
|
6611
|
-
${EXPORT_KEYWORD} async function environmentAssetSources(
|
|
6756
|
+
` : ""}${EXPORT_KEYWORD} async function environmentAssetSources(
|
|
6612
6757
|
code: string,
|
|
6613
6758
|
id: string,
|
|
6614
6759
|
emitted = false,
|
|
@@ -6693,23 +6838,19 @@ ${EXPORT_KEYWORD} async function environmentAssetSources(
|
|
|
6693
6838
|
}
|
|
6694
6839
|
},
|
|
6695
6840
|
})
|
|
6696
|
-
visitor.visit(
|
|
6841
|
+
visitor.visit(parseSync(path, transformed.code).program)
|
|
6697
6842
|
return sources
|
|
6698
6843
|
}
|
|
6699
6844
|
|
|
6700
6845
|
${EXPORT_KEYWORD} function environmentBoundary(
|
|
6701
6846
|
owner: 'src/core' | 'src/browser' | 'src/server' | 'app/core' | 'app/browser' | 'app/server',
|
|
6702
6847
|
): Plugin {
|
|
6703
|
-
const trustedPackageRoots = new Set<string>()
|
|
6704
|
-
let environmentRoot = WORKSPACE_ROOT
|
|
6705
|
-
let resolvedConfig: ResolvedConfig | undefined
|
|
6848
|
+
const trustedPackageRoots = new Set<string>()${needsOutput ? "\n let environmentRoot = WORKSPACE_ROOT" : ""}${needsBrowser ? "\n let resolvedConfig: ResolvedConfig | undefined" : ""}
|
|
6706
6849
|
return {
|
|
6707
6850
|
name: 'orkestrel-environment-boundary',
|
|
6708
|
-
enforce: 'pre'
|
|
6709
|
-
configResolved(config) {
|
|
6710
|
-
|
|
6711
|
-
resolvedConfig = config
|
|
6712
|
-
},
|
|
6851
|
+
enforce: 'pre',${needsOutput || needsBrowser ? `
|
|
6852
|
+
configResolved(config) {${needsOutput ? "\n environmentRoot = physicalPath(config.root)" : ""}${needsBrowser ? "\n resolvedConfig = config" : ""}
|
|
6853
|
+
},` : ""}
|
|
6713
6854
|
${needsVue ? ` configureServer(server) {
|
|
6714
6855
|
if (owner !== 'app/browser') return
|
|
6715
6856
|
const roots = browserServerRoots()
|
|
@@ -6842,7 +6983,7 @@ ${needsVue ? ` configureServer(server) {
|
|
|
6842
6983
|
}
|
|
6843
6984
|
}
|
|
6844
6985
|
return null
|
|
6845
|
-
}
|
|
6986
|
+
},${needsOutput ? `
|
|
6846
6987
|
async generateBundle(_options, bundle) {
|
|
6847
6988
|
for (const output of Object.values(bundle)) {
|
|
6848
6989
|
if (output.type === 'chunk') {
|
|
@@ -6872,7 +7013,7 @@ ${needsVue ? ` configureServer(server) {
|
|
|
6872
7013
|
if (pathError !== undefined) this.error(pathError)
|
|
6873
7014
|
}
|
|
6874
7015
|
}
|
|
6875
|
-
}
|
|
7016
|
+
},` : ""}
|
|
6876
7017
|
buildEnd(error) {
|
|
6877
7018
|
if (error !== undefined) return
|
|
6878
7019
|
for (const id of this.getModuleIds()) {
|
|
@@ -6893,16 +7034,10 @@ ${needsVue ? ` configureServer(server) {
|
|
|
6893
7034
|
}
|
|
6894
7035
|
}
|
|
6895
7036
|
`;
|
|
6896
|
-
return
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
Plugin,
|
|
6901
|
-
ResolvedConfig,
|
|
6902
|
-
UserConfig,
|
|
6903
|
-
} from 'vite'
|
|
6904
|
-
import { isCSSRequest, parseAst, preprocessCSS, transformWithOxc, Visitor } from 'vite'
|
|
6905
|
-
import { defineConfig, mergeConfig } from 'vitest/config'
|
|
7037
|
+
return `${viteTypeImports}
|
|
7038
|
+
${needsBrowser ? `import { isCSSRequest, parseSync, preprocessCSS, transformWithOxc, Visitor } from 'vite'
|
|
7039
|
+
` : `import { parseSync, transformWithOxc, Visitor } from 'vite'
|
|
7040
|
+
`}import { defineConfig, mergeConfig } from 'vitest/config'
|
|
6906
7041
|
import tsconfig from './tsconfig.json' with { type: 'json' }
|
|
6907
7042
|
import { fileURLToPath, URL } from 'node:url'
|
|
6908
7043
|
import { isBuiltin } from 'node:module'
|
|
@@ -6917,8 +7052,7 @@ import {
|
|
|
6917
7052
|
realpathSync,
|
|
6918
7053
|
} from 'node:fs'
|
|
6919
7054
|
import { dirname, isAbsolute, relative, resolve as resolvePath, sep } from 'node:path'
|
|
6920
|
-
${playwrightImports}${vueImports}
|
|
6921
|
-
${needsPlaywright ? `${CONST_KEYWORD} hasChromium = existsSync(chromium.executablePath())\n` : ""}
|
|
7055
|
+
${playwrightImports}${vueImports}${needsBrowser ? `\n${CONST_KEYWORD} hasChromium = existsSync(chromium.executablePath())\n` : ""}
|
|
6922
7056
|
${EXPORT_KEYWORD} function resolveWorkspacePath(relativePath: string): string {
|
|
6923
7057
|
return fileURLToPath(new URL(relativePath, import.meta.url))
|
|
6924
7058
|
}
|
|
@@ -6939,7 +7073,7 @@ ${CONST_KEYWORD} resolve = {
|
|
|
6939
7073
|
}, {}),
|
|
6940
7074
|
}
|
|
6941
7075
|
|
|
6942
|
-
${EXPORT_KEYWORD} ${CONST_KEYWORD} ENVIRONMENT_CSS = Object.freeze({
|
|
7076
|
+
${needsBrowser ? `${EXPORT_KEYWORD} ${CONST_KEYWORD} ENVIRONMENT_CSS = Object.freeze({
|
|
6943
7077
|
transformer: 'lightningcss',
|
|
6944
7078
|
lightningcss: {
|
|
6945
7079
|
visitor: () => {
|
|
@@ -6970,7 +7104,7 @@ ${EXPORT_KEYWORD} ${CONST_KEYWORD} ENVIRONMENT_CSS = Object.freeze({
|
|
|
6970
7104
|
},
|
|
6971
7105
|
},
|
|
6972
7106
|
} satisfies CSSOptions)
|
|
6973
|
-
${EXPORT_KEYWORD} ${CONST_KEYWORD} PACKAGE_MANIFEST_BYTES = 1_048_576
|
|
7107
|
+
` : ""}${EXPORT_KEYWORD} ${CONST_KEYWORD} PACKAGE_MANIFEST_BYTES = 1_048_576
|
|
6974
7108
|
${EXPORT_KEYWORD} ${CONST_KEYWORD} ENVIRONMENT_MODULE_BYTES = 8_388_608
|
|
6975
7109
|
${environmentBoundary}`;
|
|
6976
7110
|
}
|
|
@@ -7007,18 +7141,17 @@ function policyViteProject() {
|
|
|
7007
7141
|
* ```
|
|
7008
7142
|
*/
|
|
7009
7143
|
function singleSrcViteConfig(environment) {
|
|
7010
|
-
const
|
|
7144
|
+
const machinery = viteMachinery([environment]);
|
|
7145
|
+
const header = viteHeader(machinery);
|
|
7011
7146
|
if (environment === "browser") return `${header}
|
|
7147
|
+
if (!hasChromium) console.warn('browser projects skipped: Chromium absent (${SRC_MATRIX.browser.project})')
|
|
7012
7148
|
${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
|
|
7013
7149
|
mergeConfig(
|
|
7014
7150
|
{
|
|
7015
7151
|
resolve,
|
|
7016
7152
|
css: ENVIRONMENT_CSS,
|
|
7017
7153
|
publicDir: false,
|
|
7018
|
-
plugins: [
|
|
7019
|
-
outputBoundary('dist/src/browser'),
|
|
7020
|
-
environmentBoundary('src/browser'),
|
|
7021
|
-
],
|
|
7154
|
+
plugins: [outputBoundary('dist/src/browser'), environmentBoundary('src/browser')],
|
|
7022
7155
|
build: {
|
|
7023
7156
|
assetsInlineLimit: 0,
|
|
7024
7157
|
emptyOutDir: true,
|
|
@@ -7070,7 +7203,7 @@ ${EXPORT_KEYWORD} const guides = (config?: UserConfig): UserConfig =>
|
|
|
7070
7203
|
export default defineConfig({
|
|
7071
7204
|
resolve,
|
|
7072
7205
|
test: {
|
|
7073
|
-
projects: [srcBrowser, policy, guides],
|
|
7206
|
+
projects: [...(hasChromium ? [srcBrowser] : []), policy, guides],
|
|
7074
7207
|
},
|
|
7075
7208
|
})
|
|
7076
7209
|
`;
|
|
@@ -7078,13 +7211,9 @@ export default defineConfig({
|
|
|
7078
7211
|
${EXPORT_KEYWORD} const srcServer = (config?: UserConfig): UserConfig =>
|
|
7079
7212
|
mergeConfig(
|
|
7080
7213
|
{
|
|
7081
|
-
resolve,
|
|
7082
|
-
css: ENVIRONMENT_CSS,
|
|
7214
|
+
resolve,${machinery.browser ? "\n css: ENVIRONMENT_CSS," : ""}
|
|
7083
7215
|
publicDir: false,
|
|
7084
|
-
plugins: [
|
|
7085
|
-
outputBoundary('dist/src/server'),
|
|
7086
|
-
environmentBoundary('src/server'),
|
|
7087
|
-
],
|
|
7216
|
+
plugins: [outputBoundary('dist/src/server'), environmentBoundary('src/server')],
|
|
7088
7217
|
build: {
|
|
7089
7218
|
emptyOutDir: true,
|
|
7090
7219
|
sourcemap: true,
|
|
@@ -7166,7 +7295,8 @@ export default defineConfig({
|
|
|
7166
7295
|
function rootViteConfig(src, engine = false) {
|
|
7167
7296
|
const hasCore = src.includes("core");
|
|
7168
7297
|
const nonCore = src.filter((environment) => environment !== "core");
|
|
7169
|
-
const
|
|
7298
|
+
const machinery = viteMachinery(src);
|
|
7299
|
+
const header = viteHeader(machinery);
|
|
7170
7300
|
if (!hasCore) {
|
|
7171
7301
|
const [onlyEnvironment] = nonCore;
|
|
7172
7302
|
if (onlyEnvironment === "browser" || onlyEnvironment === "server") return singleSrcViteConfig(onlyEnvironment);
|
|
@@ -7178,10 +7308,7 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
|
|
|
7178
7308
|
{
|
|
7179
7309
|
css: ENVIRONMENT_CSS,
|
|
7180
7310
|
publicDir: false,
|
|
7181
|
-
plugins: [
|
|
7182
|
-
outputBoundary('dist/src/browser'),
|
|
7183
|
-
environmentBoundary('src/browser'),
|
|
7184
|
-
],
|
|
7311
|
+
plugins: [outputBoundary('dist/src/browser'), environmentBoundary('src/browser')],
|
|
7185
7312
|
build: {
|
|
7186
7313
|
assetsInlineLimit: 0,
|
|
7187
7314
|
lib: {
|
|
@@ -7217,13 +7344,9 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
|
|
|
7217
7344
|
${EXPORT_KEYWORD} const srcServer = (config?: UserConfig): UserConfig =>
|
|
7218
7345
|
srcCore(
|
|
7219
7346
|
mergeConfig(
|
|
7220
|
-
{
|
|
7221
|
-
css: ENVIRONMENT_CSS,
|
|
7347
|
+
{${machinery.browser ? "\n css: ENVIRONMENT_CSS," : ""}
|
|
7222
7348
|
publicDir: false,
|
|
7223
|
-
plugins: [
|
|
7224
|
-
outputBoundary('dist/src/server'),
|
|
7225
|
-
environmentBoundary('src/server'),
|
|
7226
|
-
],
|
|
7349
|
+
plugins: [outputBoundary('dist/src/server'), environmentBoundary('src/server')],
|
|
7227
7350
|
build: {
|
|
7228
7351
|
lib: {
|
|
7229
7352
|
entry: resolveWorkspacePath('src/server/index.ts'),
|
|
@@ -7306,14 +7429,18 @@ ${EXPORT_KEYWORD} const integration = (config?: UserConfig): UserConfig =>
|
|
|
7306
7429
|
const blocks = nonCore.map((environment) => environment === "browser" ? browserBlock : serverBlock).join("") + binBlock;
|
|
7307
7430
|
const projectNames = [
|
|
7308
7431
|
...hasCore ? ["srcCore"] : [],
|
|
7309
|
-
...nonCore.map((environment) => `src${pascalCase(environment)}`),
|
|
7432
|
+
...nonCore.map((environment) => environment === "browser" ? "...(hasChromium ? [srcBrowser] : [])" : `src${pascalCase(environment)}`),
|
|
7310
7433
|
"policy",
|
|
7311
7434
|
"guides",
|
|
7312
7435
|
...engine ? ["srcBin"] : [],
|
|
7313
7436
|
...engine ? ["integration"] : []
|
|
7314
7437
|
];
|
|
7438
|
+
const inlineProjects = ` projects: [${projectNames.join(", ")}],`;
|
|
7439
|
+
const renderedProjects = computeColumnWidth(inlineProjects) <= 100 ? inlineProjects : ` projects: [
|
|
7440
|
+
${projectNames.map((project) => ` ${project},`).join("\n")}
|
|
7441
|
+
],`;
|
|
7315
7442
|
return `${header}
|
|
7316
|
-
${EXPORT_KEYWORD} const srcCore = (config?: UserConfig): UserConfig =>
|
|
7443
|
+
${machinery.browser ? `if (!hasChromium) console.warn('browser projects skipped: Chromium absent (${SRC_MATRIX.browser.project})')\n` : ""}${EXPORT_KEYWORD} const srcCore = (config?: UserConfig): UserConfig =>
|
|
7317
7444
|
mergeConfig(
|
|
7318
7445
|
{
|
|
7319
7446
|
resolve,
|
|
@@ -7352,7 +7479,7 @@ ${blocks}
|
|
|
7352
7479
|
export default defineConfig({
|
|
7353
7480
|
resolve,
|
|
7354
7481
|
test: {
|
|
7355
|
-
|
|
7482
|
+
${renderedProjects}
|
|
7356
7483
|
},
|
|
7357
7484
|
})
|
|
7358
7485
|
`;
|
|
@@ -7373,7 +7500,8 @@ export default defineConfig({
|
|
|
7373
7500
|
*/
|
|
7374
7501
|
function applicationViteConfig(src, app, engine = false) {
|
|
7375
7502
|
const hasSourceCore = src.includes("core");
|
|
7376
|
-
const
|
|
7503
|
+
const machinery = viteMachinery(src, app, engine);
|
|
7504
|
+
const header = viteHeader(machinery);
|
|
7377
7505
|
const projects = [];
|
|
7378
7506
|
const blocks = [];
|
|
7379
7507
|
if (src.includes("core")) {
|
|
@@ -7382,8 +7510,7 @@ function applicationViteConfig(src, app, engine = false) {
|
|
|
7382
7510
|
${EXPORT_KEYWORD} const srcCore = (config?: UserConfig): UserConfig =>
|
|
7383
7511
|
mergeConfig(
|
|
7384
7512
|
{
|
|
7385
|
-
resolve,
|
|
7386
|
-
css: ENVIRONMENT_CSS,
|
|
7513
|
+
resolve,${machinery.browser ? "\n css: ENVIRONMENT_CSS," : ""}
|
|
7387
7514
|
publicDir: false,
|
|
7388
7515
|
plugins: [environmentBoundary('src/core')],
|
|
7389
7516
|
build: { emptyOutDir: true, sourcemap: true, minify: false },
|
|
@@ -7400,7 +7527,7 @@ ${EXPORT_KEYWORD} const srcCore = (config?: UserConfig): UserConfig =>
|
|
|
7400
7527
|
`);
|
|
7401
7528
|
}
|
|
7402
7529
|
if (src.includes("browser")) {
|
|
7403
|
-
projects.push("srcBrowser");
|
|
7530
|
+
projects.push("...(hasChromium ? [srcBrowser] : [])");
|
|
7404
7531
|
const coreOutput = hasSourceCore ? `
|
|
7405
7532
|
output: { paths: { '@src/core': '../core/index.js' } },` : "";
|
|
7406
7533
|
const coreExternal = hasSourceCore ? `id === '@src/core' || ` : "";
|
|
@@ -7465,8 +7592,7 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
|
|
|
7465
7592
|
${EXPORT_KEYWORD} const srcServer = (config?: UserConfig): UserConfig =>
|
|
7466
7593
|
mergeConfig(
|
|
7467
7594
|
{
|
|
7468
|
-
resolve,
|
|
7469
|
-
css: ENVIRONMENT_CSS,
|
|
7595
|
+
resolve,${machinery.browser ? "\n css: ENVIRONMENT_CSS," : ""}
|
|
7470
7596
|
publicDir: false,
|
|
7471
7597
|
plugins: [outputBoundary('dist/src/server'), environmentBoundary('src/server')],
|
|
7472
7598
|
build: {
|
|
@@ -7502,8 +7628,7 @@ ${EXPORT_KEYWORD} const srcServer = (config?: UserConfig): UserConfig =>
|
|
|
7502
7628
|
${EXPORT_KEYWORD} const appCore = (config?: UserConfig): UserConfig =>
|
|
7503
7629
|
mergeConfig(
|
|
7504
7630
|
{
|
|
7505
|
-
resolve,
|
|
7506
|
-
css: ENVIRONMENT_CSS,
|
|
7631
|
+
resolve,${machinery.browser ? "\n css: ENVIRONMENT_CSS," : ""}
|
|
7507
7632
|
publicDir: false,
|
|
7508
7633
|
plugins: [environmentBoundary('app/core')],
|
|
7509
7634
|
test: {
|
|
@@ -7519,7 +7644,7 @@ ${EXPORT_KEYWORD} const appCore = (config?: UserConfig): UserConfig =>
|
|
|
7519
7644
|
`);
|
|
7520
7645
|
}
|
|
7521
7646
|
if (app.includes("browser")) {
|
|
7522
|
-
projects.push("appBrowser()");
|
|
7647
|
+
projects.push("...(hasChromium ? [appBrowser()] : [])");
|
|
7523
7648
|
blocks.push(`
|
|
7524
7649
|
${EXPORT_KEYWORD} function appBrowser(...config: readonly never[]): UserConfig {
|
|
7525
7650
|
if (config.length > 0) {
|
|
@@ -7580,8 +7705,7 @@ ${EXPORT_KEYWORD} function appBrowser(...config: readonly never[]): UserConfig {
|
|
|
7580
7705
|
${EXPORT_KEYWORD} const appServer = (config?: UserConfig): UserConfig =>
|
|
7581
7706
|
mergeConfig(
|
|
7582
7707
|
{
|
|
7583
|
-
resolve,
|
|
7584
|
-
css: ENVIRONMENT_CSS,
|
|
7708
|
+
resolve,${machinery.browser ? "\n css: ENVIRONMENT_CSS," : ""}
|
|
7585
7709
|
publicDir: false,
|
|
7586
7710
|
plugins: [outputBoundary('dist/app/server'), environmentBoundary('app/server')],
|
|
7587
7711
|
build: {
|
|
@@ -7654,8 +7778,22 @@ ${EXPORT_KEYWORD} const integration = (config?: UserConfig): UserConfig =>
|
|
|
7654
7778
|
)
|
|
7655
7779
|
`);
|
|
7656
7780
|
}
|
|
7781
|
+
const projectNames = [
|
|
7782
|
+
...projects,
|
|
7783
|
+
"policy",
|
|
7784
|
+
"guides"
|
|
7785
|
+
];
|
|
7786
|
+
const inlineProjects = ` projects: [${projectNames.join(", ")}],`;
|
|
7787
|
+
const renderedProjects = computeColumnWidth(inlineProjects) <= 100 ? inlineProjects : ` projects: [
|
|
7788
|
+
${projectNames.map((project) => ` ${project},`).join("\n")}
|
|
7789
|
+
],`;
|
|
7790
|
+
const browserProjects = [...src.includes("browser") ? [SRC_MATRIX.browser.project] : [], ...app.includes("browser") ? [APP_MATRIX.browser.project] : []];
|
|
7791
|
+
const browserNotice = serializeTypeScriptString(`browser projects skipped: Chromium absent (${browserProjects.join(", ")})`);
|
|
7792
|
+
const inlineBrowserNotice = `if (!hasChromium) console.warn(${browserNotice})`;
|
|
7793
|
+
const renderedBrowserNotice = browserProjects.length === 0 ? void 0 : computeColumnWidth(inlineBrowserNotice) <= 100 ? inlineBrowserNotice : `if (!hasChromium)
|
|
7794
|
+
console.warn(${browserNotice})`;
|
|
7657
7795
|
return `${header}
|
|
7658
|
-
${policyViteProject()}
|
|
7796
|
+
${renderedBrowserNotice === void 0 ? "" : `${renderedBrowserNotice}\n`}${policyViteProject()}
|
|
7659
7797
|
${EXPORT_KEYWORD} const guides = (config?: UserConfig): UserConfig =>
|
|
7660
7798
|
mergeConfig(
|
|
7661
7799
|
{
|
|
@@ -7675,17 +7813,13 @@ ${blocks.join("")}
|
|
|
7675
7813
|
export default defineConfig({
|
|
7676
7814
|
resolve,
|
|
7677
7815
|
test: {
|
|
7678
|
-
|
|
7679
|
-
...projects,
|
|
7680
|
-
"policy",
|
|
7681
|
-
"guides"
|
|
7682
|
-
].join(", ")}],
|
|
7816
|
+
${renderedProjects}
|
|
7683
7817
|
},
|
|
7684
7818
|
})
|
|
7685
7819
|
`;
|
|
7686
7820
|
}
|
|
7687
7821
|
/**
|
|
7688
|
-
* `configs/src/tsconfig.core.json` —
|
|
7822
|
+
* `configs/src/tsconfig.core.json` — host-neutral core with web interop declarations.
|
|
7689
7823
|
*
|
|
7690
7824
|
* @returns The core environment `tsconfig` file content, newline-terminated.
|
|
7691
7825
|
*
|
|
@@ -7698,7 +7832,7 @@ function coreTsconfig() {
|
|
|
7698
7832
|
return formatJson({
|
|
7699
7833
|
extends: "../../tsconfig.json",
|
|
7700
7834
|
compilerOptions: {
|
|
7701
|
-
lib: ["ESNext"],
|
|
7835
|
+
lib: ["ESNext", "WebWorker"],
|
|
7702
7836
|
types: [],
|
|
7703
7837
|
noEmit: false,
|
|
7704
7838
|
declaration: true,
|
|
@@ -7713,6 +7847,7 @@ function coreTsconfig() {
|
|
|
7713
7847
|
* `configs/src/vite.core.config.ts` — inlines its own `build.lib` /
|
|
7714
7848
|
* `rolldownOptions` (core's `srcCore` root export carries no build.lib).
|
|
7715
7849
|
*
|
|
7850
|
+
* @param browser - Whether a declared browser environment enables the shared CSS pipeline.
|
|
7716
7851
|
* @returns The core environment `vite.config.ts` file content, newline-terminated.
|
|
7717
7852
|
*
|
|
7718
7853
|
* @example
|
|
@@ -7720,12 +7855,11 @@ function coreTsconfig() {
|
|
|
7720
7855
|
* coreViteConfig().includes('srcCore(') // true
|
|
7721
7856
|
* ```
|
|
7722
7857
|
*/
|
|
7723
|
-
function coreViteConfig() {
|
|
7858
|
+
function coreViteConfig(browser = true) {
|
|
7724
7859
|
return `import { defineConfig } from 'vite'
|
|
7725
7860
|
import dts from 'vite-plugin-dts'
|
|
7726
7861
|
import {
|
|
7727
|
-
ENVIRONMENT_CSS,
|
|
7728
|
-
environmentBoundary,
|
|
7862
|
+
${browser ? " ENVIRONMENT_CSS,\n" : ""} environmentBoundary,
|
|
7729
7863
|
outputBoundary,
|
|
7730
7864
|
srcCore,
|
|
7731
7865
|
resolveWorkspacePath,
|
|
@@ -7733,8 +7867,7 @@ import {
|
|
|
7733
7867
|
|
|
7734
7868
|
export default defineConfig(
|
|
7735
7869
|
srcCore({
|
|
7736
|
-
css: ENVIRONMENT_CSS,
|
|
7737
|
-
publicDir: false,
|
|
7870
|
+
${browser ? " css: ENVIRONMENT_CSS,\n" : ""} publicDir: false,
|
|
7738
7871
|
plugins: [
|
|
7739
7872
|
outputBoundary('dist/src/core'),
|
|
7740
7873
|
environmentBoundary('src/core'),
|
|
@@ -7854,7 +7987,7 @@ function appTsconfig(environment, hasCore) {
|
|
|
7854
7987
|
"ESNext",
|
|
7855
7988
|
"DOM",
|
|
7856
7989
|
"DOM.Iterable"
|
|
7857
|
-
] : ["ESNext"],
|
|
7990
|
+
] : environment === "core" ? ["ESNext", "WebWorker"] : ["ESNext"],
|
|
7858
7991
|
types: environment === "browser" ? ["vite/client", "vue"] : environment === "server" ? ["node"] : []
|
|
7859
7992
|
},
|
|
7860
7993
|
include
|
|
@@ -7956,6 +8089,7 @@ ${spec.engine || spec.src.includes("browser") || spec.app.includes("browser") ?
|
|
|
7956
8089
|
* ```
|
|
7957
8090
|
*/
|
|
7958
8091
|
function configArtifacts(spec) {
|
|
8092
|
+
const machinery = viteMachinery(spec.src, spec.app, spec.engine);
|
|
7959
8093
|
const artifacts = [{
|
|
7960
8094
|
path: "tsconfig.json",
|
|
7961
8095
|
group: "configs",
|
|
@@ -7971,7 +8105,7 @@ function configArtifacts(spec) {
|
|
|
7971
8105
|
const row = SRC_MATRIX[environment];
|
|
7972
8106
|
for (const path of row.configs) {
|
|
7973
8107
|
const isTsconfig = path.endsWith(".json");
|
|
7974
|
-
const content = environment === "core" ? isTsconfig ? coreTsconfig() : coreViteConfig() : isTsconfig ? srcTsconfig(environment) : srcViteConfig(environment);
|
|
8108
|
+
const content = environment === "core" ? isTsconfig ? coreTsconfig() : coreViteConfig(machinery.browser) : isTsconfig ? srcTsconfig(environment) : srcViteConfig(environment);
|
|
7975
8109
|
artifacts.push({
|
|
7976
8110
|
path,
|
|
7977
8111
|
group: "configs",
|
|
@@ -8455,12 +8589,15 @@ function guideTests(spec, pascal) {
|
|
|
8455
8589
|
}
|
|
8456
8590
|
/**
|
|
8457
8591
|
* Draft the `guides` group's artifacts — the package's own filled guide stub,
|
|
8458
|
-
* the guides index, and
|
|
8592
|
+
* the guides index, and vendored dependency guide mirrors whose paths are
|
|
8593
|
+
* neither the package's own guide nor already carried by the selected host
|
|
8594
|
+
* set.
|
|
8459
8595
|
*
|
|
8460
8596
|
* @param spec - The `Blueprint` to derive guide artifacts from.
|
|
8461
8597
|
* @param pascal - The package's PascalCase entity name.
|
|
8462
8598
|
* @param members - The blueprint's derived `Member[]`.
|
|
8463
|
-
* @returns The `guides` group's `Artifact[]
|
|
8599
|
+
* @returns The `guides` group's `Artifact[]`, with one contributor per guide
|
|
8600
|
+
* path.
|
|
8464
8601
|
*
|
|
8465
8602
|
* @example
|
|
8466
8603
|
* ```ts
|
|
@@ -8513,14 +8650,16 @@ function guideArtifacts(spec, pascal, members) {
|
|
|
8513
8650
|
]]),
|
|
8514
8651
|
directory: alignTable(["Directory", "Guide"], sourceDirectories.map((directory) => [directory, `[\`${spec.name}.md\`](src/${spec.name}.md)`]))
|
|
8515
8652
|
})];
|
|
8653
|
+
const guidePath = `guides/src/${spec.name}.md`;
|
|
8516
8654
|
for (const dep of spec.dependencies) {
|
|
8517
8655
|
if (!vendoredGuides.includes(dep.name)) continue;
|
|
8518
|
-
const
|
|
8656
|
+
const path = `guides/src/${dep.name.replace("@orkestrel/", "")}.md`;
|
|
8657
|
+
if (HOST_PATHS.includes(path) || path === guidePath) continue;
|
|
8519
8658
|
artifacts.push({
|
|
8520
|
-
path
|
|
8659
|
+
path,
|
|
8521
8660
|
group: "guides",
|
|
8522
8661
|
origin: "host",
|
|
8523
|
-
source:
|
|
8662
|
+
source: path
|
|
8524
8663
|
});
|
|
8525
8664
|
}
|
|
8526
8665
|
return artifacts;
|
|
@@ -8556,7 +8695,7 @@ function applyOverrides(artifacts, overrides) {
|
|
|
8556
8695
|
/**
|
|
8557
8696
|
* The full pure compilation: draft a blueprint's artifacts — the manifest and
|
|
8558
8697
|
* exports combination rules over the per-environment `SRC_MATRIX` rows, plus
|
|
8559
|
-
* `HOST_PATHS` and `overrides` — then pin.
|
|
8698
|
+
* the `selectHostPaths` selection of `HOST_PATHS` and `overrides` — then pin.
|
|
8560
8699
|
*
|
|
8561
8700
|
* @param blueprint - The `Blueprint` to compile.
|
|
8562
8701
|
* @param groups - An optional `Group[]` selection (default: all groups).
|
|
@@ -8600,7 +8739,7 @@ npm install @orkestrel/${blueprint.name}
|
|
|
8600
8739
|
origin: "computed",
|
|
8601
8740
|
content: ciWorkflow(blueprint)
|
|
8602
8741
|
});
|
|
8603
|
-
for (const path of HOST_PATHS) {
|
|
8742
|
+
for (const path of selectHostPaths(HOST_PATHS, blueprint.name)) {
|
|
8604
8743
|
const group = hostGroup(path);
|
|
8605
8744
|
if (!selected.includes(group)) continue;
|
|
8606
8745
|
artifacts.push({
|
|
@@ -8723,7 +8862,10 @@ var Compiler = class Compiler {
|
|
|
8723
8862
|
this.#emitter.emit("audit", result);
|
|
8724
8863
|
return result;
|
|
8725
8864
|
}
|
|
8726
|
-
const result =
|
|
8865
|
+
const result = {
|
|
8866
|
+
...diffPlan(scaffolding.plan, current),
|
|
8867
|
+
questions: scaffolding.questions
|
|
8868
|
+
};
|
|
8727
8869
|
this.#emitter.emit("audit", result);
|
|
8728
8870
|
return result;
|
|
8729
8871
|
}
|
|
@@ -8787,7 +8929,16 @@ var Compiler = class Compiler {
|
|
|
8787
8929
|
const validation = validatePlan(draft);
|
|
8788
8930
|
const dependencyQuestions = this.#dependencyQuestions(blueprint);
|
|
8789
8931
|
const blocking = [...validation.questions];
|
|
8790
|
-
const
|
|
8932
|
+
const warningQuestions = validation.warnings.map((text) => ({
|
|
8933
|
+
field: "overrides",
|
|
8934
|
+
text,
|
|
8935
|
+
blocking: false
|
|
8936
|
+
}));
|
|
8937
|
+
const questions = [
|
|
8938
|
+
...blocking,
|
|
8939
|
+
...warningQuestions,
|
|
8940
|
+
...dependencyQuestions
|
|
8941
|
+
];
|
|
8791
8942
|
stages.push({
|
|
8792
8943
|
stage: "gate",
|
|
8793
8944
|
input: draft,
|
|
@@ -8880,9 +9031,11 @@ var Compiler = class Compiler {
|
|
|
8880
9031
|
}
|
|
8881
9032
|
#pointerArtifacts(blueprint) {
|
|
8882
9033
|
const artifacts = [];
|
|
9034
|
+
const guidePath = `guides/src/${blueprint.name}.md`;
|
|
8883
9035
|
for (const item of blueprint.dependencies) {
|
|
8884
9036
|
if (Compiler.#vendored.includes(item.name)) continue;
|
|
8885
9037
|
const path = `guides/src/${item.name.replace("@orkestrel/", "")}.md`;
|
|
9038
|
+
if (path === guidePath || HOST_PATHS.includes(path)) continue;
|
|
8886
9039
|
artifacts.push({
|
|
8887
9040
|
path,
|
|
8888
9041
|
group: "guides",
|
|
@@ -9235,6 +9388,7 @@ exports.isScaffoldError = isScaffoldError;
|
|
|
9235
9388
|
exports.isSyncReport = isSyncReport;
|
|
9236
9389
|
exports.isWorkspaceName = isWorkspaceName;
|
|
9237
9390
|
exports.manifestToDependencies = manifestToDependencies;
|
|
9391
|
+
exports.manifestToName = manifestToName;
|
|
9238
9392
|
exports.member = member;
|
|
9239
9393
|
exports.memberShape = memberShape;
|
|
9240
9394
|
exports.override = override;
|
|
@@ -9263,6 +9417,7 @@ exports.renderObject = renderObject;
|
|
|
9263
9417
|
exports.renderValue = renderValue;
|
|
9264
9418
|
exports.rootTsconfig = rootTsconfig;
|
|
9265
9419
|
exports.rootViteConfig = rootViteConfig;
|
|
9420
|
+
exports.selectHostPaths = selectHostPaths;
|
|
9266
9421
|
exports.serializeTypeScriptString = serializeTypeScriptString;
|
|
9267
9422
|
exports.singleSrcViteConfig = singleSrcViteConfig;
|
|
9268
9423
|
exports.snapshotOf = snapshotOf;
|
|
@@ -9280,5 +9435,6 @@ exports.validateBlueprint = validateBlueprint;
|
|
|
9280
9435
|
exports.validateDependencyArray = validateDependencyArray;
|
|
9281
9436
|
exports.validatePlan = validatePlan;
|
|
9282
9437
|
exports.viteHeader = viteHeader;
|
|
9438
|
+
exports.viteMachinery = viteMachinery;
|
|
9283
9439
|
|
|
9284
9440
|
//# sourceMappingURL=index.cjs.map
|