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