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