@orkestrel/scaffold 0.0.14 → 0.0.16
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 +6 -3
- package/dist/bin/scaffold.js.map +1 -1
- package/dist/host/guides/src/scaffold.md +51 -29
- package/dist/src/core/index.cjs +53 -56
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +10 -8
- package/dist/src/core/index.d.ts +10 -8
- package/dist/src/core/index.js +53 -56
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +70 -17
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +21 -0
- package/dist/src/server/index.d.ts +21 -0
- package/dist/src/server/index.js +71 -19
- package/dist/src/server/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -187,10 +187,12 @@ environment contributes, its test-project label, and — on the `src` axis — i
|
|
|
187
187
|
and build formats, or — on the `app` axis — its optional runtime entry.
|
|
188
188
|
|
|
189
189
|
`ViteMachinery` names the three host-specific pipelines a workspace's generated `vite.config.ts` may
|
|
190
|
-
carry: `browser`
|
|
190
|
+
carry: `browser` selects the shared root CSS-analysis and Playwright machinery, `vue` selects the
|
|
191
191
|
single-file-component, HTML, and development-server machinery an application browser environment
|
|
192
|
-
needs, and `output`
|
|
193
|
-
|
|
192
|
+
needs, and `output` selects build-output containment. The root machinery selection never attaches a
|
|
193
|
+
`css` property to a nonbrowser project: only the `srcBrowser` and `appBrowser` factories own
|
|
194
|
+
`ENVIRONMENT_CSS`. It never selects a boundary guarantee — those ship in every shape, as the
|
|
195
|
+
compilers section sets out.
|
|
194
196
|
|
|
195
197
|
`ViteFacts` is the optional structural-fact slice shared by every root Vite compiler:
|
|
196
198
|
`bin`, `integration`, and `service` each select their matching standalone project when `true`;
|
|
@@ -317,6 +319,7 @@ From [`types.ts`](../../src/server/types.ts).
|
|
|
317
319
|
| `CatalogAllowance` | type |
|
|
318
320
|
| `SyncBase` | type |
|
|
319
321
|
| `SyncBranch` | type |
|
|
322
|
+
| `VersionLookup` | type |
|
|
320
323
|
| `GuideWrite` | interface |
|
|
321
324
|
| `MaterializerInterface` | interface |
|
|
322
325
|
| `SyncEventMap` | type |
|
|
@@ -344,7 +347,9 @@ identity, and `WriteDirectoryResult` pairs the final anchor with the subset a ca
|
|
|
344
347
|
`CatalogAllowance` are one-cell `Float64Array` allowances: the former shares a byte budget across
|
|
345
348
|
concurrent network readers, while the latter shares one entry budget across every fleet root and
|
|
346
349
|
child visited by a catalog operation. `SyncBase` and `SyncBranch` are normalized strings returned
|
|
347
|
-
only by their corresponding boundary parsers.
|
|
350
|
+
only by their corresponding boundary parsers. `VersionLookup` is the bare-name registry result:
|
|
351
|
+
a successful lookup carries `latest` with `freshness: 'behind'` because no declared range was
|
|
352
|
+
supplied as a reference, while `missing` and `failed` carry a `note` and no invented version.
|
|
348
353
|
|
|
349
354
|
`SyncOptions` groups the injectable endpoints under the entity they configure — `guides` with
|
|
350
355
|
`base`, `branch`, and `timeout`; `registry` with `base` and `timeout` — alongside `concurrency`,
|
|
@@ -449,7 +454,10 @@ form. `HEX_PATTERN` requires whole lowercase byte pairs, and `SYNC_BASELINE_PATT
|
|
|
449
454
|
`0.0.1`. `BASE_DEV_DEPENDENCIES` is the host-neutral tooling baseline every generated workspace
|
|
450
455
|
gets; `SOURCE_BROWSER_DEV_DEPENDENCIES` adds the real browser providers a published browser environment
|
|
451
456
|
needs, and `APP_BROWSER_DEV_DEPENDENCIES` extends that with the Vue toolchain a private browser
|
|
452
|
-
application needs.
|
|
457
|
+
application needs. Vite is minor-pinned at `~8.2.0`: the generated boundary consumes the reviewed
|
|
458
|
+
8.2 `CSSOptions`, `preprocessCSS`, and `isCSSRequest` surface, while the selected
|
|
459
|
+
`css.transformer` / `lightningcss` path is experimental and must not float into an unreviewed minor.
|
|
460
|
+
`SCAFFOLD_RANGE` is the range generated workspaces pin this package at.
|
|
453
461
|
`CHECKOUT_ACTION_SHA` and `SETUP_NODE_ACTION_SHA` pin the two official CI actions to immutable
|
|
454
462
|
commits. `TYPESCRIPT_EXTENSIONS` is the module extension set every generated scoped check covers.
|
|
455
463
|
`JSON_PRINT_WIDTH` and `JSON_TAB_WIDTH` mirror the formatter configuration, so computed JSON is
|
|
@@ -684,6 +692,7 @@ From [`parsers.ts`](../../src/server/parsers.ts).
|
|
|
684
692
|
| Name | Kind |
|
|
685
693
|
| -------------------------- | -------- |
|
|
686
694
|
| `parseSyncDependencies` | function |
|
|
695
|
+
| `parseSyncNames` | function |
|
|
687
696
|
| `parseFilesystemPaths` | function |
|
|
688
697
|
| `parsePortablePaths` | function |
|
|
689
698
|
| `parseWritePreconditions` | function |
|
|
@@ -703,7 +712,9 @@ subset used in raw-guide URLs: it rejects overlong values, empty or dot-leading
|
|
|
703
712
|
`@{`, the single `@`, trailing dots, and `.lock` suffixes without regard to case.
|
|
704
713
|
`parseSyncCurrent` snapshots only the declared guide references, enforcing both the per-file and
|
|
705
714
|
cumulative byte allowance. The three array parsers return frozen copies read through property
|
|
706
|
-
descriptors, so a caller-supplied array can never smuggle in a getter.
|
|
715
|
+
descriptors, so a caller-supplied array can never smuggle in a getter. `parseSyncNames` snapshots a
|
|
716
|
+
bounded dense array of unique npm package names and validates only the names; declaration ranges
|
|
717
|
+
remain the responsibility of `parseSyncDependencies` and the blueprint gate.
|
|
707
718
|
|
|
708
719
|
### Shapers — core
|
|
709
720
|
|
|
@@ -1081,8 +1092,9 @@ streams, `URL`, `AbortController`, the text encoders, `crypto`, timers, `console
|
|
|
1081
1092
|
is one declaration set for a host-independent module, not a host. `viteHeader` renders the shared
|
|
1082
1093
|
header — the alias block
|
|
1083
1094
|
derived from the tsconfig paths, plus the environment-boundary plugin — and `viteMachinery` is the
|
|
1084
|
-
one place the header's axes are derived, read by `rootViteConfig`, `singleSrcViteConfig`,
|
|
1085
|
-
`applicationViteConfig
|
|
1095
|
+
one place the root header's axes are derived, read by `rootViteConfig`, `singleSrcViteConfig`, and
|
|
1096
|
+
`applicationViteConfig`; `configArtifacts` delegates to those roots rather than deriving another
|
|
1097
|
+
answer.
|
|
1086
1098
|
|
|
1087
1099
|
**The boundary guarantees do not vary by blueprint.** Every generated `vite.config.ts` — a
|
|
1088
1100
|
`core`-only library, an application of `app/core` alone, or the full six-environment workspace —
|
|
@@ -1095,12 +1107,12 @@ module graph never records — has no other enforcement point in workspace-owned
|
|
|
1095
1107
|
and toolchain modules are outside that ownership boundary. Only host-specific pipelines vary,
|
|
1096
1108
|
along the three `ViteMachinery` axes:
|
|
1097
1109
|
|
|
1098
|
-
| Machinery
|
|
1099
|
-
|
|
|
1100
|
-
| CSS
|
|
1101
|
-
| Playwright provider and `resolveChromium`
|
|
1102
|
-
| Vue plugin, HTML boundary, browser development server
|
|
1103
|
-
| Output containment (`outputBoundary`, `enforceOutputPath`)
|
|
1110
|
+
| Machinery | Emitted when |
|
|
1111
|
+
| ------------------------------------------------------------------------ | ------------------------------------ |
|
|
1112
|
+
| Shared CSS analysis (`ENVIRONMENT_CSS`, `preprocessCSS`, `isCSSRequest`) | a `src` or `app` browser environment |
|
|
1113
|
+
| Playwright provider and `resolveChromium` | a `src` or `app` browser environment |
|
|
1114
|
+
| Vue plugin, HTML boundary, browser development server | an `app` browser environment |
|
|
1115
|
+
| Output containment (`outputBoundary`, `enforceOutputPath`) | anything the workspace builds |
|
|
1104
1116
|
|
|
1105
1117
|
An application of `app/core` alone is the sole shape that builds nothing, so it is the sole shape
|
|
1106
1118
|
without output containment — and it still carries every boundary guarantee above.
|
|
@@ -1120,7 +1132,9 @@ slice carries `global` to integration and the source-browser compiler without ad
|
|
|
1120
1132
|
project.
|
|
1121
1133
|
|
|
1122
1134
|
`coreViteConfig`, `srcViteConfig`, `binViteConfig`, and `appViteConfig` emit the thin per-target
|
|
1123
|
-
wrappers
|
|
1135
|
+
wrappers. `coreViteConfig()` is parameterless and never imports or attaches browser CSS machinery;
|
|
1136
|
+
the root `srcCore` factory and its wrapper stay host-independent even when the workspace also owns a
|
|
1137
|
+
browser target. `binTsconfig` emits the executable declaration scope; `rootViteConfig`,
|
|
1124
1138
|
`singleSrcViteConfig`, and `applicationViteConfig` emit the root configuration for a library-only,
|
|
1125
1139
|
single non-core `src` environment, and application-bearing workspace respectively; and
|
|
1126
1140
|
`policyViteProject`, `guidesViteProject`, `integrationViteProject`, and `serviceViteProject` emit
|
|
@@ -1282,16 +1296,18 @@ The interface also exposes the readonly `emitter`.
|
|
|
1282
1296
|
|
|
1283
1297
|
#### `SyncInterface`
|
|
1284
1298
|
|
|
1285
|
-
| Method | Returns
|
|
1286
|
-
| ---------- |
|
|
1287
|
-
| `
|
|
1288
|
-
| `
|
|
1289
|
-
| `
|
|
1290
|
-
| `
|
|
1291
|
-
| `
|
|
1292
|
-
| `
|
|
1293
|
-
|
|
1294
|
-
|
|
1299
|
+
| Method | Returns |
|
|
1300
|
+
| ---------- | ----------------------------------- |
|
|
1301
|
+
| `lookup` | `Promise<readonly VersionLookup[]>` |
|
|
1302
|
+
| `guides` | `Promise<readonly GuideSync[]>` |
|
|
1303
|
+
| `versions` | `Promise<readonly VersionSync[]>` |
|
|
1304
|
+
| `catalog` | `Promise<readonly CatalogEntry[]>` |
|
|
1305
|
+
| `pull` | `Promise<SyncReport>` |
|
|
1306
|
+
| `write` | `Promise<readonly string[]>` |
|
|
1307
|
+
| `destroy` | `void` |
|
|
1308
|
+
|
|
1309
|
+
`lookup(names)` resolves registry versions from bare package names, with no declaration range
|
|
1310
|
+
required or synthesized. `guides(deps, current?)` fetches each dependency's upstream guide. The optional `current` map is
|
|
1295
1311
|
keyed by dependency name: with it, a fetched guide byte-equal to its entry verdicts `current` and
|
|
1296
1312
|
anything else verdicts `behind`; without it, every successful fetch verdicts `behind`, because no
|
|
1297
1313
|
reference means it needs syncing. `versions(deps)` compares each declared range to the registry
|
|
@@ -1671,10 +1687,13 @@ What it rejects is equally deliberate:
|
|
|
1671
1687
|
Unsupported stylesheet `@import` or `url()` syntax is an error rather than a silently skipped
|
|
1672
1688
|
dependency. **`publicDir` is disabled on every generated build target**: an asset that is not
|
|
1673
1689
|
reachable through the module graph is not silently copied past the boundary. The output plugin
|
|
1674
|
-
fails during configuration when a caller attempts to enable `publicDir
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1690
|
+
fails during configuration when a caller attempts to enable `publicDir`. Published `srcBrowser`
|
|
1691
|
+
targets use Vite library mode, where assets are always inlined and `assetsInlineLimit` is ignored,
|
|
1692
|
+
so their generated shapes omit that ineffective option. The normal `appBrowser` build retains
|
|
1693
|
+
`assetsInlineLimit: 0`, and the output plugin rejects a nonzero limit only for that non-library
|
|
1694
|
+
browser build, keeping application asset bytes external and visible to output auditing before any
|
|
1695
|
+
output directory mutation. A caller-supplied Rolldown `output.dir` or `output.file` is also rejected
|
|
1696
|
+
during configuration; the exact generated `build.outDir` is the sole write root.
|
|
1678
1697
|
|
|
1679
1698
|
**The policy suite.** [`tests/setupPolicy.ts`](../../tests/setupPolicy.ts) is a narrow structural
|
|
1680
1699
|
policy pass built on the official TypeScript compiler. It exists for exactly the laws a linter
|
|
@@ -2297,6 +2316,7 @@ import { createSync } from '@orkestrel/scaffold/server'
|
|
|
2297
2316
|
|
|
2298
2317
|
const sync = createSync({ concurrency: 4, retries: 1 })
|
|
2299
2318
|
|
|
2319
|
+
await sync.lookup(['@orkestrel/contract'])
|
|
2300
2320
|
const report = await sync.pull('.')
|
|
2301
2321
|
if (report.failed === 0) await sync.write(report, '.')
|
|
2302
2322
|
|
|
@@ -2421,6 +2441,7 @@ import {
|
|
|
2421
2441
|
parseSyncBranch,
|
|
2422
2442
|
parseSyncCurrent,
|
|
2423
2443
|
parseSyncDependencies,
|
|
2444
|
+
parseSyncNames,
|
|
2424
2445
|
parseSyncOptions,
|
|
2425
2446
|
parseWritePreconditions,
|
|
2426
2447
|
syncGuideOptionsShape,
|
|
@@ -2443,6 +2464,7 @@ parseMaterializerOptions({ host: './dist/host' })
|
|
|
2443
2464
|
parseSyncBase('registry.npmjs.org') // 'https://registry.npmjs.org'
|
|
2444
2465
|
parseSyncBranch('main')
|
|
2445
2466
|
parseSyncCurrent({ '@orkestrel/contract': '# contract\n' }, ['@orkestrel/contract'], 16_777_216)
|
|
2467
|
+
parseSyncNames(['@orkestrel/contract', 'zod'])
|
|
2446
2468
|
parseSyncDependencies([{ name: '@orkestrel/contract', range: '^0.0.7' }], false)
|
|
2447
2469
|
parsePortablePaths(['src/core/index.ts'], 1_000)
|
|
2448
2470
|
parseFilesystemPaths(['./packages'], 1_000)
|
package/dist/src/core/index.cjs
CHANGED
|
@@ -227,7 +227,7 @@ var DEFAULT_VERSION = "0.0.1";
|
|
|
227
227
|
/** The `engines.node` range the `blueprint` builder fills. */
|
|
228
228
|
var DEFAULT_ENGINES = `>=${MINIMUM_NODE_VERSION}`;
|
|
229
229
|
/** The devDependency range generated packages pin `@orkestrel/scaffold` at. */
|
|
230
|
-
var SCAFFOLD_RANGE = "^0.0.
|
|
230
|
+
var SCAFFOLD_RANGE = "^0.0.16";
|
|
231
231
|
/** Tooling versions shared by scaffold and every generated workspace. */
|
|
232
232
|
var BASE_DEV_DEPENDENCIES = Object.freeze({
|
|
233
233
|
"@microsoft/api-extractor": "^7.58.12",
|
|
@@ -237,14 +237,14 @@ var BASE_DEV_DEPENDENCIES = Object.freeze({
|
|
|
237
237
|
oxfmt: "^0.61.0",
|
|
238
238
|
oxlint: "^1.76.0",
|
|
239
239
|
typescript: "^6.0.3",
|
|
240
|
-
vite: "
|
|
240
|
+
vite: "~8.2.0",
|
|
241
241
|
"vite-plugin-dts": "^5.0.3",
|
|
242
242
|
vitest: "^4.1.10"
|
|
243
243
|
});
|
|
244
244
|
/** Additional development dependency required by a published browser source environment. */
|
|
245
245
|
var SOURCE_BROWSER_DEV_DEPENDENCIES = Object.freeze({
|
|
246
246
|
"@vitest/browser-playwright": "^4.1.10",
|
|
247
|
-
playwright: "^1.62.
|
|
247
|
+
playwright: "^1.62.1"
|
|
248
248
|
});
|
|
249
249
|
/** Additional development dependencies required by a private Vue browser application. */
|
|
250
250
|
var APP_BROWSER_DEV_DEPENDENCIES = Object.freeze({
|
|
@@ -4140,9 +4140,7 @@ ${EXPORT_KEYWORD} ${FUNCTION_KEYWORD} isBrowserVuePath(path: string): boolean {
|
|
|
4140
4140
|
content: `import { globSync{{browserPolicySpecifier}} } from 'node:fs'
|
|
4141
4141
|
import { describe, expect, it } from 'vitest'
|
|
4142
4142
|
import { isBrowserVuePath } from './setup.js'
|
|
4143
|
-
import { inspectCodingWorkspace } from './setupPolicy.js'
|
|
4144
|
-
{{browserPolicyImport}}
|
|
4145
|
-
{{vuePolicyImport}}
|
|
4143
|
+
import { inspectCodingWorkspace } from './setupPolicy.js'{{browserPolicyImport}}{{vuePolicyImport}}
|
|
4146
4144
|
|
|
4147
4145
|
describe('repository coding law', () => {
|
|
4148
4146
|
it('keeps Vue single-file components exclusively in browser environments', () => {
|
|
@@ -4153,8 +4151,7 @@ describe('repository coding law', () => {
|
|
|
4153
4151
|
|
|
4154
4152
|
it('enforces source placement, exports, readonly contracts, and syntax law', () => {
|
|
4155
4153
|
{{workspacePolicyAssertion}}
|
|
4156
|
-
})
|
|
4157
|
-
{{browserPolicyTest}}
|
|
4154
|
+
}){{browserPolicyTest}}
|
|
4158
4155
|
})
|
|
4159
4156
|
`
|
|
4160
4157
|
}),
|
|
@@ -5937,7 +5934,7 @@ import { parse as parseVue } from 'vue/compiler-sfc'
|
|
|
5937
5934
|
if (isCSSRequest(id)) {
|
|
5938
5935
|
const config = resolvedConfig
|
|
5939
5936
|
if (config === undefined) {
|
|
5940
|
-
this.error('Environment boundary requires resolved Vite configuration')
|
|
5937
|
+
return this.error('Environment boundary requires resolved Vite configuration')
|
|
5941
5938
|
}
|
|
5942
5939
|
const stylesheet = await preprocessCSS(restored, id, config)
|
|
5943
5940
|
for (const dependency of stylesheet.deps ?? []) {
|
|
@@ -5983,7 +5980,9 @@ import { parse as parseVue } from 'vue/compiler-sfc'
|
|
|
5983
5980
|
? undefined
|
|
5984
5981
|
: packageRootOf(packageName, physicalSource)
|
|
5985
5982
|
if (packageRoot === undefined || !containedPath(packageRoot, physicalSource)) {
|
|
5986
|
-
this.error(
|
|
5983
|
+
return this.error(
|
|
5984
|
+
'Resolved dependencies must remain inside their physical package root',
|
|
5985
|
+
)
|
|
5987
5986
|
}
|
|
5988
5987
|
trustedPackageRoots.add(packageRoot)
|
|
5989
5988
|
}
|
|
@@ -5991,7 +5990,7 @@ import { parse as parseVue } from 'vue/compiler-sfc'
|
|
|
5991
5990
|
}
|
|
5992
5991
|
const resolvedSource = workspacePath(physicalSource)
|
|
5993
5992
|
if (resolvedSource === undefined) {
|
|
5994
|
-
this.error('Environment modules cannot import files outside the workspace')
|
|
5993
|
+
return this.error('Environment modules cannot import files outside the workspace')
|
|
5995
5994
|
}
|
|
5996
5995
|
const assetError = environmentPathError(owner, resolvedSource)
|
|
5997
5996
|
if (assetError !== undefined) this.error(assetError)
|
|
@@ -6020,7 +6019,7 @@ import { parse as parseVue } from 'vue/compiler-sfc'
|
|
|
6020
6019
|
)
|
|
6021
6020
|
const resolvedSource = workspacePath(resolution?.id ?? fallbackSource)
|
|
6022
6021
|
if (resolvedSource === undefined) {
|
|
6023
|
-
this.error('Environment modules cannot import files outside the workspace')
|
|
6022
|
+
return this.error('Environment modules cannot import files outside the workspace')
|
|
6024
6023
|
}
|
|
6025
6024
|
const pathError = environmentPathError('app/browser', resolvedSource)
|
|
6026
6025
|
if (pathError !== undefined) this.error(pathError)
|
|
@@ -6038,7 +6037,7 @@ import { parse as parseVue } from 'vue/compiler-sfc'
|
|
|
6038
6037
|
if (source === undefined) continue
|
|
6039
6038
|
const decodedSource = decodeAssetSource(source)
|
|
6040
6039
|
if (decodedSource === undefined) {
|
|
6041
|
-
this.error('Vue block URLs must use valid URI encoding')
|
|
6040
|
+
return this.error('Vue block URLs must use valid URI encoding')
|
|
6042
6041
|
}
|
|
6043
6042
|
const normalizedSource = decodedSource.replaceAll('\\\\', '/')
|
|
6044
6043
|
const sourceError = environmentSourceError('app/browser', normalizedSource)
|
|
@@ -6096,7 +6095,7 @@ import { parse as parseVue } from 'vue/compiler-sfc'
|
|
|
6096
6095
|
if (isCSSRequest(id)) {
|
|
6097
6096
|
const config = resolvedConfig
|
|
6098
6097
|
if (config === undefined) {
|
|
6099
|
-
this.error('Environment boundary requires resolved Vite configuration')
|
|
6098
|
+
return this.error('Environment boundary requires resolved Vite configuration')
|
|
6100
6099
|
}
|
|
6101
6100
|
const stylesheet = await preprocessCSS(code, id, config)
|
|
6102
6101
|
for (const dependency of stylesheet.deps ?? []) {
|
|
@@ -6142,7 +6141,9 @@ import { parse as parseVue } from 'vue/compiler-sfc'
|
|
|
6142
6141
|
? undefined
|
|
6143
6142
|
: packageRootOf(packageName, physicalSource)
|
|
6144
6143
|
if (packageRoot === undefined || !containedPath(packageRoot, physicalSource)) {
|
|
6145
|
-
this.error(
|
|
6144
|
+
return this.error(
|
|
6145
|
+
'Resolved dependencies must remain inside their physical package root',
|
|
6146
|
+
)
|
|
6146
6147
|
}
|
|
6147
6148
|
trustedPackageRoots.add(packageRoot)
|
|
6148
6149
|
}
|
|
@@ -6150,7 +6151,7 @@ import { parse as parseVue } from 'vue/compiler-sfc'
|
|
|
6150
6151
|
}
|
|
6151
6152
|
const resolvedSource = workspacePath(physicalSource)
|
|
6152
6153
|
if (resolvedSource === undefined) {
|
|
6153
|
-
this.error('Environment modules cannot import files outside the workspace')
|
|
6154
|
+
return this.error('Environment modules cannot import files outside the workspace')
|
|
6154
6155
|
}
|
|
6155
6156
|
const assetError = environmentPathError(owner, resolvedSource)
|
|
6156
6157
|
if (assetError !== undefined) this.error(assetError)
|
|
@@ -6709,7 +6710,11 @@ ${EXPORT_KEYWORD} function outputBoundary(output: string): Plugin {
|
|
|
6709
6710
|
'[orkestrel-output-boundary] Public directories are disabled; every output must come from the audited graph',
|
|
6710
6711
|
)
|
|
6711
6712
|
}
|
|
6712
|
-
if (
|
|
6713
|
+
if (
|
|
6714
|
+
output.endsWith('/browser') &&
|
|
6715
|
+
config.build.lib === false &&
|
|
6716
|
+
config.build.assetsInlineLimit !== 0
|
|
6717
|
+
) {
|
|
6713
6718
|
throw new Error(
|
|
6714
6719
|
'[orkestrel-output-boundary] Browser assets must remain external for output auditing',
|
|
6715
6720
|
)
|
|
@@ -7112,7 +7117,7 @@ ${needsVue ? ` configureServer(server) {
|
|
|
7112
7117
|
? packageRootForResolved(physicalResolution)
|
|
7113
7118
|
: undefined
|
|
7114
7119
|
if (mappedPackageRoot === undefined) {
|
|
7115
|
-
this.error(
|
|
7120
|
+
return this.error(
|
|
7116
7121
|
'Dependency package imports must resolve inside an exact physical package root',
|
|
7117
7122
|
)
|
|
7118
7123
|
}
|
|
@@ -7131,7 +7136,7 @@ ${needsVue ? ` configureServer(server) {
|
|
|
7131
7136
|
const packageRoot =
|
|
7132
7137
|
packageName === undefined ? undefined : packageRootOf(packageName, physicalResolution)
|
|
7133
7138
|
if (packageRoot === undefined || !containedPath(packageRoot, physicalResolution)) {
|
|
7134
|
-
this.error('Resolved dependencies must remain inside their physical package root')
|
|
7139
|
+
return this.error('Resolved dependencies must remain inside their physical package root')
|
|
7135
7140
|
}
|
|
7136
7141
|
trustedPackageRoots.add(packageRoot)
|
|
7137
7142
|
}
|
|
@@ -7162,7 +7167,7 @@ ${needsVue ? ` configureServer(server) {
|
|
|
7162
7167
|
}
|
|
7163
7168
|
const code = readBoundedFile(physicalImporter, ENVIRONMENT_MODULE_BYTES)
|
|
7164
7169
|
if (code === undefined) {
|
|
7165
|
-
this.error('Dependency module source must be a bounded regular file')
|
|
7170
|
+
return this.error('Dependency module source must be a bounded regular file')
|
|
7166
7171
|
}
|
|
7167
7172
|
for (const source of await environmentAssetSources(code, id)) {
|
|
7168
7173
|
const normalizedSource = source.replaceAll('\\\\', '/')
|
|
@@ -7399,7 +7404,7 @@ ${EXPORT_KEYWORD} ${CONST_KEYWORD} ENVIRONMENT_CSS = Object.freeze({
|
|
|
7399
7404
|
'value' in rule && rule.value !== null && 'loc' in rule.value
|
|
7400
7405
|
? sources[rule.value.loc.source_index]
|
|
7401
7406
|
: undefined
|
|
7402
|
-
if (rule.type !== 'import') return
|
|
7407
|
+
if (rule.type !== 'import' || rule.value === null) return
|
|
7403
7408
|
const error = stylesheetAssetError(source, rule.value.url)
|
|
7404
7409
|
if (error !== undefined) {
|
|
7405
7410
|
throw new Error(\`[orkestrel-environment-boundary] \${error}\`)
|
|
@@ -7620,7 +7625,6 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
|
|
|
7620
7625
|
publicDir: false,
|
|
7621
7626
|
plugins: [outputBoundary('dist/src/browser'), environmentBoundary('src/browser')],
|
|
7622
7627
|
build: {
|
|
7623
|
-
assetsInlineLimit: 0,
|
|
7624
7628
|
emptyOutDir: true,
|
|
7625
7629
|
sourcemap: true,
|
|
7626
7630
|
minify: false,
|
|
@@ -7671,7 +7675,7 @@ ${renderedTest}
|
|
|
7671
7675
|
${EXPORT_KEYWORD} const srcServer = (config?: UserConfig): UserConfig =>
|
|
7672
7676
|
mergeConfig(
|
|
7673
7677
|
{
|
|
7674
|
-
resolve
|
|
7678
|
+
resolve,
|
|
7675
7679
|
publicDir: false,
|
|
7676
7680
|
plugins: [outputBoundary('dist/src/server'), environmentBoundary('src/server')],
|
|
7677
7681
|
build: {
|
|
@@ -7754,7 +7758,6 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
|
|
|
7754
7758
|
publicDir: false,
|
|
7755
7759
|
plugins: [outputBoundary('dist/src/browser'), environmentBoundary('src/browser')],
|
|
7756
7760
|
build: {
|
|
7757
|
-
assetsInlineLimit: 0,
|
|
7758
7761
|
lib: {
|
|
7759
7762
|
entry: resolveWorkspacePath('src/browser/index.ts'),
|
|
7760
7763
|
formats: ['es'],
|
|
@@ -7799,7 +7802,7 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
|
|
|
7799
7802
|
${EXPORT_KEYWORD} const srcServer = (config?: UserConfig): UserConfig =>
|
|
7800
7803
|
srcCore(
|
|
7801
7804
|
mergeConfig(
|
|
7802
|
-
{
|
|
7805
|
+
{
|
|
7803
7806
|
publicDir: false,
|
|
7804
7807
|
plugins: [outputBoundary('dist/src/server'), environmentBoundary('src/server')],
|
|
7805
7808
|
build: {
|
|
@@ -7891,7 +7894,7 @@ function applicationViteConfig(src, app, facts = {}) {
|
|
|
7891
7894
|
${EXPORT_KEYWORD} const srcCore = (config?: UserConfig): UserConfig =>
|
|
7892
7895
|
mergeConfig(
|
|
7893
7896
|
{
|
|
7894
|
-
resolve
|
|
7897
|
+
resolve,
|
|
7895
7898
|
publicDir: false,
|
|
7896
7899
|
plugins: [environmentBoundary('src/core')],
|
|
7897
7900
|
build: { emptyOutDir: true, sourcemap: true, minify: false },
|
|
@@ -7919,7 +7922,6 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
|
|
|
7919
7922
|
publicDir: false,
|
|
7920
7923
|
plugins: [outputBoundary('dist/src/browser'), environmentBoundary('src/browser')],
|
|
7921
7924
|
build: {
|
|
7922
|
-
assetsInlineLimit: 0,
|
|
7923
7925
|
emptyOutDir: true,
|
|
7924
7926
|
sourcemap: true,
|
|
7925
7927
|
minify: false,
|
|
@@ -7981,7 +7983,7 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
|
|
|
7981
7983
|
${EXPORT_KEYWORD} const srcServer = (config?: UserConfig): UserConfig =>
|
|
7982
7984
|
mergeConfig(
|
|
7983
7985
|
{
|
|
7984
|
-
resolve
|
|
7986
|
+
resolve,
|
|
7985
7987
|
publicDir: false,
|
|
7986
7988
|
plugins: [outputBoundary('dist/src/server'), environmentBoundary('src/server')],
|
|
7987
7989
|
build: {
|
|
@@ -8015,7 +8017,7 @@ ${EXPORT_KEYWORD} const srcServer = (config?: UserConfig): UserConfig =>
|
|
|
8015
8017
|
${EXPORT_KEYWORD} const appCore = (config?: UserConfig): UserConfig =>
|
|
8016
8018
|
mergeConfig(
|
|
8017
8019
|
{
|
|
8018
|
-
resolve
|
|
8020
|
+
resolve,
|
|
8019
8021
|
publicDir: false,
|
|
8020
8022
|
plugins: [environmentBoundary('app/core')],
|
|
8021
8023
|
test: {
|
|
@@ -8092,7 +8094,7 @@ ${EXPORT_KEYWORD} function appBrowser(...config: readonly never[]): UserConfig {
|
|
|
8092
8094
|
${EXPORT_KEYWORD} const appServer = (config?: UserConfig): UserConfig =>
|
|
8093
8095
|
mergeConfig(
|
|
8094
8096
|
{
|
|
8095
|
-
resolve
|
|
8097
|
+
resolve,
|
|
8096
8098
|
publicDir: false,
|
|
8097
8099
|
plugins: [outputBoundary('dist/app/server'), environmentBoundary('app/server')],
|
|
8098
8100
|
build: {
|
|
@@ -8158,7 +8160,6 @@ function coreTsconfig() {
|
|
|
8158
8160
|
* `configs/src/vite.core.config.ts` — inlines its own `build.lib` /
|
|
8159
8161
|
* `rolldownOptions` (core's `srcCore` root export carries no build.lib).
|
|
8160
8162
|
*
|
|
8161
|
-
* @param browser - Whether a declared browser environment enables the shared CSS pipeline.
|
|
8162
8163
|
* @returns The core environment `vite.config.ts` file content, newline-terminated.
|
|
8163
8164
|
*
|
|
8164
8165
|
* @example
|
|
@@ -8166,11 +8167,11 @@ function coreTsconfig() {
|
|
|
8166
8167
|
* coreViteConfig().includes('srcCore(') // true
|
|
8167
8168
|
* ```
|
|
8168
8169
|
*/
|
|
8169
|
-
function coreViteConfig(
|
|
8170
|
+
function coreViteConfig() {
|
|
8170
8171
|
return `import { defineConfig } from 'vite'
|
|
8171
8172
|
import dts from 'vite-plugin-dts'
|
|
8172
8173
|
import {
|
|
8173
|
-
|
|
8174
|
+
environmentBoundary,
|
|
8174
8175
|
outputBoundary,
|
|
8175
8176
|
srcCore,
|
|
8176
8177
|
resolveWorkspacePath,
|
|
@@ -8178,7 +8179,7 @@ ${browser ? " ENVIRONMENT_CSS,\n" : ""} environmentBoundary,
|
|
|
8178
8179
|
|
|
8179
8180
|
export default defineConfig(
|
|
8180
8181
|
srcCore({
|
|
8181
|
-
|
|
8182
|
+
publicDir: false,
|
|
8182
8183
|
plugins: [
|
|
8183
8184
|
outputBoundary('dist/src/core'),
|
|
8184
8185
|
environmentBoundary('src/core'),
|
|
@@ -8467,7 +8468,6 @@ ${browser}
|
|
|
8467
8468
|
* ```
|
|
8468
8469
|
*/
|
|
8469
8470
|
function configArtifacts(spec) {
|
|
8470
|
-
const machinery = viteMachinery(spec.src, spec.app, spec.bin);
|
|
8471
8471
|
const artifacts = [{
|
|
8472
8472
|
path: "tsconfig.json",
|
|
8473
8473
|
group: "configs",
|
|
@@ -8483,7 +8483,7 @@ function configArtifacts(spec) {
|
|
|
8483
8483
|
const row = SRC_MATRIX[environment];
|
|
8484
8484
|
for (const path of row.configs) {
|
|
8485
8485
|
const isTsconfig = path.endsWith(".json");
|
|
8486
|
-
const content = environment === "core" ? isTsconfig ? coreTsconfig() : coreViteConfig(
|
|
8486
|
+
const content = environment === "core" ? isTsconfig ? coreTsconfig() : coreViteConfig() : isTsconfig ? srcTsconfig(environment) : srcViteConfig(environment);
|
|
8487
8487
|
artifacts.push({
|
|
8488
8488
|
path,
|
|
8489
8489
|
group: "configs",
|
|
@@ -8615,24 +8615,20 @@ function paritySpecifiers(spec) {
|
|
|
8615
8615
|
for (const environment of spec.app) modules[`@app/${environment}`] = `app/${environment}`;
|
|
8616
8616
|
const specifierItems = selfSpecifiers.map((specifier) => `'${specifier}'`);
|
|
8617
8617
|
const inlineSpecifierList = `[${specifierItems.join(", ")}]`;
|
|
8618
|
-
|
|
8619
|
-
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
if (source === undefined) {
|
|
8631
|
-
|
|
8632
|
-
SPECIFIER_SOURCES.set(module, source)
|
|
8633
|
-
}
|
|
8634
|
-
return source.exports().map((symbol) => symbol.name)
|
|
8635
|
-
}`;
|
|
8618
|
+
const lines = fitsPrintWidth(`const SELF_SPECIFIERS = ${inlineSpecifierList}`) ? [`${EXPORT_KEYWORD} ${CONST_KEYWORD} SELF_SPECIFIERS = ${inlineSpecifierList}`] : [
|
|
8619
|
+
`${EXPORT_KEYWORD} ${CONST_KEYWORD} SELF_SPECIFIERS = [`,
|
|
8620
|
+
...specifierItems.map((specifier) => `\t${specifier},`),
|
|
8621
|
+
"]"
|
|
8622
|
+
];
|
|
8623
|
+
lines.push("", [
|
|
8624
|
+
EXPORT_KEYWORD,
|
|
8625
|
+
CONST_KEYWORD,
|
|
8626
|
+
"SPECIFIER_MODULES:",
|
|
8627
|
+
"Readonly<Record<string, string>>",
|
|
8628
|
+
"=",
|
|
8629
|
+
"{"
|
|
8630
|
+
].join(" "), ...Object.entries(modules).map(([specifier, module]) => `\t'${specifier}': '${module}',`), "}", `${EXPORT_KEYWORD} ${CONST_KEYWORD} SPECIFIER_SOURCES = new Map<string, ReturnType<typeof createSource>>()`, `${EXPORT_KEYWORD} ${FUNCTION_KEYWORD} exportsFor(specifier: string): readonly string[] {`, " const module = SPECIFIER_MODULES[specifier]", " if (module === undefined) return []", " let source = SPECIFIER_SOURCES.get(module)", " if (source === undefined) {", " source = createSource({ files: GUIDE_FILES, module })", " SPECIFIER_SOURCES.set(module, source)", " }", " return source.exports().map((symbol) => symbol.name)", "}");
|
|
8631
|
+
return lines.join("\n");
|
|
8636
8632
|
}
|
|
8637
8633
|
/**
|
|
8638
8634
|
* Draft the `tests` group's `template` artifacts — the shared recorder
|
|
@@ -8654,8 +8650,8 @@ function testArtifacts(spec, pascal) {
|
|
|
8654
8650
|
const hasBrowser = spec.src.includes("browser") || spec.app.includes("browser");
|
|
8655
8651
|
const hasVue = spec.app.includes("browser");
|
|
8656
8652
|
const browserPolicySpecifier = hasBrowser ? ", accessSync, constants as FS_CONSTANTS, statSync" : "";
|
|
8657
|
-
const browserPolicyImport = hasBrowser ? "
|
|
8658
|
-
const vuePolicyImport = hasVue ? "
|
|
8653
|
+
const browserPolicyImport = hasBrowser ? "\nimport { chromium } from 'playwright'\nimport { resolveChromium } from '../vite.config.js'" : "";
|
|
8654
|
+
const vuePolicyImport = hasVue ? "\nimport { parse as parseVue } from 'vue/compiler-sfc'" : "";
|
|
8659
8655
|
const workspacePolicyAssertion = hasVue ? `expect(
|
|
8660
8656
|
inspectCodingWorkspace(process.cwd(), (path, content) => {
|
|
8661
8657
|
const parsed = parseVue(content, { filename: path })
|
|
@@ -8666,6 +8662,7 @@ function testArtifacts(spec, pascal) {
|
|
|
8666
8662
|
}),
|
|
8667
8663
|
).toEqual([])` : "expect(inspectCodingWorkspace(process.cwd())).toEqual([])";
|
|
8668
8664
|
const browserPolicyTest = hasBrowser ? `
|
|
8665
|
+
|
|
8669
8666
|
it('resolves Chromium only to a real executable file', () => {
|
|
8670
8667
|
const chromiumPath = resolveChromium(chromium.executablePath())
|
|
8671
8668
|
if (chromiumPath === undefined) return
|