@orkestrel/scaffold 0.0.134 → 0.0.135
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/agents/skills/orkestrel-parallel/scripts/lane.js +610 -79
- package/dist/agents/skills/orkestrel-publish/scripts/wave.js +307 -16
- package/dist/bin/main.js +253 -35
- package/dist/bin/main.js.map +1 -1
- package/dist/host/AGENTS.md +1 -1
- package/dist/host/agents/skills/orkestrel-parallel/SKILL.md +1 -1
- package/dist/host/agents/skills/orkestrel-parallel/scripts/lane.ts +782 -115
- package/dist/host/agents/skills/orkestrel-publish/references/release.md +1 -0
- package/dist/host/agents/skills/orkestrel-publish/references/wave.md +22 -5
- package/dist/host/agents/skills/orkestrel-publish/scripts/wave.ts +379 -27
- package/dist/host/claude/agents/orkestrel.md +14 -14
- package/dist/host/claude/rules/architecture.md +1 -1
- package/dist/host/claude/rules/patterns.md +2 -0
- package/dist/host/claude/rules/workspace.md +64 -63
- package/dist/host/configs/helpers.ts +88 -67
- package/dist/host/dotfiles/oxlintrc.json +1 -57
- package/dist/host/guides/agent.md +989 -395
- package/dist/host/guides/database.md +357 -342
- package/dist/host/guides/middleware.md +5 -5
- package/dist/host/guides/ollama.md +41 -42
- package/dist/host/guides/scaffold.md +177 -105
- package/dist/host/guides/study.md +12 -12
- package/dist/host/guides/test.md +158 -46
- package/dist/host/guides/toolbox.md +127 -81
- package/dist/host/guides/workspace.md +21 -14
- package/dist/host/manifest.json +23 -23
- package/dist/host/tests/config.test.ts +166 -112
- package/dist/src/core/index.cjs +491 -195
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +217 -24
- package/dist/src/core/index.d.ts +217 -24
- package/dist/src/core/index.js +482 -193
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +18 -8
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +4 -3
- package/dist/src/server/index.d.ts +4 -3
- package/dist/src/server/index.js +19 -9
- package/dist/src/server/index.js.map +1 -1
- package/package.json +2 -2
package/dist/src/core/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@ let _orkestrel_template = require("@orkestrel/template");
|
|
|
4
4
|
let _orkestrel_emitter = require("@orkestrel/emitter");
|
|
5
5
|
var package_default = {
|
|
6
6
|
name: "@orkestrel/scaffold",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.135",
|
|
8
8
|
description: "Scaffold workspaces with commands: new, audit, surface, repair, catalog, and overwrite.",
|
|
9
9
|
keywords: [
|
|
10
10
|
"audit",
|
|
@@ -109,7 +109,7 @@ var package_default = {
|
|
|
109
109
|
"@orkestrel/guide": "^0.0.31",
|
|
110
110
|
"@orkestrel/html": "^0.0.16",
|
|
111
111
|
"@orkestrel/probe": "^0.0.30",
|
|
112
|
-
"@orkestrel/test": "^0.0.
|
|
112
|
+
"@orkestrel/test": "^0.0.38",
|
|
113
113
|
"@types/node": "^24.19.2",
|
|
114
114
|
"@vitest/browser-playwright": "^5.1.0",
|
|
115
115
|
"oxfmt": "^0.78.0",
|
|
@@ -170,7 +170,6 @@ var STYLES_DEV_DEPENDENCIES = Object.freeze({ sass: "^1.105.1" });
|
|
|
170
170
|
var RESERVED_SHEET_NAMES = Object.freeze([
|
|
171
171
|
...ENVIRONMENTS,
|
|
172
172
|
"bin",
|
|
173
|
-
"reporter",
|
|
174
173
|
"styles",
|
|
175
174
|
"themes",
|
|
176
175
|
...FRAMEWORKS
|
|
@@ -249,18 +248,37 @@ var APP_MATRIX = Object.freeze({
|
|
|
249
248
|
});
|
|
250
249
|
/** Lists the configuration files a workspace that ships its own executable adds, frozen. */
|
|
251
250
|
var BIN_CONFIGS = Object.freeze(["configs/src/vite.bin.config.ts", "configs/src/tsconfig.bin.json"]);
|
|
252
|
-
/** Lists the configuration files a workspace that publishes a Vitest reporter adds, frozen. */
|
|
253
|
-
var REPORTER_CONFIGS = Object.freeze(["configs/src/vite.reporter.config.ts", "configs/src/tsconfig.reporter.json"]);
|
|
254
251
|
/** Lists the configuration file a workspace with studies and a server application adds, frozen. */
|
|
255
252
|
var BARREL_CONFIGS = Object.freeze(["configs/app/vite.barrel.config.ts"]);
|
|
256
|
-
/** Names the executable entry
|
|
253
|
+
/** Names the executable entry, the `main` module of `src/bin`. */
|
|
257
254
|
var BIN_ENTRY_PATH = "src/bin/main.ts";
|
|
258
255
|
/** Names the built executable a bin workspace's manifest command runs. */
|
|
259
256
|
var BIN_OUTPUT_PATH = "dist/bin/main.js";
|
|
260
|
-
/**
|
|
261
|
-
var
|
|
262
|
-
|
|
263
|
-
|
|
257
|
+
/** Lists the stems of the centralized files the architecture kind table names, which no `src/bin` module takes, frozen. */
|
|
258
|
+
var CENTRAL_FILE_NAMES = Object.freeze([
|
|
259
|
+
"cloners",
|
|
260
|
+
"combinators",
|
|
261
|
+
"compilers",
|
|
262
|
+
"constants",
|
|
263
|
+
"contracts",
|
|
264
|
+
"errors",
|
|
265
|
+
"factories",
|
|
266
|
+
"handlers",
|
|
267
|
+
"helpers",
|
|
268
|
+
"index",
|
|
269
|
+
"inferers",
|
|
270
|
+
"middlewares",
|
|
271
|
+
"parsers",
|
|
272
|
+
"plugins",
|
|
273
|
+
"relations",
|
|
274
|
+
"routes",
|
|
275
|
+
"schemas",
|
|
276
|
+
"seeders",
|
|
277
|
+
"shapers",
|
|
278
|
+
"templates",
|
|
279
|
+
"types",
|
|
280
|
+
"validators"
|
|
281
|
+
]);
|
|
264
282
|
/**
|
|
265
283
|
* Lists the paths a target receives from the vendored data root, frozen.
|
|
266
284
|
*
|
|
@@ -519,6 +537,42 @@ var RELEASE_PROOF_COMMAND = "npm run test:distribution -- --mode release";
|
|
|
519
537
|
var INTEGRATION_TEST_PATH = "tests/integration.test.ts";
|
|
520
538
|
/** Names the manifest path every compiler plan emits with birth ownership. */
|
|
521
539
|
var MANIFEST_PATH = "package.json";
|
|
540
|
+
/**
|
|
541
|
+
* Lists the top-level manifest keys in the order a compiled manifest emits them.
|
|
542
|
+
*
|
|
543
|
+
* @remarks
|
|
544
|
+
* An entry write that creates an absent `bin`, `files`, or `exports` key places it before the
|
|
545
|
+
* first declared key this list orders after it, so a created key lands where a born manifest
|
|
546
|
+
* carries it.
|
|
547
|
+
*/
|
|
548
|
+
var MANIFEST_KEY_ORDER = Object.freeze([
|
|
549
|
+
"name",
|
|
550
|
+
"version",
|
|
551
|
+
"private",
|
|
552
|
+
"description",
|
|
553
|
+
"keywords",
|
|
554
|
+
"homepage",
|
|
555
|
+
"bugs",
|
|
556
|
+
"license",
|
|
557
|
+
"repository",
|
|
558
|
+
"bin",
|
|
559
|
+
"files",
|
|
560
|
+
"type",
|
|
561
|
+
"sideEffects",
|
|
562
|
+
"main",
|
|
563
|
+
"module",
|
|
564
|
+
"types",
|
|
565
|
+
"exports",
|
|
566
|
+
"publishConfig",
|
|
567
|
+
"scripts",
|
|
568
|
+
"dependencies",
|
|
569
|
+
"devDependencies",
|
|
570
|
+
"overrides",
|
|
571
|
+
"peerDependencies",
|
|
572
|
+
"peerDependenciesMeta",
|
|
573
|
+
"devEngines",
|
|
574
|
+
"engines"
|
|
575
|
+
]);
|
|
522
576
|
/** Names the official-tooling drift proof whose presence makes a workspace `conformance`. */
|
|
523
577
|
var CONFORMANCE_TEST_PATH = "tests/conformance.test.ts";
|
|
524
578
|
/** Names the real-tree proof whose presence makes a workspace `tree`. */
|
|
@@ -548,6 +602,8 @@ var JOURNEY_CONFIG_PATH = "configs/app/vite.journey.config.ts";
|
|
|
548
602
|
var SKILLS_CONFIG_PATH = "configs/agents/tsconfig.skills.json";
|
|
549
603
|
/** Matches the bare workspace name syntax: lowercase alphanumeric with hyphens, letter first. */
|
|
550
604
|
var NAME_PATTERN = /^[a-z][a-z0-9-]*$/;
|
|
605
|
+
/** Matches the stem of a `src/bin` module: lowercase letters and digits, letter first, no hyphen. */
|
|
606
|
+
var BIN_MODULE_PATTERN = /^[a-z][a-z0-9]*$/;
|
|
551
607
|
/**
|
|
552
608
|
* Matches the runtime dependency name syntax: the `@orkestrel` scope and a bare name.
|
|
553
609
|
*
|
|
@@ -1216,8 +1272,8 @@ export function srcServer(override?: UserConfig): UserConfig {
|
|
|
1216
1272
|
return mergeOverride(project, override)
|
|
1217
1273
|
}
|
|
1218
1274
|
`,
|
|
1219
|
-
bin: `function resolveBinFilename(): string {
|
|
1220
|
-
return
|
|
1275
|
+
bin: `function resolveBinFilename(_format: string, entry: string): string {
|
|
1276
|
+
return \`\${entry}.js\`
|
|
1221
1277
|
}
|
|
1222
1278
|
|
|
1223
1279
|
function resolveBinExternal(id: string): boolean {
|
|
@@ -1234,7 +1290,9 @@ export function srcBin(override?: UserConfig): UserConfig {
|
|
|
1234
1290
|
sourcemap: true,
|
|
1235
1291
|
minify: false,
|
|
1236
1292
|
lib: {
|
|
1237
|
-
entry:
|
|
1293
|
+
entry: {
|
|
1294
|
+
{{entries}}
|
|
1295
|
+
},
|
|
1238
1296
|
formats: ['es'],
|
|
1239
1297
|
fileName: resolveBinFilename,
|
|
1240
1298
|
},
|
|
@@ -1259,46 +1317,6 @@ export function srcBin(override?: UserConfig): UserConfig {
|
|
|
1259
1317
|
}
|
|
1260
1318
|
return mergeOverride(project, override)
|
|
1261
1319
|
}
|
|
1262
|
-
`,
|
|
1263
|
-
reporter: `function resolveReporterFilename(): string {
|
|
1264
|
-
return 'main.js'
|
|
1265
|
-
}
|
|
1266
|
-
|
|
1267
|
-
function resolveReporterExternal(id: string): boolean {
|
|
1268
|
-
return id.startsWith('@src/') || resolveExternal(id, { peers, refused: [], siblings: [] })
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
export function srcReporter(override?: UserConfig): UserConfig {
|
|
1272
|
-
const project: UserConfig = {
|
|
1273
|
-
resolve,
|
|
1274
|
-
publicDir: false,
|
|
1275
|
-
plugins: [outputBoundary('dist/reporter')],
|
|
1276
|
-
build: {
|
|
1277
|
-
emptyOutDir: true,
|
|
1278
|
-
sourcemap: true,
|
|
1279
|
-
minify: false,
|
|
1280
|
-
lib: {
|
|
1281
|
-
entry: resolveWorkspacePath('${REPORTER_ENTRY_PATH}'),
|
|
1282
|
-
formats: ['es'],
|
|
1283
|
-
fileName: resolveReporterFilename,
|
|
1284
|
-
},
|
|
1285
|
-
outDir: 'dist/reporter',
|
|
1286
|
-
target: 'node22',
|
|
1287
|
-
rolldownOptions: {
|
|
1288
|
-
onLog: enforceBuildLog,
|
|
1289
|
-
external: resolveReporterExternal,
|
|
1290
|
-
},
|
|
1291
|
-
},
|
|
1292
|
-
test: {
|
|
1293
|
-
name: { label: 'src:reporter', color: 'cyan' },
|
|
1294
|
-
include: ['tests/src/reporter/**/*.test.ts'],
|
|
1295
|
-
setupFiles: ['./tests/setup.ts', './tests/setupServer.ts'],
|
|
1296
|
-
environment: 'node',
|
|
1297
|
-
browser: { enabled: false },
|
|
1298
|
-
},
|
|
1299
|
-
}
|
|
1300
|
-
return mergeOverride(project, override)
|
|
1301
|
-
}
|
|
1302
1320
|
`
|
|
1303
1321
|
}),
|
|
1304
1322
|
app: Object.freeze({
|
|
@@ -1983,25 +2001,6 @@ export function probe(override?: UserConfig): UserConfig {
|
|
|
1983
2001
|
"../../src/bin/**/*.tsx"
|
|
1984
2002
|
]
|
|
1985
2003
|
}
|
|
1986
|
-
`,
|
|
1987
|
-
reporter: `{
|
|
1988
|
-
"extends": "../../tsconfig.json",
|
|
1989
|
-
"compilerOptions": {
|
|
1990
|
-
"lib": ["ESNext"],
|
|
1991
|
-
"types": ["node"],
|
|
1992
|
-
"noEmit": false,
|
|
1993
|
-
"declaration": true,
|
|
1994
|
-
"emitDeclarationOnly": true,
|
|
1995
|
-
"rootDir": "../../src",
|
|
1996
|
-
"outDir": "../../dist/reporter"
|
|
1997
|
-
},
|
|
1998
|
-
"include": [
|
|
1999
|
-
"../../src/reporter/**/*.cts",
|
|
2000
|
-
"../../src/reporter/**/*.mts",
|
|
2001
|
-
"../../src/reporter/**/*.ts",
|
|
2002
|
-
"../../src/reporter/**/*.tsx"
|
|
2003
|
-
]
|
|
2004
|
-
}
|
|
2005
2004
|
`,
|
|
2006
2005
|
skills: `{
|
|
2007
2006
|
"extends": "../../tsconfig.json",
|
|
@@ -2145,45 +2144,28 @@ export default defineConfig(
|
|
|
2145
2144
|
`
|
|
2146
2145
|
}),
|
|
2147
2146
|
bin: `import { defineConfig } from 'vite'
|
|
2148
|
-
import { resolveExternal } from '../helpers.js'
|
|
2149
|
-
import { peers, srcBin } from '../../vite.config.ts'
|
|
2150
|
-
|
|
2151
|
-
// The \`scaffold\` executable build — a single ESM lib file, no declarations (an
|
|
2152
|
-
// executable ships no types), with the \`#!/usr/bin/env node\` shebang re-emitted through
|
|
2153
|
-
// \`output.banner\` (rolldown strips shebangs from source during bundling), and
|
|
2154
|
-
// \`output.paths\` rewriting the externalized \`@src/*\` specifiers to the built sibling
|
|
2155
|
-
// src environments (relative to \`dist/bin/\`), so the emitted bin resolves at runtime.
|
|
2156
|
-
export default defineConfig(
|
|
2157
|
-
srcBin({
|
|
2158
|
-
build: {
|
|
2159
|
-
rolldownOptions: {
|
|
2160
|
-
external: (id: string) =>
|
|
2161
|
-
id.startsWith('@src/') || resolveExternal(id, { peers, refused: [], siblings: [] }),
|
|
2162
|
-
output: {
|
|
2163
|
-
banner: '#!/usr/bin/env node',
|
|
2164
|
-
{{paths}}
|
|
2165
|
-
},
|
|
2166
|
-
},
|
|
2167
|
-
},
|
|
2168
|
-
}),
|
|
2169
|
-
)
|
|
2170
|
-
`,
|
|
2171
|
-
reporter: `import { defineConfig } from 'vite'
|
|
2172
|
-
import { declarationRollup, rewriteServerSpecifier } from '../helpers.js'
|
|
2173
|
-
import { resolveWorkspacePath, srcReporter } from '../../vite.config.ts'
|
|
2147
|
+
import { declarationRollup, resolveExternal, rewriteSourceSpecifier } from '../helpers.js'
|
|
2148
|
+
import { peers, resolveWorkspacePath, srcBin } from '../../vite.config.ts'
|
|
2174
2149
|
|
|
2175
|
-
//
|
|
2150
|
+
// One ES file per \`src/bin\` module. Rolldown strips a source shebang, so \`main\` alone takes
|
|
2151
|
+
// the \`#!/usr/bin/env node\` banner; every other module ships its rolled-up declaration.
|
|
2152
|
+
// \`output.paths\` and the declaration rewrite point each external \`@src/*\` specifier at the
|
|
2153
|
+
// built environment beside \`dist/bin/\`.
|
|
2176
2154
|
export default defineConfig(
|
|
2177
|
-
|
|
2155
|
+
srcBin({
|
|
2178
2156
|
plugins: [
|
|
2179
2157
|
declarationRollup({
|
|
2180
|
-
project: resolveWorkspacePath('configs/src/tsconfig.
|
|
2181
|
-
|
|
2158
|
+
project: resolveWorkspacePath('configs/src/tsconfig.bin.json'),
|
|
2159
|
+
entries: [{{modules}}],
|
|
2160
|
+
rewrite: rewriteSourceSpecifier,
|
|
2182
2161
|
}),
|
|
2183
2162
|
],
|
|
2184
2163
|
build: {
|
|
2185
2164
|
rolldownOptions: {
|
|
2165
|
+
external: (id: string) =>
|
|
2166
|
+
id.startsWith('@src/') || resolveExternal(id, { peers, refused: [], siblings: [] }),
|
|
2186
2167
|
output: {
|
|
2168
|
+
banner: (chunk) => (chunk.name === 'main' ? '#!/usr/bin/env node' : ''),
|
|
2187
2169
|
{{paths}}
|
|
2188
2170
|
},
|
|
2189
2171
|
},
|
|
@@ -2790,15 +2772,6 @@ describe('bin entry', () => {
|
|
|
2790
2772
|
expect(Object.keys(entry)).toStrictEqual([])
|
|
2791
2773
|
})
|
|
2792
2774
|
})
|
|
2793
|
-
`,
|
|
2794
|
-
reporter: `import { describe, expect, it } from 'vitest'
|
|
2795
|
-
import reporter from '../../../src/reporter/main.js'
|
|
2796
|
-
|
|
2797
|
-
describe('reporter entry', () => {
|
|
2798
|
-
it('exports the reporter class by default', () => {
|
|
2799
|
-
expect(reporter).toBeTypeOf('function')
|
|
2800
|
-
})
|
|
2801
|
-
})
|
|
2802
2775
|
`,
|
|
2803
2776
|
distribution: Object.freeze({
|
|
2804
2777
|
module: `{{types}}import type { SpawnSyncReturns } from 'node:child_process'
|
|
@@ -4020,13 +3993,7 @@ export function collectDistributionFiles(directory: string): readonly string[] {
|
|
|
4020
3993
|
*/
|
|
4021
3994
|
export function readDistributionFace(installed: string, path: string): string | undefined {
|
|
4022
3995
|
const [output, axis, face] = relativePath(installed, path).split(sep)
|
|
4023
|
-
return output === 'dist'
|
|
4024
|
-
? axis === 'src'
|
|
4025
|
-
? face
|
|
4026
|
-
: axis === 'bin' || axis === 'reporter'
|
|
4027
|
-
? axis
|
|
4028
|
-
: undefined
|
|
4029
|
-
: undefined
|
|
3996
|
+
return output === 'dist' ? (axis === 'src' ? face : axis === 'bin' ? axis : undefined) : undefined
|
|
4030
3997
|
}
|
|
4031
3998
|
|
|
4032
3999
|
/**
|
|
@@ -5064,6 +5031,29 @@ function isCollection(value) {
|
|
|
5064
5031
|
return (0, _orkestrel_contract.holds)(() => (0, _orkestrel_contract.isArray)(value) && value.length <= 1e3);
|
|
5065
5032
|
}
|
|
5066
5033
|
/**
|
|
5034
|
+
* Narrows a manifest `exports` value to a map of subpaths.
|
|
5035
|
+
*
|
|
5036
|
+
* @param value - The declared `exports` value.
|
|
5037
|
+
* @returns True if the value is an object whose every key opens with `.`; false otherwise.
|
|
5038
|
+
*
|
|
5039
|
+
* @remarks
|
|
5040
|
+
* Node reads a string, an array, or an object whose keys are conditions, such as `import` and
|
|
5041
|
+
* `require`, as the root export alone, and refuses an object that mixes conditions with subpaths,
|
|
5042
|
+
* so a subpath can be added only to a subpath map. A value whose keys cannot be read answers
|
|
5043
|
+
* `false`.
|
|
5044
|
+
*
|
|
5045
|
+
* @example
|
|
5046
|
+
* ```ts
|
|
5047
|
+
* import { isSubpathMap } from '@orkestrel/scaffold'
|
|
5048
|
+
*
|
|
5049
|
+
* isSubpathMap({ '.': './index.js' }) // true
|
|
5050
|
+
* isSubpathMap({ import: './index.js' }) // false
|
|
5051
|
+
* ```
|
|
5052
|
+
*/
|
|
5053
|
+
function isSubpathMap(value) {
|
|
5054
|
+
return (0, _orkestrel_contract.holds)(() => (0, _orkestrel_contract.isRecord)(value) && Object.keys(value).every((key) => key.startsWith(".")));
|
|
5055
|
+
}
|
|
5056
|
+
/**
|
|
5067
5057
|
* Narrows a value to one {@link Environment} a workspace may select.
|
|
5068
5058
|
*
|
|
5069
5059
|
* @example
|
|
@@ -5104,6 +5094,22 @@ function isSheetName(value) {
|
|
|
5104
5094
|
return (0, _orkestrel_contract.isString)(value) && value.length <= 203 && NAME_PATTERN.test(value) && !RESERVED_SHEET_NAMES.includes(value);
|
|
5105
5095
|
}
|
|
5106
5096
|
/**
|
|
5097
|
+
* Narrows a value to the stem of a `src/bin` module.
|
|
5098
|
+
* @param value - The candidate stem.
|
|
5099
|
+
* @returns True if the stem matches `BIN_MODULE_PATTERN` within the name length cap and names no
|
|
5100
|
+
* centralized file; false otherwise.
|
|
5101
|
+
* @example
|
|
5102
|
+
* ```ts
|
|
5103
|
+
* import { isBinModule } from '@orkestrel/scaffold'
|
|
5104
|
+
*
|
|
5105
|
+
* isBinModule('reporter') // true
|
|
5106
|
+
* isBinModule('helpers') // false
|
|
5107
|
+
* ```
|
|
5108
|
+
*/
|
|
5109
|
+
function isBinModule(value) {
|
|
5110
|
+
return (0, _orkestrel_contract.isString)(value) && value.length <= 203 && BIN_MODULE_PATTERN.test(value) && !CENTRAL_FILE_NAMES.includes(value);
|
|
5111
|
+
}
|
|
5112
|
+
/**
|
|
5107
5113
|
* Narrows a value to a supported browser framework with distinct occupied axes.
|
|
5108
5114
|
* @param value - The candidate extension.
|
|
5109
5115
|
* @returns True if the value is an admitted extension; false otherwise.
|
|
@@ -5295,8 +5301,7 @@ var isBlueprint = (0, _orkestrel_contract.recordOf)({
|
|
|
5295
5301
|
version: _orkestrel_contract.isString,
|
|
5296
5302
|
engines: _orkestrel_contract.isString,
|
|
5297
5303
|
overrides: (0, _orkestrel_contract.andOf)(isCollection, (0, _orkestrel_contract.arrayOf)(isOverride)),
|
|
5298
|
-
bin: _orkestrel_contract.
|
|
5299
|
-
reporter: _orkestrel_contract.isBoolean,
|
|
5304
|
+
bin: (0, _orkestrel_contract.andOf)(isCollection, (0, _orkestrel_contract.arrayOf)(_orkestrel_contract.isString)),
|
|
5300
5305
|
setup: (0, _orkestrel_contract.andOf)(isCollection, (0, _orkestrel_contract.arrayOf)((0, _orkestrel_contract.literalOf)("node", "browser"))),
|
|
5301
5306
|
guides: _orkestrel_contract.isBoolean,
|
|
5302
5307
|
integration: _orkestrel_contract.isBoolean,
|
|
@@ -6906,6 +6911,106 @@ function manifestToDependencies(manifest) {
|
|
|
6906
6911
|
};
|
|
6907
6912
|
}
|
|
6908
6913
|
/**
|
|
6914
|
+
* Projects a package manifest's text to the planned `bin`, `files`, and `exports` entries it lacks.
|
|
6915
|
+
*
|
|
6916
|
+
* @param manifest - The `package.json` text.
|
|
6917
|
+
* @param planned - The entries the plan emits.
|
|
6918
|
+
* @returns The planned entries the manifest does not declare, each in planned order.
|
|
6919
|
+
*
|
|
6920
|
+
* @remarks
|
|
6921
|
+
* A planned command counts as declared when the manifest names it, or when any declared command
|
|
6922
|
+
* runs the planned file: a package keeps the command name it publishes. A string `bin` declares
|
|
6923
|
+
* the planned command when it names the planned file. A planned packed path counts as declared
|
|
6924
|
+
* when a declared path equals it or names a directory above it, as {@link matchesPackedPath} reads
|
|
6925
|
+
* the pair. A subpath counts as declared by name alone, so a declared entry holding another value
|
|
6926
|
+
* stays the package's. A string `exports`, a fallback array, or an object whose keys are conditions
|
|
6927
|
+
* rather than subpaths declares the root subpath `.` alone, as Node reads each. A section holding any other shape declares none of
|
|
6928
|
+
* its planned entries. A manifest that is not an object lacks nothing, because no entry can be read
|
|
6929
|
+
* from it or written into it.
|
|
6930
|
+
*
|
|
6931
|
+
* @example
|
|
6932
|
+
* ```ts
|
|
6933
|
+
* import { manifestToEntries } from '@orkestrel/scaffold'
|
|
6934
|
+
*
|
|
6935
|
+
* manifestToEntries('{"files": ["dist/src"]}', {
|
|
6936
|
+
* bin: {},
|
|
6937
|
+
* files: ['dist/src', 'dist/bin'],
|
|
6938
|
+
* exports: {},
|
|
6939
|
+
* }).files // ['dist/bin']
|
|
6940
|
+
* ```
|
|
6941
|
+
*/
|
|
6942
|
+
function manifestToEntries(manifest, planned) {
|
|
6943
|
+
const parsed = (0, _orkestrel_contract.parseJSON)(manifest);
|
|
6944
|
+
if (!(0, _orkestrel_contract.isRecord)(parsed)) return {
|
|
6945
|
+
bin: {},
|
|
6946
|
+
files: [],
|
|
6947
|
+
exports: {}
|
|
6948
|
+
};
|
|
6949
|
+
const { bin, files, exports } = parsed;
|
|
6950
|
+
const commands = (0, _orkestrel_contract.isString)(bin) ? { "": bin } : (0, _orkestrel_contract.isRecord)(bin) ? bin : {};
|
|
6951
|
+
const runs = Object.values(commands).flatMap((path) => (0, _orkestrel_contract.isString)(path) ? [normalizePackagePath(path)] : []);
|
|
6952
|
+
const packed = (0, _orkestrel_contract.isArray)(files) ? files.filter(_orkestrel_contract.isString) : [];
|
|
6953
|
+
const subpaths = isSubpathMap(exports) ? exports : (0, _orkestrel_contract.isString)(exports) || (0, _orkestrel_contract.isArray)(exports) || (0, _orkestrel_contract.isRecord)(exports) ? { ".": exports } : {};
|
|
6954
|
+
return {
|
|
6955
|
+
bin: Object.fromEntries(Object.entries(planned.bin).filter(([name, path]) => !((0, _orkestrel_contract.isRecord)(bin) && Object.hasOwn(bin, name)) && !runs.includes(normalizePackagePath(path)))),
|
|
6956
|
+
files: planned.files.filter((path) => !packed.some((declared) => matchesPackedPath(declared, path))),
|
|
6957
|
+
exports: Object.fromEntries(Object.entries(planned.exports).filter(([path]) => !Object.hasOwn(subpaths, path)))
|
|
6958
|
+
};
|
|
6959
|
+
}
|
|
6960
|
+
/**
|
|
6961
|
+
* Returns the canonical form of a path a manifest names inside its package.
|
|
6962
|
+
*
|
|
6963
|
+
* @param path - A `bin` target or a `files` entry.
|
|
6964
|
+
* @returns The path with `/` for every backslash, one `/` for every run of separators, and no
|
|
6965
|
+
* leading `./` or trailing `/`.
|
|
6966
|
+
*
|
|
6967
|
+
* @remarks
|
|
6968
|
+
* npm reads a backslash in a `bin` or `files` path as a separator and collapses repeated
|
|
6969
|
+
* separators, so `dist\bin\main.js` and `dist//bin/main.js` name `dist/bin/main.js`.
|
|
6970
|
+
*
|
|
6971
|
+
* @example
|
|
6972
|
+
* ```ts
|
|
6973
|
+
* import { normalizePackagePath } from '@orkestrel/scaffold'
|
|
6974
|
+
*
|
|
6975
|
+
* normalizePackagePath('./dist/bin/main.js') // 'dist/bin/main.js'
|
|
6976
|
+
* normalizePackagePath('dist//bin/main.js') // 'dist/bin/main.js'
|
|
6977
|
+
* ```
|
|
6978
|
+
*/
|
|
6979
|
+
function normalizePackagePath(path) {
|
|
6980
|
+
return path.replaceAll("\\", "/").replace(/\/{2,}/gu, "/").replace(/^(\.\/)+/u, "").replace(/\/+$/u, "");
|
|
6981
|
+
}
|
|
6982
|
+
/**
|
|
6983
|
+
* Checks whether a declared `files` entry packs a planned one.
|
|
6984
|
+
*
|
|
6985
|
+
* @param declared - The entry the manifest declares.
|
|
6986
|
+
* @param planned - The entry the plan emits.
|
|
6987
|
+
* @returns True if the entries are equal, or the declared entry names a directory whose path
|
|
6988
|
+
* segments open the planned entry's; false otherwise.
|
|
6989
|
+
*
|
|
6990
|
+
* @remarks
|
|
6991
|
+
* A declared entry ending in `/**` or `/*` packs the directory it names, so `dist/**` packs
|
|
6992
|
+
* `dist/app`. No other glob is read: an entry such as `dist/*.js` packs no planned path it does not
|
|
6993
|
+
* equal. A negated entry such as `!dist/src/styles/index.js` excludes a path rather than packing
|
|
6994
|
+
* one, so only an equal entry declares it.
|
|
6995
|
+
*
|
|
6996
|
+
* @example
|
|
6997
|
+
* ```ts
|
|
6998
|
+
* import { matchesPackedPath } from '@orkestrel/scaffold'
|
|
6999
|
+
*
|
|
7000
|
+
* matchesPackedPath('dist', 'dist/app') // true
|
|
7001
|
+
* matchesPackedPath('dist-old', 'dist/app') // false
|
|
7002
|
+
* ```
|
|
7003
|
+
*/
|
|
7004
|
+
function matchesPackedPath(declared, planned) {
|
|
7005
|
+
const left = normalizePackagePath(declared).replace(/\/\*\*?$/u, "");
|
|
7006
|
+
const right = normalizePackagePath(planned);
|
|
7007
|
+
if (left === right) return true;
|
|
7008
|
+
if (left.startsWith("!") || right.startsWith("!") || left === "") return false;
|
|
7009
|
+
const segments = left.split("/");
|
|
7010
|
+
const target = right.split("/");
|
|
7011
|
+
return segments.length < target.length && segments.every((segment, index) => segment === target[index]);
|
|
7012
|
+
}
|
|
7013
|
+
/**
|
|
6909
7014
|
* Renders the `SKILL.md` pointer a target carries in place of a canonical skill.
|
|
6910
7015
|
*
|
|
6911
7016
|
* @param canonical - The canonical `SKILL.md` text, which opens with a frontmatter block.
|
|
@@ -7016,10 +7121,10 @@ function blueprintToSheets(blueprint) {
|
|
|
7016
7121
|
return [...blueprint.styles ? ["styles"] : [], ...(0, _orkestrel_contract.sortValues)(blueprint.extensions.flatMap((extension) => extension.surface === "styles" && isSheetName(extension.name) ? [extension.name] : []))];
|
|
7017
7122
|
}
|
|
7018
7123
|
/**
|
|
7019
|
-
* Projects published environments, sheets, and
|
|
7124
|
+
* Projects published environments, sheets, and `src/bin` modules into the manifest export map.
|
|
7020
7125
|
* @param blueprint - The workspace specification.
|
|
7021
|
-
* @returns JavaScript conditions, CSS and SCSS subpaths, and the ES-only
|
|
7022
|
-
* without an invented JavaScript root.
|
|
7126
|
+
* @returns JavaScript conditions, CSS and SCSS subpaths, and the ES-only `./<name>` subpath of
|
|
7127
|
+
* each `src/bin` module other than `main`, without an invented JavaScript root.
|
|
7023
7128
|
* @example
|
|
7024
7129
|
* ```ts
|
|
7025
7130
|
* import { blueprintToExports, createBlueprint } from '@orkestrel/scaffold'
|
|
@@ -7036,7 +7141,7 @@ function blueprintToExports(blueprint) {
|
|
|
7036
7141
|
return blueprint.src.includes("browser") ? [face, ["./browser", pathToCondition("./dist/src/browser/index", ["es"])]] : [face];
|
|
7037
7142
|
})),
|
|
7038
7143
|
...Object.fromEntries([...blueprintToSheets(blueprint), ...blueprint.themes ? ["styles/themes"] : []].flatMap((name) => [[`./${name}`, `./dist/src/${name}/index.css`], [`./${name}/scss`, `./src/${name}/index.scss`]])),
|
|
7039
|
-
...blueprint.
|
|
7144
|
+
...Object.fromEntries(blueprint.bin.flatMap((name) => name === "main" ? [] : [[`./${name}`, pathToCondition(`./dist/bin/${name}`, ["es"])]]))
|
|
7040
7145
|
};
|
|
7041
7146
|
return Object.keys(exported).length > 0 ? {
|
|
7042
7147
|
...exported,
|
|
@@ -7210,7 +7315,7 @@ function blueprintToDevDependencies(blueprint) {
|
|
|
7210
7315
|
...rendered && !BROWSE_UPSTREAM.includes(own) ? BROWSE_DEV_DEPENDENCIES : {},
|
|
7211
7316
|
...blueprint.journey && blueprint.app.includes("browser") && (blueprint.base || blueprintToFaces(blueprint).some((extension) => extension.axes.includes("app"))) && !CAPTURE_UPSTREAM.includes(own) ? CAPTURE_DEV_DEPENDENCIES : {},
|
|
7212
7317
|
...sheets ? STYLES_DEV_DEPENDENCIES : {},
|
|
7213
|
-
...blueprint.src.length > 0 || blueprint.bin
|
|
7318
|
+
...blueprint.src.length > 0 || blueprint.bin.length > 0 ? DECLARATION_DEV_DEPENDENCIES : {},
|
|
7214
7319
|
...blueprint.src.includes("browser") || blueprint.setup.includes("browser") || sheets ? SOURCE_BROWSER_DEV_DEPENDENCIES : {},
|
|
7215
7320
|
...blueprint.app.includes("browser") ? APP_BROWSER_DEV_DEPENDENCIES : {},
|
|
7216
7321
|
...blueprint.app.includes("server") ? APP_SERVER_DEV_DEPENDENCIES : {},
|
|
@@ -7403,7 +7508,7 @@ function blueprintToScripts(blueprint) {
|
|
|
7403
7508
|
const checker = application.includes("vue") ? FRAMEWORK_MATRIX.vue.checker : "tsc";
|
|
7404
7509
|
const publishes = blueprint.src.length > 0 || targets.length > 0;
|
|
7405
7510
|
const integrates = blueprint.integration;
|
|
7406
|
-
const compiles = publishes || blueprint.bin
|
|
7511
|
+
const compiles = publishes || blueprint.bin.length > 0;
|
|
7407
7512
|
const runtime = blueprint.app.filter((environment) => environment !== "core" && (environment !== "browser" || base));
|
|
7408
7513
|
const vitest = "vitest run --config vite.config.ts --no-cache --reporter=dot";
|
|
7409
7514
|
const built = [...runtime, ...application].flatMap((environment) => environment === "server" && matchesBarrel(blueprint) ? [environment, "barrel"] : [environment]);
|
|
@@ -7411,8 +7516,7 @@ function blueprintToScripts(blueprint) {
|
|
|
7411
7516
|
...blueprint.src,
|
|
7412
7517
|
...source,
|
|
7413
7518
|
...sheets,
|
|
7414
|
-
...blueprint.bin ? ["bin"] : []
|
|
7415
|
-
...blueprint.reporter ? ["reporter"] : []
|
|
7519
|
+
...blueprint.bin.length > 0 ? ["bin"] : []
|
|
7416
7520
|
].map((name) => `npm run check:src:${name}`);
|
|
7417
7521
|
const journey = `vitest run --config ${JOURNEY_CONFIG_PATH} --no-cache --reporter=dot`;
|
|
7418
7522
|
const showcase = `vite --config ${SHOWCASE_CONFIG_PATH}`;
|
|
@@ -7433,8 +7537,7 @@ function blueprintToScripts(blueprint) {
|
|
|
7433
7537
|
...checks.length > 0 ? {
|
|
7434
7538
|
"check:src": checks.join(" && "),
|
|
7435
7539
|
...Object.fromEntries(Iterator.from(blueprint.src).map((environment) => [`check:src:${environment}`, `tsc --noEmit -p configs/src/tsconfig.${environment}.json`]).toArray()),
|
|
7436
|
-
...blueprint.bin ? { "check:src:bin": "tsc --noEmit -p configs/src/tsconfig.bin.json" } : {},
|
|
7437
|
-
...blueprint.reporter ? { "check:src:reporter": "tsc --noEmit -p configs/src/tsconfig.reporter.json" } : {},
|
|
7540
|
+
...blueprint.bin.length > 0 ? { "check:src:bin": "tsc --noEmit -p configs/src/tsconfig.bin.json" } : {},
|
|
7438
7541
|
...Object.fromEntries([...sheets, ...source].map((name) => [`check:src:${name}`, `tsc --noEmit -p configs/src/tsconfig.${name}.json`]))
|
|
7439
7542
|
} : {},
|
|
7440
7543
|
...blueprint.app.length > 0 ? {
|
|
@@ -7459,16 +7562,14 @@ function blueprintToScripts(blueprint) {
|
|
|
7459
7562
|
...!publishes && blueprint.service ? ["npm run test:service"] : []
|
|
7460
7563
|
].join(" && "),
|
|
7461
7564
|
...compiles ? {
|
|
7462
|
-
"test:src": [...blueprint.src.length > 0 || blueprint.bin
|
|
7565
|
+
"test:src": [...blueprint.src.length > 0 || blueprint.bin.length > 0 ? [[
|
|
7463
7566
|
vitest,
|
|
7464
7567
|
...blueprint.src.map((environment) => `--project ${SRC_MATRIX[environment].project}`),
|
|
7465
7568
|
...source.map((name) => `--project src:${name}`),
|
|
7466
|
-
...blueprint.bin ? ["--project src:bin"] : []
|
|
7467
|
-
...blueprint.reporter ? ["--project src:reporter"] : []
|
|
7569
|
+
...blueprint.bin.length > 0 ? ["--project src:bin"] : []
|
|
7468
7570
|
].join(" ")] : [], ...targets.map((name) => `npm run test:src:${name}`)].join(" && "),
|
|
7469
7571
|
...Object.fromEntries(Iterator.from(blueprint.src).map((environment) => [`test:src:${environment}`, `${vitest} --project ${SRC_MATRIX[environment].project}`]).toArray()),
|
|
7470
|
-
...blueprint.bin ? { "test:src:bin": `${vitest} --project src:bin` } : {},
|
|
7471
|
-
...blueprint.reporter ? { "test:src:reporter": `${vitest} --project src:reporter` } : {},
|
|
7572
|
+
...blueprint.bin.length > 0 ? { "test:src:bin": `${vitest} --project src:bin` } : {},
|
|
7472
7573
|
...Object.fromEntries(source.map((name) => [`test:src:${name}`, `${vitest} --project src:${name}`])),
|
|
7473
7574
|
...Object.fromEntries(targets.map((name) => [`test:src:${name}`, `npm run build:src:${name} && ${vitest} --project src:${name}`]))
|
|
7474
7575
|
} : {},
|
|
@@ -7515,12 +7616,10 @@ function blueprintToScripts(blueprint) {
|
|
|
7515
7616
|
...blueprint.src.map((environment) => `npm run build:src:${environment}`),
|
|
7516
7617
|
...source.map((name) => `npm run build:src:${name}`),
|
|
7517
7618
|
...targets.map((name) => `npm run build:src:${name}`),
|
|
7518
|
-
...blueprint.bin ? ["npm run build:src:bin"] : []
|
|
7519
|
-
...blueprint.reporter ? ["npm run build:src:reporter"] : []
|
|
7619
|
+
...blueprint.bin.length > 0 ? ["npm run build:src:bin"] : []
|
|
7520
7620
|
].join(" && "),
|
|
7521
7621
|
...Object.fromEntries(Iterator.from(blueprint.src).map((environment) => [`build:src:${environment}`, SRC_MATRIX[environment].formats.includes("cjs") ? `vite build --config configs/src/vite.${environment}.config.ts && npm run copy dist/src/${environment}/index.d.ts dist/src/${environment}/index.d.cts` : `vite build --config configs/src/vite.${environment}.config.ts`]).toArray()),
|
|
7522
|
-
...blueprint.bin ? { "build:src:bin": "vite build --config configs/src/vite.bin.config.ts" } : {},
|
|
7523
|
-
...blueprint.reporter ? { "build:src:reporter": "vite build --config configs/src/vite.reporter.config.ts" } : {},
|
|
7622
|
+
...blueprint.bin.length > 0 ? { "build:src:bin": "vite build --config configs/src/vite.bin.config.ts" } : {},
|
|
7524
7623
|
...Object.fromEntries(source.map((name) => [`build:src:${name}`, `vite build --config configs/src/vite.${name}.config.ts`])),
|
|
7525
7624
|
...Object.fromEntries(targets.map((name) => [`build:src:${name}`, [`vite build --config configs/src/vite.${name}.config.ts`, ...name === "styles" && blueprint.themes ? ["vite build --config configs/src/vite.themes.config.ts"] : []].join(" && ")]))
|
|
7526
7625
|
} : {},
|
|
@@ -7564,7 +7663,8 @@ function blueprintToScripts(blueprint) {
|
|
|
7564
7663
|
* benchmark workbench scripts. A workspace carrying guides adds `test:guides`,
|
|
7565
7664
|
* whose package-owned entry runs the guides project and handles explicit parity
|
|
7566
7665
|
* rewrites, and one carrying skills adds `test:skills`. Publishing adds the pack and publication
|
|
7567
|
-
* lifecycle scripts.
|
|
7666
|
+
* lifecycle scripts. Library environments, sheet faces, framework faces, and `src/bin` modules
|
|
7667
|
+
* add their check and build scripts, application
|
|
7568
7668
|
* frameworks add dev scripts, and selected showcases and journeys add their mode scripts.
|
|
7569
7669
|
* A base browser application's journey axis also adds `journey` and `capture`, and each
|
|
7570
7670
|
* app-side browser face adds `journey:<name>` and `capture:<name>`. Their generated
|
|
@@ -7593,7 +7693,7 @@ function blueprintToScripts(blueprint) {
|
|
|
7593
7693
|
*
|
|
7594
7694
|
* const blueprint = createBlueprint('router', { src: ['core'] })
|
|
7595
7695
|
*
|
|
7596
|
-
* blueprintToWritableScripts(blueprint)[0]?.name // '
|
|
7696
|
+
* blueprintToWritableScripts(blueprint)[0]?.name // 'check:src:core'
|
|
7597
7697
|
* ```
|
|
7598
7698
|
*/
|
|
7599
7699
|
function blueprintToWritableScripts(blueprint) {
|
|
@@ -7602,12 +7702,13 @@ function blueprintToWritableScripts(blueprint) {
|
|
|
7602
7702
|
const body = Object.entries(scripts).flatMap(([name, command]) => {
|
|
7603
7703
|
const direct = name.startsWith("test:") && name !== "test:src" && name !== "test:app";
|
|
7604
7704
|
const sheet = sheets.some((face) => name === `build:src:${face}` || name === `check:src:${face}`);
|
|
7705
|
+
const entry = [...blueprint.src, "bin"].some((face) => name === `build:src:${face}` || name === `check:src:${face}`);
|
|
7605
7706
|
const framework = blueprintToFaces(blueprint).some((extension) => extension.surface === "browser" && extension.axes.some((axis) => name === `check:${axis}:${extension.name}` || name === `build:${axis}:${extension.name}` || axis === "app" && (name === `dev:${extension.name}` || name === `journey:${extension.name}` || name === `capture:${extension.name}`)));
|
|
7606
7707
|
const showcase = name === "showcase" || name.startsWith("showcase:") || name === "build:showcase" || name.startsWith("build:showcase:");
|
|
7607
7708
|
const capture = name === "journey" || name === "capture";
|
|
7608
7709
|
const barrel = matchesBarrel(blueprint) && name === "build:app:barrel";
|
|
7609
7710
|
const served = blueprint.app.includes("server") && name === "serve:build";
|
|
7610
|
-
if (!direct && !sheet && !framework && !showcase && !capture && !barrel && !served) return [];
|
|
7711
|
+
if (!direct && !sheet && !entry && !framework && !showcase && !capture && !barrel && !served) return [];
|
|
7611
7712
|
return [{
|
|
7612
7713
|
name,
|
|
7613
7714
|
command,
|
|
@@ -7632,6 +7733,45 @@ function blueprintToWritableScripts(blueprint) {
|
|
|
7632
7733
|
];
|
|
7633
7734
|
}
|
|
7634
7735
|
/**
|
|
7736
|
+
* Projects a blueprint into the `bin`, `files`, and `exports` entries its manifest carries.
|
|
7737
|
+
*
|
|
7738
|
+
* @param blueprint - The workspace specification.
|
|
7739
|
+
* @returns The planned commands, packed paths, and subpaths, each in the order the manifest emits.
|
|
7740
|
+
*
|
|
7741
|
+
* @remarks
|
|
7742
|
+
* A workspace without an executable plans no command, and one publishing nothing plans no
|
|
7743
|
+
* subpath, because its manifest carries no `exports` map. `dist/src` is packed only where a
|
|
7744
|
+
* library environment or a sheet builds into it: an executable reaches `dist/src` only through
|
|
7745
|
+
* the `@src/*` specifiers its build rewrites, one per library environment, so an executable
|
|
7746
|
+
* beside no library environment bundles what it imports and packs `dist/bin` alone. A workspace
|
|
7747
|
+
* publishing nothing packs `dist/app` when it builds an application.
|
|
7748
|
+
*
|
|
7749
|
+
* @example
|
|
7750
|
+
* ```ts
|
|
7751
|
+
* import { blueprintToEntries, createBlueprint } from '@orkestrel/scaffold'
|
|
7752
|
+
*
|
|
7753
|
+
* blueprintToEntries(createBlueprint('router', { src: ['core'], bin: ['main'] })).files
|
|
7754
|
+
* // ['dist/src', 'dist/bin', 'README.md']
|
|
7755
|
+
* ```
|
|
7756
|
+
*/
|
|
7757
|
+
function blueprintToEntries(blueprint) {
|
|
7758
|
+
const sheets = blueprintToSheets(blueprint);
|
|
7759
|
+
const targets = [...sheets, ...blueprint.themes ? ["styles/themes"] : []];
|
|
7760
|
+
const publishes = blueprint.src.length > 0 || targets.length > 0;
|
|
7761
|
+
return {
|
|
7762
|
+
bin: blueprint.bin.includes("main") ? { [blueprint.name]: BIN_OUTPUT_PATH } : {},
|
|
7763
|
+
files: [
|
|
7764
|
+
...publishes ? ["dist/src"] : blueprint.app.length > 0 ? ["dist/app"] : [],
|
|
7765
|
+
...blueprint.bin.length > 0 ? ["dist/bin"] : [],
|
|
7766
|
+
...targets.map((face) => `!dist/src/${face}/index.js`),
|
|
7767
|
+
...sheets.map((face) => `src/${face}/**/*.scss`),
|
|
7768
|
+
...blueprint.themes && !blueprint.styles ? ["src/styles/themes/**/*.scss"] : [],
|
|
7769
|
+
"README.md"
|
|
7770
|
+
],
|
|
7771
|
+
exports: publishes ? blueprintToExports(blueprint) : {}
|
|
7772
|
+
};
|
|
7773
|
+
}
|
|
7774
|
+
/**
|
|
7635
7775
|
* Compiles a blueprint into its `package.json` content.
|
|
7636
7776
|
*
|
|
7637
7777
|
* @param blueprint - The workspace specification.
|
|
@@ -7667,8 +7807,7 @@ function blueprintToWritableScripts(blueprint) {
|
|
|
7667
7807
|
* ```
|
|
7668
7808
|
*/
|
|
7669
7809
|
function blueprintToManifest(blueprint) {
|
|
7670
|
-
const
|
|
7671
|
-
const targets = [...sheets, ...blueprint.themes ? ["styles/themes"] : []];
|
|
7810
|
+
const targets = [...blueprintToSheets(blueprint), ...blueprint.themes ? ["styles/themes"] : []];
|
|
7672
7811
|
const publishes = blueprint.src.length > 0 || targets.length > 0;
|
|
7673
7812
|
const name = publishes ? `@orkestrel/${blueprint.name}` : blueprint.name;
|
|
7674
7813
|
const dependencies = Object.fromEntries(blueprint.dependencies.toSorted((left, right) => (0, _orkestrel_contract.comparePrimitives)(left.name, right.name)).map((dependency) => [dependency.name, dependency.range]));
|
|
@@ -7676,6 +7815,7 @@ function blueprintToManifest(blueprint) {
|
|
|
7676
7815
|
const peerDependencies = Object.fromEntries(peers.map((peer) => [peer.name, peer.range]));
|
|
7677
7816
|
const peerDependenciesMeta = Object.fromEntries(peers.filter((peer) => peer.optional === true).map((peer) => [peer.name, { optional: true }]));
|
|
7678
7817
|
const entry = srcToEntry(blueprint.src);
|
|
7818
|
+
const entries = blueprintToEntries(blueprint);
|
|
7679
7819
|
const manifest = {
|
|
7680
7820
|
name,
|
|
7681
7821
|
version: blueprint.version,
|
|
@@ -7691,21 +7831,13 @@ function blueprintToManifest(blueprint) {
|
|
|
7691
7831
|
type: "git",
|
|
7692
7832
|
url: `git+https://github.com/orkestrel/${blueprint.name}.git`
|
|
7693
7833
|
} } : {},
|
|
7694
|
-
...blueprint.bin ? { bin:
|
|
7695
|
-
files:
|
|
7696
|
-
blueprint.bin || publishes ? "dist/src" : "dist/app",
|
|
7697
|
-
...blueprint.bin ? ["dist/bin"] : [],
|
|
7698
|
-
...blueprint.reporter ? ["dist/reporter"] : [],
|
|
7699
|
-
...targets.map((face) => `!dist/src/${face}/index.js`),
|
|
7700
|
-
...sheets.map((face) => `src/${face}/**/*.scss`),
|
|
7701
|
-
...blueprint.themes && !blueprint.styles ? ["src/styles/themes/**/*.scss"] : [],
|
|
7702
|
-
"README.md"
|
|
7703
|
-
],
|
|
7834
|
+
...blueprint.bin.includes("main") ? { bin: entries.bin } : {},
|
|
7835
|
+
files: entries.files,
|
|
7704
7836
|
type: "module",
|
|
7705
7837
|
...publishes ? {
|
|
7706
|
-
sideEffects: targets.length > 0 || blueprint.bin ? [...targets.length > 0 ? ["**/*.css", "**/*.scss"] : [], ...blueprint.bin ? [`./${BIN_ENTRY_PATH}`, `./${BIN_OUTPUT_PATH}`] : []] : false,
|
|
7838
|
+
sideEffects: targets.length > 0 || blueprint.bin.includes("main") ? [...targets.length > 0 ? ["**/*.css", "**/*.scss"] : [], ...blueprint.bin.includes("main") ? [`./${BIN_ENTRY_PATH}`, `./${BIN_OUTPUT_PATH}`] : []] : false,
|
|
7707
7839
|
...blueprint.src.length > 0 ? entry : {},
|
|
7708
|
-
exports:
|
|
7840
|
+
exports: entries.exports,
|
|
7709
7841
|
publishConfig: { access: "public" }
|
|
7710
7842
|
} : {},
|
|
7711
7843
|
scripts: blueprintToScripts(blueprint),
|
|
@@ -7752,7 +7884,7 @@ function blueprintToMachinery(blueprint) {
|
|
|
7752
7884
|
return {
|
|
7753
7885
|
browser: blueprint.src.includes("browser") || blueprint.app.includes("browser") || blueprint.setup.includes("browser") || blueprintToSheets(blueprint).length > 0 || blueprint.themes || frameworks.length > 0,
|
|
7754
7886
|
frameworks,
|
|
7755
|
-
output: blueprint.src.length > 0 || blueprint.bin
|
|
7887
|
+
output: blueprint.src.length > 0 || blueprint.bin.length > 0 || hosted || blueprintToSheets(blueprint).length > 0 || blueprint.themes,
|
|
7756
7888
|
showcase: blueprint.showcase && (blueprint.base && blueprint.app.includes("browser") || blueprintToFaces(blueprint).some((extension) => extension.axes.includes("app")))
|
|
7757
7889
|
};
|
|
7758
7890
|
}
|
|
@@ -7849,8 +7981,7 @@ function blueprintToProjects(blueprint) {
|
|
|
7849
7981
|
...AXES.flatMap((axis) => [
|
|
7850
7982
|
...ENVIRONMENTS.filter((environment) => (axis !== "app" || environment !== "server") && blueprint[axis].includes(environment)).map((environment) => `${axis}:${environment}`),
|
|
7851
7983
|
...faces.filter((face) => face.axes.includes(axis)).map((face) => `${axis}:${face.name}`),
|
|
7852
|
-
...axis === "src" && blueprint.bin ? ["src:bin"] : [],
|
|
7853
|
-
...axis === "src" && blueprint.reporter ? ["src:reporter"] : [],
|
|
7984
|
+
...axis === "src" && blueprint.bin.length > 0 ? ["src:bin"] : [],
|
|
7854
7985
|
...axis === "app" && blueprint.app.includes("server") ? ["app:server"] : []
|
|
7855
7986
|
]),
|
|
7856
7987
|
"policy",
|
|
@@ -7980,8 +8111,7 @@ function blueprintToRootVite(blueprint) {
|
|
|
7980
8111
|
exclude: core ? " exclude: ['tests/src/core/**/*.test.ts'],\n" : ""
|
|
7981
8112
|
})) : [],
|
|
7982
8113
|
...planned.has("src:vue") ? [CONFIG_TEMPLATES.factories.src.vue] : [],
|
|
7983
|
-
...planned.has("src:bin") ? [CONFIG_TEMPLATES.factories.src.bin] : [],
|
|
7984
|
-
...planned.has("src:reporter") ? [CONFIG_TEMPLATES.factories.src.reporter] : [],
|
|
8114
|
+
...planned.has("src:bin") ? [(0, _orkestrel_template.fillTemplate)(CONFIG_TEMPLATES.factories.src.bin, { entries: blueprint.bin.map((name) => `\t\t\t\t\t${name}: resolveWorkspacePath(${serializeTypeScriptString(`src/bin/${name}.ts`)}),`).join("\n") })] : [],
|
|
7985
8115
|
...planned.has("app:core") ? [CONFIG_TEMPLATES.factories.app.core] : [],
|
|
7986
8116
|
...planned.has("app:browser") ? [(0, _orkestrel_template.fillTemplate)(CONFIG_TEMPLATES.factories.app.browser, {
|
|
7987
8117
|
vuePlugin: machinery.frameworks.includes("vue") ? ", vue()" : "",
|
|
@@ -8017,7 +8147,6 @@ function blueprintToRootVite(blueprint) {
|
|
|
8017
8147
|
...planned.has("src:server") ? ["srcServer"] : [],
|
|
8018
8148
|
...planned.has("src:vue") ? ["srcVue"] : [],
|
|
8019
8149
|
...planned.has("src:bin") ? ["srcBin"] : [],
|
|
8020
|
-
...planned.has("src:reporter") ? ["srcReporter"] : [],
|
|
8021
8150
|
...planned.has("app:core") ? ["appCore"] : [],
|
|
8022
8151
|
...planned.has("app:browser") ? ["appBrowser"] : [],
|
|
8023
8152
|
...planned.has("app:vue") ? ["appVue"] : [],
|
|
@@ -8131,23 +8260,19 @@ function blueprintToConfigArtifacts(blueprint) {
|
|
|
8131
8260
|
environment,
|
|
8132
8261
|
content: path === "configs/src/tsconfig.core.json" ? CONFIG_TEMPLATES.tsconfigs.src.core : path === "configs/src/vite.browser.config.ts" ? CONFIG_TEMPLATES.vites.src.browser : path === "configs/src/tsconfig.browser.json" ? CONFIG_TEMPLATES.tsconfigs.src.browser : path === "configs/src/vite.server.config.ts" ? CONFIG_TEMPLATES.vites.src.server : path === "configs/src/tsconfig.server.json" ? CONFIG_TEMPLATES.tsconfigs.src.server : CONFIG_TEMPLATES.vites.src.core
|
|
8133
8262
|
}))).toArray();
|
|
8134
|
-
const paths = blueprint.bin
|
|
8263
|
+
const paths = blueprint.bin.length > 0 ? blueprint.src.map((environment) => `\t\t\t\t\t\t'@src/${environment}': '../src/${environment}/index.js',`) : [];
|
|
8135
8264
|
const renderedPaths = paths.length === 0 ? " paths: {}," : `\t\t\t\t\tpaths: {
|
|
8136
8265
|
${paths.join("\n")}
|
|
8137
8266
|
},`;
|
|
8138
|
-
const bins = blueprint.bin ? BIN_CONFIGS.map((path) => ({
|
|
8267
|
+
const bins = blueprint.bin.length > 0 ? BIN_CONFIGS.map((path) => ({
|
|
8139
8268
|
path,
|
|
8140
8269
|
group: "configs",
|
|
8141
8270
|
ownership: "content",
|
|
8142
8271
|
origin: "template",
|
|
8143
|
-
content: path === "configs/src/tsconfig.bin.json" ? CONFIG_TEMPLATES.tsconfigs.bin : (0, _orkestrel_template.fillTemplate)(CONFIG_TEMPLATES.vites.bin, {
|
|
8144
|
-
|
|
8145
|
-
|
|
8146
|
-
|
|
8147
|
-
group: "configs",
|
|
8148
|
-
ownership: "content",
|
|
8149
|
-
origin: "template",
|
|
8150
|
-
content: path === "configs/src/tsconfig.reporter.json" ? CONFIG_TEMPLATES.tsconfigs.reporter : (0, _orkestrel_template.fillTemplate)(CONFIG_TEMPLATES.vites.reporter, { paths: renderedPaths })
|
|
8272
|
+
content: path === "configs/src/tsconfig.bin.json" ? CONFIG_TEMPLATES.tsconfigs.bin : (0, _orkestrel_template.fillTemplate)(CONFIG_TEMPLATES.vites.bin, {
|
|
8273
|
+
modules: blueprint.bin.filter((name) => name !== "main").map((name) => serializeTypeScriptString(name)).join(", "),
|
|
8274
|
+
paths: renderedPaths
|
|
8275
|
+
})
|
|
8151
8276
|
})) : [];
|
|
8152
8277
|
const barrels = matchesBarrel(blueprint) ? BARREL_CONFIGS.map((path) => ({
|
|
8153
8278
|
path,
|
|
@@ -8261,7 +8386,6 @@ ${paths.join("\n")}
|
|
|
8261
8386
|
...sheets,
|
|
8262
8387
|
...sources,
|
|
8263
8388
|
...bins,
|
|
8264
|
-
...reporters,
|
|
8265
8389
|
...applications,
|
|
8266
8390
|
...barrels,
|
|
8267
8391
|
...faces,
|
|
@@ -8374,7 +8498,7 @@ function blueprintToSourceArtifacts(blueprint) {
|
|
|
8374
8498
|
}))
|
|
8375
8499
|
] : [barrel];
|
|
8376
8500
|
}));
|
|
8377
|
-
const bin = blueprint.bin ? [{
|
|
8501
|
+
const bin = blueprint.bin.includes("main") ? [{
|
|
8378
8502
|
path: BIN_ENTRY_PATH,
|
|
8379
8503
|
group: "source",
|
|
8380
8504
|
ownership: "birth",
|
|
@@ -8473,7 +8597,7 @@ function blueprintToTestArtifacts(blueprint) {
|
|
|
8473
8597
|
environment: "browser",
|
|
8474
8598
|
content: blueprint.journey ? ARTIFACT_TEMPLATES.tests.browser : ARTIFACT_TEMPLATES.tests.setup
|
|
8475
8599
|
}] : [];
|
|
8476
|
-
const servers = blueprint.src.includes("server") || blueprint.app.includes("server") || blueprint.bin
|
|
8600
|
+
const servers = blueprint.src.includes("server") || blueprint.app.includes("server") || blueprint.bin.length > 0 || blueprint.conformance || blueprint.tree ? [{
|
|
8477
8601
|
path: "tests/setupServer.ts",
|
|
8478
8602
|
group: "tests",
|
|
8479
8603
|
ownership: "birth",
|
|
@@ -8530,20 +8654,13 @@ function blueprintToTestArtifacts(blueprint) {
|
|
|
8530
8654
|
})).toArray();
|
|
8531
8655
|
const binSpecifier = serializeTypeScriptString("../../../src/bin/main.js");
|
|
8532
8656
|
const joinedImport = `\t\tconst entry = await import(${binSpecifier})`;
|
|
8533
|
-
const bins = blueprint.bin ? [{
|
|
8657
|
+
const bins = blueprint.bin.includes("main") ? [{
|
|
8534
8658
|
path: "tests/src/bin/main.test.ts",
|
|
8535
8659
|
group: "tests",
|
|
8536
8660
|
ownership: "birth",
|
|
8537
8661
|
origin: "template",
|
|
8538
8662
|
content: (0, _orkestrel_template.fillTemplate)(ARTIFACT_TEMPLATES.tests.bin, { import: matchesPrintWidth(joinedImport) ? joinedImport : `\t\tconst entry =\n\t\t\tawait import(${binSpecifier})` })
|
|
8539
8663
|
}] : [];
|
|
8540
|
-
const reporters = blueprint.reporter ? [{
|
|
8541
|
-
path: "tests/src/reporter/main.test.ts",
|
|
8542
|
-
group: "tests",
|
|
8543
|
-
ownership: "birth",
|
|
8544
|
-
origin: "template",
|
|
8545
|
-
content: ARTIFACT_TEMPLATES.tests.reporter
|
|
8546
|
-
}] : [];
|
|
8547
8664
|
const applications = Iterator.from(blueprint.app).map((environment) => ({
|
|
8548
8665
|
path: `tests/app/${environment}/index.test.ts`,
|
|
8549
8666
|
group: "tests",
|
|
@@ -8622,7 +8739,6 @@ function blueprintToTestArtifacts(blueprint) {
|
|
|
8622
8739
|
...journeys,
|
|
8623
8740
|
...sources,
|
|
8624
8741
|
...bins,
|
|
8625
|
-
...reporters,
|
|
8626
8742
|
...applications,
|
|
8627
8743
|
...distributions,
|
|
8628
8744
|
...integrations
|
|
@@ -8655,14 +8771,10 @@ function blueprintToGuideArtifacts(blueprint) {
|
|
|
8655
8771
|
directory: `src/${environment}`,
|
|
8656
8772
|
test: `tests/src/${environment}`
|
|
8657
8773
|
})),
|
|
8658
|
-
...blueprint.bin ? [{
|
|
8774
|
+
...blueprint.bin.length > 0 ? [{
|
|
8659
8775
|
directory: "src/bin",
|
|
8660
8776
|
test: "tests/src/bin"
|
|
8661
8777
|
}] : [],
|
|
8662
|
-
...blueprint.reporter ? [{
|
|
8663
|
-
directory: "src/reporter",
|
|
8664
|
-
test: "tests/src/reporter"
|
|
8665
|
-
}] : [],
|
|
8666
8778
|
...[...blueprint.app, ...blueprintToFaces(blueprint).filter((extension) => extension.axes.includes("app")).map((extension) => extension.name)].map((environment) => ({
|
|
8667
8779
|
directory: `app/${environment}`,
|
|
8668
8780
|
test: `tests/app/${environment}`
|
|
@@ -9132,6 +9244,154 @@ function insertManifestSection(manifest, section, dependencies, present) {
|
|
|
9132
9244
|
return [...Map.groupBy(placements, ({ position }) => position)].map(([position, group]) => [position, group.map(({ text }) => text).join("")]).sort(([left], [right]) => right - left).reduce((text, [position, insertion]) => text.slice(0, position) + insertion + text.slice(position), manifest);
|
|
9133
9245
|
}
|
|
9134
9246
|
/**
|
|
9247
|
+
* Inserts the planned `bin`, `files`, and `exports` entries a package manifest lacks.
|
|
9248
|
+
*
|
|
9249
|
+
* @param manifest - The manifest text to compile.
|
|
9250
|
+
* @param planned - The entries the plan emits, each in planned order.
|
|
9251
|
+
* @returns The manifest declaring every planned entry, or `undefined` when the text is not a
|
|
9252
|
+
* manifest object, or a section that must take an entry holds a value of another shape: `bin` not
|
|
9253
|
+
* an object, `exports` not a map of subpaths, or `files` not an array of strings.
|
|
9254
|
+
*
|
|
9255
|
+
* @remarks
|
|
9256
|
+
* The compiler inserts text instead of serializing the manifest, so every declared byte survives,
|
|
9257
|
+
* and a declared entry keeps its value whatever the plan holds. An inserted entry lands before the
|
|
9258
|
+
* first declared entry the plan orders after it, or after the last declared entry when none does,
|
|
9259
|
+
* and copies the indentation of the section's first entry; a nested value takes the same step per
|
|
9260
|
+
* level. An absent section is created as one top-level key holding the planned entries, before the
|
|
9261
|
+
* first declared key `MANIFEST_KEY_ORDER` orders after it, or last in the manifest object. A
|
|
9262
|
+
* manifest declaring every planned entry is returned unchanged.
|
|
9263
|
+
*
|
|
9264
|
+
* @example
|
|
9265
|
+
* ```ts
|
|
9266
|
+
* import { insertManifestEntries } from '@orkestrel/scaffold'
|
|
9267
|
+
*
|
|
9268
|
+
* insertManifestEntries('{\n\t"files": [\n\t\t"dist/src",\n\t\t"README.md"\n\t]\n}\n', {
|
|
9269
|
+
* bin: {},
|
|
9270
|
+
* files: ['dist/src', 'dist/bin', 'README.md'],
|
|
9271
|
+
* exports: {},
|
|
9272
|
+
* })
|
|
9273
|
+
* // '{\n\t"files": [\n\t\t"dist/src",\n\t\t"dist/bin",\n\t\t"README.md"\n\t]\n}\n'
|
|
9274
|
+
* ```
|
|
9275
|
+
*/
|
|
9276
|
+
function insertManifestEntries(manifest, planned) {
|
|
9277
|
+
const parsed = (0, _orkestrel_contract.parseJSON)(manifest);
|
|
9278
|
+
const tokens = scanManifestTokens(manifest);
|
|
9279
|
+
if (!(0, _orkestrel_contract.isRecord)(parsed) || tokens === void 0) return void 0;
|
|
9280
|
+
const missing = manifestToEntries(manifest, planned);
|
|
9281
|
+
const keys = tokens.flatMap((token, at) => {
|
|
9282
|
+
const name = token.depth === 1 && token.value !== void 0 ? (0, _orkestrel_contract.parseJSON)(token.text) : void 0;
|
|
9283
|
+
return (0, _orkestrel_contract.isString)(name) && token.value !== void 0 ? [{
|
|
9284
|
+
name,
|
|
9285
|
+
index: token.index,
|
|
9286
|
+
value: token.value,
|
|
9287
|
+
at
|
|
9288
|
+
}] : [];
|
|
9289
|
+
});
|
|
9290
|
+
const open = tokens[0];
|
|
9291
|
+
const root = tokens.find((token) => token.text === "}" && token.depth === 0);
|
|
9292
|
+
const head = keys[0];
|
|
9293
|
+
if (open?.text !== "{" || root === void 0 || head === void 0) return void 0;
|
|
9294
|
+
const lineBreak = manifest.lastIndexOf("\n", head.index);
|
|
9295
|
+
const margin = lineBreak < 0 ? "" : manifest.slice(lineBreak + 1, head.index);
|
|
9296
|
+
const step = /\S/u.test(margin) ? "" : margin;
|
|
9297
|
+
const edits = [
|
|
9298
|
+
{
|
|
9299
|
+
name: "bin",
|
|
9300
|
+
array: false,
|
|
9301
|
+
members: Object.entries(missing.bin),
|
|
9302
|
+
order: Object.keys(planned.bin)
|
|
9303
|
+
},
|
|
9304
|
+
{
|
|
9305
|
+
name: "files",
|
|
9306
|
+
array: true,
|
|
9307
|
+
members: missing.files.map((path) => [path, path]),
|
|
9308
|
+
order: planned.files
|
|
9309
|
+
},
|
|
9310
|
+
{
|
|
9311
|
+
name: "exports",
|
|
9312
|
+
array: false,
|
|
9313
|
+
members: Object.entries(missing.exports),
|
|
9314
|
+
order: Object.keys(planned.exports)
|
|
9315
|
+
}
|
|
9316
|
+
].map((section) => {
|
|
9317
|
+
if (section.members.length === 0) return [];
|
|
9318
|
+
const key = keys.find(({ name }) => name === section.name);
|
|
9319
|
+
if (key === void 0) {
|
|
9320
|
+
const value = section.array ? section.members.map(([path]) => path) : Object.fromEntries(section.members);
|
|
9321
|
+
const block = `${JSON.stringify(section.name)}: ${JSON.stringify(value, void 0, step).replaceAll("\n", `\n${margin}`)}`;
|
|
9322
|
+
const gap = step === "" ? "" : `\n${margin}`;
|
|
9323
|
+
const successors = MANIFEST_KEY_ORDER.slice(MANIFEST_KEY_ORDER.indexOf(section.name) + 1);
|
|
9324
|
+
const anchor = keys.find(({ name }) => successors.includes(name));
|
|
9325
|
+
const tail = open.index + 1 + manifest.slice(open.index + 1, root.index).trimEnd().length;
|
|
9326
|
+
return [anchor === void 0 ? {
|
|
9327
|
+
start: tail,
|
|
9328
|
+
end: tail,
|
|
9329
|
+
text: `,${gap}${block}`
|
|
9330
|
+
} : {
|
|
9331
|
+
start: anchor.index,
|
|
9332
|
+
end: anchor.index,
|
|
9333
|
+
text: `${block},${gap}`
|
|
9334
|
+
}];
|
|
9335
|
+
}
|
|
9336
|
+
const current = parsed[section.name];
|
|
9337
|
+
const length = (0, _orkestrel_contract.isArray)(current) && current.every(_orkestrel_contract.isString) ? current.length : void 0;
|
|
9338
|
+
if (manifest.charAt(key.value) !== (section.array ? "[" : "{")) return void 0;
|
|
9339
|
+
if (section.array && length === void 0) return void 0;
|
|
9340
|
+
if (section.name === "exports" && !isSubpathMap(current)) return void 0;
|
|
9341
|
+
const following = tokens.slice(key.at + 1);
|
|
9342
|
+
const strings = following.slice(0, length ?? 0);
|
|
9343
|
+
const last = strings.at(-1);
|
|
9344
|
+
const close = section.array ? manifest.indexOf("]", last === void 0 ? key.value + 1 : last.index + last.text.length) : following.find((token) => token.text === "}" && token.depth === 1)?.index ?? -1;
|
|
9345
|
+
if (close < 0) return void 0;
|
|
9346
|
+
const declared = (section.array ? strings : following).flatMap((token) => {
|
|
9347
|
+
const name = (0, _orkestrel_contract.parseJSON)(token.text);
|
|
9348
|
+
return (section.array || token.depth === 2 && token.value !== void 0) && token.index < close && (0, _orkestrel_contract.isString)(name) ? [{
|
|
9349
|
+
name,
|
|
9350
|
+
index: token.index
|
|
9351
|
+
}] : [];
|
|
9352
|
+
});
|
|
9353
|
+
const keyBreak = manifest.lastIndexOf("\n", key.index);
|
|
9354
|
+
const level = keyBreak < 0 ? "" : /^\s*/u.exec(manifest.slice(keyBreak + 1, key.index))?.[0] ?? "";
|
|
9355
|
+
const first = declared[0];
|
|
9356
|
+
const firstBreak = first === void 0 ? -1 : manifest.lastIndexOf("\n", first.index);
|
|
9357
|
+
const lead = first === void 0 || firstBreak < 0 ? "" : manifest.slice(firstBreak + 1, first.index);
|
|
9358
|
+
const indent = first === void 0 ? step === "" ? "" : `${level}${step}` : /\S/u.test(lead) ? "" : lead;
|
|
9359
|
+
const nested = indent.startsWith(level) ? indent.slice(level.length) : step;
|
|
9360
|
+
const lines = section.members.map(([name, value]) => section.array ? JSON.stringify(name) : `${JSON.stringify(name)}: ${JSON.stringify(value, void 0, nested).replaceAll("\n", `\n${indent}`)}`);
|
|
9361
|
+
const separator = indent === "" ? "" : `\n${indent}`;
|
|
9362
|
+
if (first === void 0) {
|
|
9363
|
+
const start = key.value + 1;
|
|
9364
|
+
const suffix = indent === "" ? "" : `\n${level}`;
|
|
9365
|
+
return [{
|
|
9366
|
+
start,
|
|
9367
|
+
end: close,
|
|
9368
|
+
text: `${lines.map((line) => `${separator}${line}`).join(",")}${suffix}`
|
|
9369
|
+
}];
|
|
9370
|
+
}
|
|
9371
|
+
const tail = key.value + 1 + manifest.slice(key.value + 1, close).trimEnd().length;
|
|
9372
|
+
return section.members.map(([name], position) => {
|
|
9373
|
+
const line = lines[position] ?? "";
|
|
9374
|
+
const rank = section.order.indexOf(name);
|
|
9375
|
+
const anchor = declared.find((entry) => section.order.indexOf(entry.name) > rank);
|
|
9376
|
+
return anchor === void 0 ? {
|
|
9377
|
+
start: tail,
|
|
9378
|
+
end: tail,
|
|
9379
|
+
text: `,${separator}${line}`
|
|
9380
|
+
} : {
|
|
9381
|
+
start: anchor.index,
|
|
9382
|
+
end: anchor.index,
|
|
9383
|
+
text: `${line},${separator}`
|
|
9384
|
+
};
|
|
9385
|
+
});
|
|
9386
|
+
});
|
|
9387
|
+
if (edits.some((edit) => edit === void 0)) return void 0;
|
|
9388
|
+
return [...Map.groupBy(edits.flatMap((edit) => edit ?? []), ({ start }) => start)].map(([start, group]) => ({
|
|
9389
|
+
start,
|
|
9390
|
+
end: Math.max(...group.map(({ end }) => end)),
|
|
9391
|
+
text: group.map(({ text }) => text).join("")
|
|
9392
|
+
})).sort((left, right) => right.start - left.start).reduce((text, edit) => text.slice(0, edit.start) + edit.text + text.slice(edit.end), manifest);
|
|
9393
|
+
}
|
|
9394
|
+
/**
|
|
9135
9395
|
* Replaces named script values in package manifest text.
|
|
9136
9396
|
*
|
|
9137
9397
|
* @param manifest - The manifest text to compile.
|
|
@@ -9573,6 +9833,36 @@ function blueprintToQuestions(blueprint) {
|
|
|
9573
9833
|
message: "integration drives features across environments, and this workspace declares fewer than two, so its seed composes nothing.",
|
|
9574
9834
|
blocking: false
|
|
9575
9835
|
}] : [],
|
|
9836
|
+
...Iterator.from(blueprint.bin).map((name) => ({
|
|
9837
|
+
name,
|
|
9838
|
+
valid: isBinModule(name)
|
|
9839
|
+
})).toArray().flatMap(({ name, valid }, index, declared) => {
|
|
9840
|
+
if (!valid) return [{
|
|
9841
|
+
field: "bin",
|
|
9842
|
+
message: `${name} is not a src/bin module name: write 1 to ${String(203)} lowercase letters and digits, starting with a letter, that name no centralized file.`,
|
|
9843
|
+
blocking: true
|
|
9844
|
+
}];
|
|
9845
|
+
if (declared.findIndex((other) => other.name === name) < index) return [{
|
|
9846
|
+
field: "bin",
|
|
9847
|
+
message: `${name} is declared more than once on bin.`,
|
|
9848
|
+
blocking: true
|
|
9849
|
+
}];
|
|
9850
|
+
if (name === "main") return [];
|
|
9851
|
+
const subpaths = blueprintToExports({
|
|
9852
|
+
...blueprint,
|
|
9853
|
+
bin: []
|
|
9854
|
+
});
|
|
9855
|
+
if (Object.hasOwn(subpaths, `./${name}`)) return [{
|
|
9856
|
+
field: "bin",
|
|
9857
|
+
message: `src/bin/${name}.ts publishes ./${name}, which src/${name} already publishes. Rename the module.`,
|
|
9858
|
+
blocking: true
|
|
9859
|
+
}];
|
|
9860
|
+
return Object.keys(subpaths).length === 0 ? [{
|
|
9861
|
+
field: "bin",
|
|
9862
|
+
message: `src/bin/${name}.ts publishes ./${name} through the exports map, and this workspace publishes no library environment or sheet, so its manifest carries no exports map.`,
|
|
9863
|
+
blocking: false
|
|
9864
|
+
}] : [];
|
|
9865
|
+
}),
|
|
9576
9866
|
...Iterator.from(blueprint.vendors).map((vendor) => ({
|
|
9577
9867
|
vendor,
|
|
9578
9868
|
valid: NAME_PATTERN.test(vendor)
|
|
@@ -9765,7 +10055,7 @@ function overridesToQuestions(overrides, artifacts) {
|
|
|
9765
10055
|
* const blueprint = createBlueprint('router', {
|
|
9766
10056
|
* src: ['core', 'server'],
|
|
9767
10057
|
* dependencies: [{ name: '@orkestrel/emitter', range: '^0.0.5' }],
|
|
9768
|
-
* bin:
|
|
10058
|
+
* bin: ['main'],
|
|
9769
10059
|
* })
|
|
9770
10060
|
*
|
|
9771
10061
|
* blueprint.version // '0.0.1'
|
|
@@ -9788,8 +10078,7 @@ function createBlueprint(name, input) {
|
|
|
9788
10078
|
version: input?.version ?? "0.0.1",
|
|
9789
10079
|
engines: input?.engines ?? ">=22.18.0",
|
|
9790
10080
|
overrides: input?.overrides ?? [],
|
|
9791
|
-
bin: input?.bin ??
|
|
9792
|
-
reporter: input?.reporter ?? false,
|
|
10081
|
+
bin: input?.bin ?? [],
|
|
9793
10082
|
setup: input?.setup ?? [],
|
|
9794
10083
|
guides: input?.guides ?? false,
|
|
9795
10084
|
integration: input?.integration ?? false,
|
|
@@ -10117,6 +10406,7 @@ exports.BARREL_CONFIGS = BARREL_CONFIGS;
|
|
|
10117
10406
|
exports.BASE_DEV_DEPENDENCIES = BASE_DEV_DEPENDENCIES;
|
|
10118
10407
|
exports.BIN_CONFIGS = BIN_CONFIGS;
|
|
10119
10408
|
exports.BIN_ENTRY_PATH = BIN_ENTRY_PATH;
|
|
10409
|
+
exports.BIN_MODULE_PATTERN = BIN_MODULE_PATTERN;
|
|
10120
10410
|
exports.BIN_OUTPUT_PATH = BIN_OUTPUT_PATH;
|
|
10121
10411
|
exports.BROWSER_ENTRIES = BROWSER_ENTRIES;
|
|
10122
10412
|
exports.BROWSE_DEV_DEPENDENCIES = BROWSE_DEV_DEPENDENCIES;
|
|
@@ -10127,6 +10417,7 @@ exports.CAPTURE_UPSTREAM = CAPTURE_UPSTREAM;
|
|
|
10127
10417
|
exports.CATALOG_AGENT_PATH = CATALOG_AGENT_PATH;
|
|
10128
10418
|
exports.CATALOG_END_MARKER = CATALOG_END_MARKER;
|
|
10129
10419
|
exports.CATALOG_START_MARKER = CATALOG_START_MARKER;
|
|
10420
|
+
exports.CENTRAL_FILE_NAMES = CENTRAL_FILE_NAMES;
|
|
10130
10421
|
exports.CONFIG_TEMPLATES = CONFIG_TEMPLATES;
|
|
10131
10422
|
exports.CONFORMANCE_TEST_PATH = CONFORMANCE_TEST_PATH;
|
|
10132
10423
|
exports.CONTROL_CHARACTER_PATTERN = CONTROL_CHARACTER_PATTERN;
|
|
@@ -10153,6 +10444,7 @@ exports.HOST_PATHS = HOST_PATHS;
|
|
|
10153
10444
|
exports.INTEGRATION_TEST_PATH = INTEGRATION_TEST_PATH;
|
|
10154
10445
|
exports.INVALID_PATH_CHARACTER_PATTERN = INVALID_PATH_CHARACTER_PATTERN;
|
|
10155
10446
|
exports.JOURNEY_CONFIG_PATH = JOURNEY_CONFIG_PATH;
|
|
10447
|
+
exports.MANIFEST_KEY_ORDER = MANIFEST_KEY_ORDER;
|
|
10156
10448
|
exports.MANIFEST_PATH = MANIFEST_PATH;
|
|
10157
10449
|
exports.MAX_ARTIFACT_BYTES = MAX_ARTIFACT_BYTES;
|
|
10158
10450
|
exports.MAX_ARTIFACT_HEX_LENGTH = MAX_ARTIFACT_HEX_LENGTH;
|
|
@@ -10176,9 +10468,6 @@ exports.ORKESTREL_RANGE_PATTERN = ORKESTREL_RANGE_PATTERN;
|
|
|
10176
10468
|
exports.PRINT_WIDTH = PRINT_WIDTH;
|
|
10177
10469
|
exports.REFERENCE_PATHS = REFERENCE_PATHS;
|
|
10178
10470
|
exports.RELEASE_PROOF_COMMAND = RELEASE_PROOF_COMMAND;
|
|
10179
|
-
exports.REPORTER_CONFIGS = REPORTER_CONFIGS;
|
|
10180
|
-
exports.REPORTER_ENTRY_PATH = REPORTER_ENTRY_PATH;
|
|
10181
|
-
exports.REPORTER_OUTPUT_PATH = REPORTER_OUTPUT_PATH;
|
|
10182
10471
|
exports.RESERVED_SHEET_NAMES = RESERVED_SHEET_NAMES;
|
|
10183
10472
|
exports.SEED_GUIDE_PATHS = SEED_GUIDE_PATHS;
|
|
10184
10473
|
exports.SERVICE_SCRIPT_PATH = SERVICE_SCRIPT_PATH;
|
|
@@ -10215,6 +10504,7 @@ exports.artifactsToQuestions = artifactsToQuestions;
|
|
|
10215
10504
|
exports.blueprintToConfigArtifacts = blueprintToConfigArtifacts;
|
|
10216
10505
|
exports.blueprintToDevDependencies = blueprintToDevDependencies;
|
|
10217
10506
|
exports.blueprintToDocumentArtifacts = blueprintToDocumentArtifacts;
|
|
10507
|
+
exports.blueprintToEntries = blueprintToEntries;
|
|
10218
10508
|
exports.blueprintToExports = blueprintToExports;
|
|
10219
10509
|
exports.blueprintToFaces = blueprintToFaces;
|
|
10220
10510
|
exports.blueprintToGuideArtifacts = blueprintToGuideArtifacts;
|
|
@@ -10253,12 +10543,14 @@ exports.inferArtifactDrift = inferArtifactDrift;
|
|
|
10253
10543
|
exports.inferArtifactGroup = inferArtifactGroup;
|
|
10254
10544
|
exports.inferSurfaceSimilarity = inferSurfaceSimilarity;
|
|
10255
10545
|
exports.insertManifestDependencies = insertManifestDependencies;
|
|
10546
|
+
exports.insertManifestEntries = insertManifestEntries;
|
|
10256
10547
|
exports.insertManifestSection = insertManifestSection;
|
|
10257
10548
|
exports.isArtifact = isArtifact;
|
|
10258
10549
|
exports.isArtifactFinding = isArtifactFinding;
|
|
10259
10550
|
exports.isArtifactGroup = isArtifactGroup;
|
|
10260
10551
|
exports.isArtifactGroups = isArtifactGroups;
|
|
10261
10552
|
exports.isAudit = isAudit;
|
|
10553
|
+
exports.isBinModule = isBinModule;
|
|
10262
10554
|
exports.isBlueprint = isBlueprint;
|
|
10263
10555
|
exports.isBrowserExtension = isBrowserExtension;
|
|
10264
10556
|
exports.isCanonPath = isCanonPath;
|
|
@@ -10285,19 +10577,23 @@ exports.isScaffoldError = isScaffoldError;
|
|
|
10285
10577
|
exports.isSheetName = isSheetName;
|
|
10286
10578
|
exports.isSnapshot = isSnapshot;
|
|
10287
10579
|
exports.isStylesExtension = isStylesExtension;
|
|
10580
|
+
exports.isSubpathMap = isSubpathMap;
|
|
10288
10581
|
exports.isSurface = isSurface;
|
|
10289
10582
|
exports.iterateAnswers = iterateAnswers;
|
|
10290
10583
|
exports.manifestToDependencies = manifestToDependencies;
|
|
10584
|
+
exports.manifestToEntries = manifestToEntries;
|
|
10291
10585
|
exports.manifestToName = manifestToName;
|
|
10292
10586
|
exports.matchesArtifactDriftReachability = matchesArtifactDriftReachability;
|
|
10293
10587
|
exports.matchesBarrel = matchesBarrel;
|
|
10294
10588
|
exports.matchesEngines = matchesEngines;
|
|
10295
10589
|
exports.matchesGuideRefusal = matchesGuideRefusal;
|
|
10296
10590
|
exports.matchesOrchestrationPath = matchesOrchestrationPath;
|
|
10591
|
+
exports.matchesPackedPath = matchesPackedPath;
|
|
10297
10592
|
exports.matchesPrintWidth = matchesPrintWidth;
|
|
10298
10593
|
exports.matchesRange = matchesRange;
|
|
10299
10594
|
exports.matchesSurfaceStructure = matchesSurfaceStructure;
|
|
10300
10595
|
exports.nameToGuide = nameToGuide;
|
|
10596
|
+
exports.normalizePackagePath = normalizePackagePath;
|
|
10301
10597
|
exports.overridesToQuestions = overridesToQuestions;
|
|
10302
10598
|
exports.parseArtifactGroups = parseArtifactGroups;
|
|
10303
10599
|
exports.parseBlueprint = parseBlueprint;
|