@orkestrel/scaffold 0.0.28 → 0.0.30
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/host/AGENTS.md +12 -0
- package/dist/host/agents/orchestration.md +25 -11
- package/dist/host/claude/rules/tests.md +18 -8
- package/dist/host/claude/rules/workspace.md +15 -11
- package/dist/host/guides/scaffold.md +12 -0
- package/dist/src/core/index.cjs +384 -19
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +35 -4
- package/dist/src/core/index.d.ts +35 -4
- package/dist/src/core/index.js +384 -20
- package/dist/src/core/index.js.map +1 -1
- package/package.json +1 -1
package/dist/src/core/index.js
CHANGED
|
@@ -289,7 +289,7 @@ var DEFAULT_ENGINES = `>=${MINIMUM_NODE_VERSION}`;
|
|
|
289
289
|
var BASE_DEV_DEPENDENCIES = Object.freeze({
|
|
290
290
|
"@microsoft/api-extractor": "^7.58.12",
|
|
291
291
|
"@orkestrel/guide": "^0.0.10",
|
|
292
|
-
"@orkestrel/scaffold": "^0.0.
|
|
292
|
+
"@orkestrel/scaffold": "^0.0.30",
|
|
293
293
|
"@types/node": "^26.2.0",
|
|
294
294
|
oxfmt: "^0.62.0",
|
|
295
295
|
oxlint: "^1.77.0",
|
|
@@ -385,11 +385,11 @@ var CONFIG_TEMPLATES = Object.freeze({
|
|
|
385
385
|
vite: `import type { {{viteTypes}} } from 'vite'
|
|
386
386
|
{{imports}}import { defineConfig, mergeConfig } from 'vitest/config'
|
|
387
387
|
import tsconfig from './tsconfig.json' with { type: 'json' }
|
|
388
|
-
{{helpers}}import { lstatSync, readdirSync, realpathSync } from 'node:fs'
|
|
388
|
+
{{helpers}}{{browsers}}import { lstatSync, readdirSync, realpathSync } from 'node:fs'
|
|
389
389
|
import { basename, join, parse, relative, resolve as resolvePath, sep } from 'node:path'
|
|
390
390
|
import { fileURLToPath, URL } from 'node:url'
|
|
391
391
|
|
|
392
|
-
export function resolveWorkspacePath(relativePath: string): string {
|
|
392
|
+
{{options}}export function resolveWorkspacePath(relativePath: string): string {
|
|
393
393
|
return fileURLToPath(new URL(relativePath, import.meta.url))
|
|
394
394
|
}
|
|
395
395
|
|
|
@@ -481,9 +481,10 @@ const resolve = {
|
|
|
481
481
|
name: { label: 'src:browser', color: 'yellow' },
|
|
482
482
|
include: ['tests/src/browser/**/*.test.ts'],
|
|
483
483
|
{{exclude}} setupFiles: ['./tests/setup.ts', './tests/setupBrowser.ts'],
|
|
484
|
+
{{global}}
|
|
484
485
|
browser: {
|
|
485
486
|
enabled: true,
|
|
486
|
-
provider: playwright(),
|
|
487
|
+
provider: playwright(browserOptions),
|
|
487
488
|
instances: [{ browser: 'chromium', headless: true }],
|
|
488
489
|
},
|
|
489
490
|
fileParallelism: false,
|
|
@@ -594,7 +595,7 @@ const resolve = {
|
|
|
594
595
|
setupFiles: ['./tests/setup.ts', './tests/setupBrowser.ts'],
|
|
595
596
|
browser: {
|
|
596
597
|
enabled: true,
|
|
597
|
-
provider: playwright(),
|
|
598
|
+
provider: playwright(browserOptions),
|
|
598
599
|
instances: [{ browser: 'chromium', headless: true }],
|
|
599
600
|
},
|
|
600
601
|
fileParallelism: false,
|
|
@@ -919,12 +920,22 @@ export default defineConfig(
|
|
|
919
920
|
import dts from 'vite-plugin-dts'
|
|
920
921
|
import { srcBrowser, resolveWorkspacePath } from '../../vite.config.ts'
|
|
921
922
|
|
|
923
|
+
// vite-plugin-dts rolls this face into one declaration, and the roll-up reaches
|
|
924
|
+
// src/core through a relative source path the tarball does not carry. The path
|
|
925
|
+
// keeps each source module's own depth, so a module in a browser subfolder emits
|
|
926
|
+
// one that leaves dist/src entirely. The rewrite below externalizes core through
|
|
927
|
+
// the package's own published root export, on the final roll-up only.
|
|
922
928
|
export default defineConfig(
|
|
923
929
|
srcBrowser({
|
|
924
930
|
plugins: [
|
|
925
931
|
dts({
|
|
926
932
|
tsconfigPath: resolveWorkspacePath('configs/src/tsconfig.browser.json'),
|
|
927
933
|
bundleTypes: true,
|
|
934
|
+
beforeWriteFile: (path, content) => ({
|
|
935
|
+
content: /[\\\\/]dist[\\\\/]src[\\\\/]browser[\\\\/]index\\.d\\.ts$/.test(path)
|
|
936
|
+
{{replacement}}
|
|
937
|
+
: content,
|
|
938
|
+
}),
|
|
928
939
|
}),
|
|
929
940
|
],
|
|
930
941
|
}),
|
|
@@ -993,7 +1004,319 @@ import { appShowcase } from '../../vite.config.ts'
|
|
|
993
1004
|
export default defineConfig(appShowcase())
|
|
994
1005
|
`
|
|
995
1006
|
})
|
|
996
|
-
})
|
|
1007
|
+
}),
|
|
1008
|
+
browsers: `// A generated browser workspace resolves its own Chromium here rather than in
|
|
1009
|
+
// \`configs/helpers.ts\`, because that leaf is vendored byte-identical to every
|
|
1010
|
+
// workspace and most of them declare no \`playwright\` to import.
|
|
1011
|
+
|
|
1012
|
+
import type { PlaywrightProviderOptions } from '@vitest/browser-playwright'
|
|
1013
|
+
import { chromium } from 'playwright'
|
|
1014
|
+
import { accessSync, constants as FS_CONSTANTS, globSync, readdirSync, statSync } from 'node:fs'
|
|
1015
|
+
import { basename, dirname, join, resolve as resolvePath } from 'node:path'
|
|
1016
|
+
|
|
1017
|
+
/**
|
|
1018
|
+
* Chromium executable layouts inside a \`chromium-<revision>\` browsers-directory entry, per
|
|
1019
|
+
* platform.
|
|
1020
|
+
*
|
|
1021
|
+
* @remarks
|
|
1022
|
+
* The current Playwright build ships Chrome for Testing on macOS. The trailing \`Chromium.app\`
|
|
1023
|
+
* layouts are what earlier builds shipped, so the list spans Playwright versions instead of
|
|
1024
|
+
* pinning to the installed one.
|
|
1025
|
+
*/
|
|
1026
|
+
export const CHROMIUM_LAYOUTS = Object.freeze([
|
|
1027
|
+
'chrome-linux/chrome',
|
|
1028
|
+
'chrome-linux64/chrome',
|
|
1029
|
+
'chrome-win/chrome.exe',
|
|
1030
|
+
'chrome-win64/chrome.exe',
|
|
1031
|
+
'chrome-mac-x64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing',
|
|
1032
|
+
'chrome-mac-arm64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing',
|
|
1033
|
+
'chrome-mac/Chromium.app/Contents/MacOS/Chromium',
|
|
1034
|
+
'chrome-mac-arm64/Chromium.app/Contents/MacOS/Chromium',
|
|
1035
|
+
])
|
|
1036
|
+
|
|
1037
|
+
/** The \`chromium-<revision>\` entry name Playwright installs one managed build into. */
|
|
1038
|
+
export const CHROMIUM_ENTRY_PATTERN = /^chromium-\\d+$/
|
|
1039
|
+
|
|
1040
|
+
/** The revision number carried by any path containing a \`chromium-<revision>\` segment. */
|
|
1041
|
+
export const CHROMIUM_REVISION_PATTERN = /chromium-(\\d+)/
|
|
1042
|
+
|
|
1043
|
+
/** The directory a managed Linux container installs its bundled Playwright browsers into. */
|
|
1044
|
+
export const BUNDLED_BROWSERS_ROOT = '/opt/pw-browsers'
|
|
1045
|
+
|
|
1046
|
+
/**
|
|
1047
|
+
* Bundled Chromium layouts under the managed-container browsers root, as glob patterns.
|
|
1048
|
+
*
|
|
1049
|
+
* @remarks
|
|
1050
|
+
* The revision directory and its inner layout both drift across Playwright builds, and the
|
|
1051
|
+
* container also carries a top-level \`chromium\` alias, so every known shape is globbed.
|
|
1052
|
+
*/
|
|
1053
|
+
export const BUNDLED_CHROMIUM_LAYOUTS = Object.freeze([
|
|
1054
|
+
'chromium',
|
|
1055
|
+
'chromium-*/chrome-linux64/chrome',
|
|
1056
|
+
'chromium-*/chrome-linux/chrome',
|
|
1057
|
+
])
|
|
1058
|
+
|
|
1059
|
+
/** Stable Playwright Chromium channels and their standard executable layouts. */
|
|
1060
|
+
export const SYSTEM_BROWSER_CHANNELS = Object.freeze([
|
|
1061
|
+
Object.freeze({
|
|
1062
|
+
channel: 'chrome',
|
|
1063
|
+
layouts: Object.freeze({
|
|
1064
|
+
linux: '/opt/google/chrome/chrome',
|
|
1065
|
+
darwin: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
|
|
1066
|
+
win32: Object.freeze(['Google', 'Chrome', 'Application', 'chrome.exe']),
|
|
1067
|
+
}),
|
|
1068
|
+
}),
|
|
1069
|
+
Object.freeze({
|
|
1070
|
+
channel: 'msedge',
|
|
1071
|
+
layouts: Object.freeze({
|
|
1072
|
+
linux: '/opt/microsoft/msedge/msedge',
|
|
1073
|
+
darwin: '/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge',
|
|
1074
|
+
win32: Object.freeze(['Microsoft', 'Edge', 'Application', 'msedge.exe']),
|
|
1075
|
+
}),
|
|
1076
|
+
}),
|
|
1077
|
+
])
|
|
1078
|
+
|
|
1079
|
+
/**
|
|
1080
|
+
* Determine whether a path identifies an executable regular file.
|
|
1081
|
+
*
|
|
1082
|
+
* @param path - The filesystem path to inspect.
|
|
1083
|
+
* @returns Whether the path is a regular file with execute access.
|
|
1084
|
+
*
|
|
1085
|
+
* @example
|
|
1086
|
+
* \`\`\`ts
|
|
1087
|
+
* isBrowserExecutable('/opt/google/chrome/chrome')
|
|
1088
|
+
* \`\`\`
|
|
1089
|
+
*/
|
|
1090
|
+
export function isBrowserExecutable(path: string): boolean {
|
|
1091
|
+
try {
|
|
1092
|
+
if (!statSync(path).isFile()) return false
|
|
1093
|
+
accessSync(path, FS_CONSTANTS.X_OK)
|
|
1094
|
+
return true
|
|
1095
|
+
} catch {
|
|
1096
|
+
return false
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
/**
|
|
1101
|
+
* Order two Chromium paths so the highest revision sorts first.
|
|
1102
|
+
*
|
|
1103
|
+
* @param left - The first path or directory entry to compare.
|
|
1104
|
+
* @param right - The second path or directory entry to compare.
|
|
1105
|
+
* @returns A negative number when \`left\` sorts first, positive when \`right\` does.
|
|
1106
|
+
*
|
|
1107
|
+
* @remarks
|
|
1108
|
+
* Revisions are numbers, so \`chromium-1200\` outranks \`chromium-999\` despite sorting below it
|
|
1109
|
+
* lexically. A path carrying no revision falls back to descending name order.
|
|
1110
|
+
*
|
|
1111
|
+
* @example
|
|
1112
|
+
* \`\`\`ts
|
|
1113
|
+
* ['chromium-999', 'chromium-1200'].sort(compareRevisions)
|
|
1114
|
+
* \`\`\`
|
|
1115
|
+
*/
|
|
1116
|
+
export function compareRevisions(left: string, right: string): number {
|
|
1117
|
+
const leftRevision = CHROMIUM_REVISION_PATTERN.exec(left)?.[1]
|
|
1118
|
+
const rightRevision = CHROMIUM_REVISION_PATTERN.exec(right)?.[1]
|
|
1119
|
+
if (leftRevision === undefined || rightRevision === undefined) return right.localeCompare(left)
|
|
1120
|
+
return Number(rightRevision) - Number(leftRevision)
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
/**
|
|
1124
|
+
* Read the executable path of Playwright's pinned Chromium revision.
|
|
1125
|
+
*
|
|
1126
|
+
* @returns The pinned executable path, or \`undefined\` when this platform has none.
|
|
1127
|
+
*
|
|
1128
|
+
* @remarks
|
|
1129
|
+
* Playwright throws rather than returning a path when the current platform carries no initialized
|
|
1130
|
+
* executable, and an unguarded call would fail configuration evaluation for every project.
|
|
1131
|
+
*
|
|
1132
|
+
* @example
|
|
1133
|
+
* \`\`\`ts
|
|
1134
|
+
* resolvePinnedBrowser()
|
|
1135
|
+
* \`\`\`
|
|
1136
|
+
*/
|
|
1137
|
+
export function resolvePinnedBrowser(): string | undefined {
|
|
1138
|
+
try {
|
|
1139
|
+
const pinned = chromium.executablePath()
|
|
1140
|
+
return pinned.length === 0 ? undefined : pinned
|
|
1141
|
+
} catch {
|
|
1142
|
+
return undefined
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
/**
|
|
1147
|
+
* Resolve a launchable Playwright-managed Chromium executable: the pinned revision when installed,
|
|
1148
|
+
* otherwise a \`chromium\` / \`chromium.exe\` alias or any other \`chromium-*\` revision under the same
|
|
1149
|
+
* Playwright browsers directory. A pinned-revision miss is not Chromium absence — managed
|
|
1150
|
+
* containers ship one usable build, often behind a revision-agnostic alias, for many Playwright
|
|
1151
|
+
* versions.
|
|
1152
|
+
*
|
|
1153
|
+
* @param pinned - The executable path for Playwright's pinned Chromium revision.
|
|
1154
|
+
* @returns The managed executable path, or \`undefined\` when none is executable.
|
|
1155
|
+
*
|
|
1156
|
+
* @example
|
|
1157
|
+
* \`\`\`ts
|
|
1158
|
+
* resolveManagedBrowser('/root/.cache/ms-playwright/chromium-1234/chrome-linux64/chrome')
|
|
1159
|
+
* \`\`\`
|
|
1160
|
+
*/
|
|
1161
|
+
export function resolveManagedBrowser(pinned: string): string | undefined {
|
|
1162
|
+
if (isBrowserExecutable(pinned)) return pinned
|
|
1163
|
+
let revisionRoot = dirname(pinned)
|
|
1164
|
+
for (;;) {
|
|
1165
|
+
if (CHROMIUM_ENTRY_PATTERN.test(basename(revisionRoot))) break
|
|
1166
|
+
const parent = dirname(revisionRoot)
|
|
1167
|
+
if (parent === revisionRoot) return undefined
|
|
1168
|
+
revisionRoot = parent
|
|
1169
|
+
}
|
|
1170
|
+
const browsersRoot = dirname(revisionRoot)
|
|
1171
|
+
for (const alias of ['chromium', 'chromium.exe']) {
|
|
1172
|
+
const candidate = resolvePath(browsersRoot, alias)
|
|
1173
|
+
if (isBrowserExecutable(candidate)) return candidate
|
|
1174
|
+
}
|
|
1175
|
+
let entries: readonly string[]
|
|
1176
|
+
try {
|
|
1177
|
+
entries = readdirSync(browsersRoot)
|
|
1178
|
+
} catch {
|
|
1179
|
+
return undefined
|
|
1180
|
+
}
|
|
1181
|
+
const revisions = entries
|
|
1182
|
+
.filter((entry) => CHROMIUM_ENTRY_PATTERN.test(entry))
|
|
1183
|
+
.sort(compareRevisions)
|
|
1184
|
+
for (const revision of revisions) {
|
|
1185
|
+
for (const layout of CHROMIUM_LAYOUTS) {
|
|
1186
|
+
const candidate = resolvePath(browsersRoot, revision, layout)
|
|
1187
|
+
if (isBrowserExecutable(candidate)) return candidate
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
return undefined
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
/**
|
|
1194
|
+
* Resolve the Chromium a managed Linux container bundles outside the Playwright cache.
|
|
1195
|
+
*
|
|
1196
|
+
* @param platform - The Node platform the container runs on.
|
|
1197
|
+
* @param root - The bundled browsers directory to search.
|
|
1198
|
+
* @returns The highest matching executable path, or \`undefined\` when none is executable.
|
|
1199
|
+
*
|
|
1200
|
+
* @example
|
|
1201
|
+
* \`\`\`ts
|
|
1202
|
+
* resolveBundledBrowser('linux', BUNDLED_BROWSERS_ROOT)
|
|
1203
|
+
* \`\`\`
|
|
1204
|
+
*/
|
|
1205
|
+
export function resolveBundledBrowser(platform: NodeJS.Platform, root: string): string | undefined {
|
|
1206
|
+
if (platform !== 'linux') return undefined
|
|
1207
|
+
for (const layout of BUNDLED_CHROMIUM_LAYOUTS) {
|
|
1208
|
+
let matches: readonly string[]
|
|
1209
|
+
try {
|
|
1210
|
+
matches = globSync(layout, { cwd: root })
|
|
1211
|
+
} catch {
|
|
1212
|
+
return undefined
|
|
1213
|
+
}
|
|
1214
|
+
for (const match of [...matches].sort(compareRevisions)) {
|
|
1215
|
+
const candidate = resolvePath(root, match)
|
|
1216
|
+
if (isBrowserExecutable(candidate)) return candidate
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
return undefined
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
/**
|
|
1223
|
+
* Resolve the first installed stable system Chromium channel.
|
|
1224
|
+
*
|
|
1225
|
+
* @param platform - The Node platform whose standard layouts should be probed.
|
|
1226
|
+
* @param environment - The process environment supplying Windows installation roots.
|
|
1227
|
+
* @returns \`chrome\`, then \`msedge\`, or \`undefined\` when neither is executable.
|
|
1228
|
+
*
|
|
1229
|
+
* @example
|
|
1230
|
+
* \`\`\`ts
|
|
1231
|
+
* resolveSystemBrowser(process.platform, process.env)
|
|
1232
|
+
* \`\`\`
|
|
1233
|
+
*/
|
|
1234
|
+
export function resolveSystemBrowser(
|
|
1235
|
+
platform: NodeJS.Platform,
|
|
1236
|
+
environment: NodeJS.ProcessEnv,
|
|
1237
|
+
): string | undefined {
|
|
1238
|
+
if (platform !== 'linux' && platform !== 'darwin' && platform !== 'win32') return undefined
|
|
1239
|
+
const roots = new Set<string>()
|
|
1240
|
+
if (platform === 'win32') {
|
|
1241
|
+
for (const root of [
|
|
1242
|
+
environment.LOCALAPPDATA,
|
|
1243
|
+
environment.PROGRAMFILES,
|
|
1244
|
+
environment['PROGRAMFILES(X86)'],
|
|
1245
|
+
]) {
|
|
1246
|
+
if (root !== undefined && root.length > 0) roots.add(root)
|
|
1247
|
+
}
|
|
1248
|
+
const homeDrive = environment.HOMEDRIVE
|
|
1249
|
+
if (homeDrive !== undefined && homeDrive.length > 0) {
|
|
1250
|
+
roots.add(join(homeDrive, 'Program Files'))
|
|
1251
|
+
roots.add(join(homeDrive, 'Program Files (x86)'))
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
for (const browser of SYSTEM_BROWSER_CHANNELS) {
|
|
1255
|
+
if (platform === 'win32') {
|
|
1256
|
+
for (const root of roots) {
|
|
1257
|
+
if (isBrowserExecutable(join(root, ...browser.layouts.win32))) return browser.channel
|
|
1258
|
+
}
|
|
1259
|
+
continue
|
|
1260
|
+
}
|
|
1261
|
+
if (isBrowserExecutable(browser.layouts[platform])) return browser.channel
|
|
1262
|
+
}
|
|
1263
|
+
return undefined
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
/**
|
|
1267
|
+
* Resolve Playwright provider options for whatever browser this host can actually launch.
|
|
1268
|
+
*
|
|
1269
|
+
* @param pinned - The executable path for Playwright's pinned Chromium revision, when it has one.
|
|
1270
|
+
* @param platform - The Node platform whose standard layouts should be probed.
|
|
1271
|
+
* @param environment - The process environment supplying operator overrides and Windows roots.
|
|
1272
|
+
* @param root - The managed-container bundled browsers directory to search.
|
|
1273
|
+
* @returns Provider options naming an executable, a WebSocket endpoint, or a channel.
|
|
1274
|
+
*
|
|
1275
|
+
* @remarks
|
|
1276
|
+
* Precedence, most important first: \`PLAYWRIGHT_EXECUTABLE_PATH\`, \`PLAYWRIGHT_WS_ENDPOINT\`,
|
|
1277
|
+
* \`PLAYWRIGHT_CHANNEL\`, the managed Playwright Chromium, the container's bundled Chromium, a
|
|
1278
|
+
* verified system channel, then the platform default channel. An operator override outranks
|
|
1279
|
+
* discovery and is returned exactly as given: none of those three environment values is checked
|
|
1280
|
+
* against the filesystem, because verifying an override would defeat the override. The pinned
|
|
1281
|
+
* managed revision outranks anything found on the host because it is deterministic. The installed
|
|
1282
|
+
* pinned revision returns empty options so Playwright keeps its own default launch semantics. Only
|
|
1283
|
+
* a discovered system channel is verified before it is named. The platform default is unverified
|
|
1284
|
+
* as well and exists only as a last resort: Windows takes \`msedge\`, which ships with the OS and
|
|
1285
|
+
* never collides with a foreground Chrome.
|
|
1286
|
+
*
|
|
1287
|
+
* @example
|
|
1288
|
+
* \`\`\`ts
|
|
1289
|
+
* resolveBrowser(resolvePinnedBrowser(), process.platform, process.env)
|
|
1290
|
+
* \`\`\`
|
|
1291
|
+
*/
|
|
1292
|
+
export function resolveBrowser(
|
|
1293
|
+
pinned: string | undefined,
|
|
1294
|
+
platform: NodeJS.Platform,
|
|
1295
|
+
environment: NodeJS.ProcessEnv,
|
|
1296
|
+
root: string = BUNDLED_BROWSERS_ROOT,
|
|
1297
|
+
): PlaywrightProviderOptions {
|
|
1298
|
+
const executable = environment.PLAYWRIGHT_EXECUTABLE_PATH
|
|
1299
|
+
if (executable !== undefined && executable.length > 0) {
|
|
1300
|
+
return { launchOptions: { executablePath: executable } }
|
|
1301
|
+
}
|
|
1302
|
+
const endpoint = environment.PLAYWRIGHT_WS_ENDPOINT
|
|
1303
|
+
if (endpoint !== undefined && endpoint.length > 0) {
|
|
1304
|
+
return { connectOptions: { wsEndpoint: endpoint } }
|
|
1305
|
+
}
|
|
1306
|
+
const requested = environment.PLAYWRIGHT_CHANNEL
|
|
1307
|
+
if (requested !== undefined && requested.length > 0) {
|
|
1308
|
+
return { launchOptions: { channel: requested } }
|
|
1309
|
+
}
|
|
1310
|
+
const managed = pinned === undefined ? undefined : resolveManagedBrowser(pinned)
|
|
1311
|
+
if (managed !== undefined) {
|
|
1312
|
+
return managed === pinned ? {} : { launchOptions: { executablePath: managed } }
|
|
1313
|
+
}
|
|
1314
|
+
const bundled = resolveBundledBrowser(platform, root)
|
|
1315
|
+
if (bundled !== undefined) return { launchOptions: { executablePath: bundled } }
|
|
1316
|
+
const fallback = platform === 'win32' ? 'msedge' : 'chrome'
|
|
1317
|
+
return { launchOptions: { channel: resolveSystemBrowser(platform, environment) ?? fallback } }
|
|
1318
|
+
}
|
|
1319
|
+
`
|
|
997
1320
|
});
|
|
998
1321
|
/**
|
|
999
1322
|
* Formatter-stable template text for source, test, document, guide, and service artifacts.
|
|
@@ -2074,6 +2397,46 @@ function nameToGuide(name) {
|
|
|
2074
2397
|
return `guides/${name.slice(name.lastIndexOf("/") + 1)}.md`;
|
|
2075
2398
|
}
|
|
2076
2399
|
/**
|
|
2400
|
+
* Derive the declaration rewrite a published face's `beforeWriteFile` applies.
|
|
2401
|
+
*
|
|
2402
|
+
* @param name - The workspace's own bare package name.
|
|
2403
|
+
* @returns The ternary consequent an emitted `vite.{browser,server}.config.ts`
|
|
2404
|
+
* fills its `{{replacement}}` span with, indented for that span.
|
|
2405
|
+
*
|
|
2406
|
+
* @remarks
|
|
2407
|
+
* `vite-plugin-dts` rolls a face into one declaration and keeps each source
|
|
2408
|
+
* module's own relative depth, so a nested module emits a path that escapes
|
|
2409
|
+
* `dist/src` and a flat one resolves only by luck. Both faces rewrite the same
|
|
2410
|
+
* relative core path to the package's published root export, so the branch is
|
|
2411
|
+
* derived once here. The extension alternation is what the two permitted import
|
|
2412
|
+
* spellings produce: an `@src/core` alias resolves to the core source module and
|
|
2413
|
+
* prints `.ts`, while a relative import prints the `.js` specifier it was
|
|
2414
|
+
* written with. The formatter keeps the call on one line only while the line it
|
|
2415
|
+
* prints measures inside the vendored width, and the workspace name is what
|
|
2416
|
+
* varies, so the shape is chosen by measuring the candidate: a tab prints as the
|
|
2417
|
+
* vendored two columns, and the gate admits a name long enough to push the
|
|
2418
|
+
* joined call past 100.
|
|
2419
|
+
*
|
|
2420
|
+
* @example
|
|
2421
|
+
* ```ts
|
|
2422
|
+
* import { nameToRewrite } from '@orkestrel/scaffold'
|
|
2423
|
+
*
|
|
2424
|
+
* nameToRewrite('router').includes("'@orkestrel/router'") // true
|
|
2425
|
+
* ```
|
|
2426
|
+
*/
|
|
2427
|
+
function nameToRewrite(name) {
|
|
2428
|
+
const specifier = serializeTypeScriptString(`@orkestrel/${name}`);
|
|
2429
|
+
const pattern = "/(?:\\.\\.\\/)+core\\/index\\.[jt]s/g";
|
|
2430
|
+
const joined = `\t\t\t\t\t\t? content.replaceAll(${pattern}, ${specifier})`;
|
|
2431
|
+
if (joined.replaceAll(" ", " ").length <= 100) return joined;
|
|
2432
|
+
return [
|
|
2433
|
+
" ? content.replaceAll(",
|
|
2434
|
+
`\t\t\t\t\t\t\t\t${pattern},`,
|
|
2435
|
+
`\t\t\t\t\t\t\t\t${specifier},`,
|
|
2436
|
+
" )"
|
|
2437
|
+
].join("\n");
|
|
2438
|
+
}
|
|
2439
|
+
/**
|
|
2077
2440
|
* Select the host paths a named workspace vendors.
|
|
2078
2441
|
*
|
|
2079
2442
|
* @param paths - The candidate host paths, in their declared order.
|
|
@@ -3011,7 +3374,8 @@ function blueprintToRootVite(blueprint) {
|
|
|
3011
3374
|
factories.push(fillTemplate(CONFIG_TEMPLATES.factories.src.browser, {
|
|
3012
3375
|
external: core ? "external: (id: string) => id === '@src/core' || id.startsWith('@orkestrel/')," : "external: (id: string) => id.startsWith('@orkestrel/'),",
|
|
3013
3376
|
output: core ? " output: { paths: { '@src/core': '../core/index.js' } }," : " output: {},",
|
|
3014
|
-
exclude: core ? " exclude: ['tests/src/core/**/*.test.ts'],\n" : ""
|
|
3377
|
+
exclude: core ? " exclude: ['tests/src/core/**/*.test.ts'],\n" : "",
|
|
3378
|
+
global: blueprint.global ? " globalSetup: ['./tests/setupGlobal.ts'],\n" : ""
|
|
3015
3379
|
}));
|
|
3016
3380
|
projects.push("srcBrowser");
|
|
3017
3381
|
}
|
|
@@ -3132,6 +3496,8 @@ ${projects.map((project) => `\t\t\t${project},`).join("\n")}
|
|
|
3132
3496
|
viteTypes: machinery.showcase ? "PluginOption, UserConfig" : "UserConfig",
|
|
3133
3497
|
imports: imports.length === 0 ? "" : `${imports.join("\n")}\n`,
|
|
3134
3498
|
helpers: boundaries.length === 0 ? "" : `import { ${boundaries.join(", ")} } from './configs/helpers.js'\n`,
|
|
3499
|
+
browsers: machinery.browser ? "import { resolveBrowser, resolvePinnedBrowser } from './configs/browsers.js'\n" : "",
|
|
3500
|
+
options: machinery.browser ? "const browserOptions = resolveBrowser(resolvePinnedBrowser(), process.platform, process.env)\n\n" : "",
|
|
3135
3501
|
factories: body,
|
|
3136
3502
|
projects: projectRows
|
|
3137
3503
|
});
|
|
@@ -3165,22 +3531,20 @@ function blueprintToConfigArtifacts(blueprint) {
|
|
|
3165
3531
|
origin: "template",
|
|
3166
3532
|
content: blueprintToRootVite(blueprint)
|
|
3167
3533
|
}];
|
|
3534
|
+
if (blueprintToMachinery(blueprint).browser) artifacts.push({
|
|
3535
|
+
path: "configs/browsers.ts",
|
|
3536
|
+
group: "configs",
|
|
3537
|
+
ownership: "content",
|
|
3538
|
+
origin: "template",
|
|
3539
|
+
content: CONFIG_TEMPLATES.browsers
|
|
3540
|
+
});
|
|
3168
3541
|
for (const environment of blueprint.src) for (const path of SRC_MATRIX[environment].configs) {
|
|
3169
3542
|
let content = CONFIG_TEMPLATES.vites.src.core;
|
|
3170
3543
|
if (path === "configs/src/tsconfig.core.json") content = CONFIG_TEMPLATES.tsconfigs.src.core;
|
|
3171
|
-
else if (path === "configs/src/vite.browser.config.ts") content = CONFIG_TEMPLATES.vites.src.browser;
|
|
3544
|
+
else if (path === "configs/src/vite.browser.config.ts") content = fillTemplate(CONFIG_TEMPLATES.vites.src.browser, { replacement: nameToRewrite(blueprint.name) });
|
|
3172
3545
|
else if (path === "configs/src/tsconfig.browser.json") content = CONFIG_TEMPLATES.tsconfigs.src.browser;
|
|
3173
|
-
else if (path === "configs/src/vite.server.config.ts") {
|
|
3174
|
-
|
|
3175
|
-
const joined = `\t\t\t\t\t\t? content.replaceAll(/(?:\\.\\.\\/)+core\\/index\\.ts/g, ${packageName})`;
|
|
3176
|
-
const replacement = joined.replaceAll(" ", " ").length <= 100 ? joined : [
|
|
3177
|
-
" ? content.replaceAll(",
|
|
3178
|
-
" /(?:\\.\\.\\/)+core\\/index\\.ts/g,",
|
|
3179
|
-
`\t\t\t\t\t\t\t\t${packageName},`,
|
|
3180
|
-
" )"
|
|
3181
|
-
].join("\n");
|
|
3182
|
-
content = fillTemplate(CONFIG_TEMPLATES.vites.src.server, { replacement });
|
|
3183
|
-
} else if (path === "configs/src/tsconfig.server.json") content = CONFIG_TEMPLATES.tsconfigs.src.server;
|
|
3546
|
+
else if (path === "configs/src/vite.server.config.ts") content = fillTemplate(CONFIG_TEMPLATES.vites.src.server, { replacement: nameToRewrite(blueprint.name) });
|
|
3547
|
+
else if (path === "configs/src/tsconfig.server.json") content = CONFIG_TEMPLATES.tsconfigs.src.server;
|
|
3184
3548
|
artifacts.push({
|
|
3185
3549
|
path,
|
|
3186
3550
|
group: "configs",
|
|
@@ -4418,6 +4782,6 @@ function createCompiler(options) {
|
|
|
4418
4782
|
return new Compiler(options);
|
|
4419
4783
|
}
|
|
4420
4784
|
//#endregion
|
|
4421
|
-
export { APP_BROWSER_DEV_DEPENDENCIES, APP_DEV_DEPENDENCIES, APP_MATRIX, APP_SERVER_DEV_DEPENDENCIES, ARTIFACT_TEMPLATES, BASE_DEV_DEPENDENCIES, BIN_CONFIGS, BIN_ENTRY_PATH, CATALOG_AGENT_PATH, CONFIG_TEMPLATES, CONFORMANCE_TEST_PATH, CONTROL_CHARACTER_PATTERN, Compiler, DEFAULT_ENGINES, DEFAULT_VERSION, DEPENDENCY_NAME_PATTERN, ENGINES_PATTERN, ENVIRONMENTS, EXECUTABLE_PATHS, EXTRA_NAME_PATTERN, EXTRA_RANGE_PATTERN, GLOBAL_SETUP_PATH, GROUPS, GUIDES_TEST_PATH, HEX_PATTERN, HOST_PATHS, INTEGRATION_TEST_PATH, INVALID_PATH_CHARACTER_PATTERN, 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_TOTAL_ARTIFACT_BYTES, MINIMUM_NODE_VERSION, NAME_PATTERN, ORCHESTRATION_PATH_NAMES, ORCHESTRATION_PATH_PREFIXES, ORKESTREL_RANGE_PATTERN, SERVICE_SCRIPT_PATH, SERVICE_SETUP_PATH, SERVICE_TEST_INCLUDE, SHOWCASE_CONFIG_PATH, SHOWCASE_DEV_DEPENDENCIES, SOURCE_BROWSER_DEV_DEPENDENCIES, SRC_MATRIX, ScaffoldError, VERSION_PATTERN, applyOverrides, artifactToFinding, artifactToHex, artifactsToQuestions, blueprintToConfigArtifacts, blueprintToDevDependencies, blueprintToDocumentArtifacts, blueprintToGuideArtifacts, blueprintToMachinery, blueprintToManifest, blueprintToOrchestrationArtifacts, blueprintToQuestions, blueprintToRootTsconfig, blueprintToRootVite, blueprintToScripts, blueprintToSourceArtifacts, blueprintToTestArtifacts, bytesToHex, catalogToLayers, cloneValue, compareVersions, computeBytes, computeHash, contentToHex, createBlueprint, createCompiler, dependenciesToQuestions, extractVersion, inferDrift, inferGroup, isArtifact, isAudit, isBlueprint, isCatalogEntry, isCollection, isCompilerHooks, isCompilerOptions, isContent, isDependency, isDependencyName, isEnvironment, isFinding, isGroup, isGroups, isHex, isMirror, isOverride, isPath, isPlan, isQuestion, isScaffoldError, isSnapshot, manifestToDependencies, manifestToName, matchesDriftReachability, matchesEngines, matchesOrchestrationPath, matchesRange, nameToGuide, nameToHostArtifacts, overridesToQuestions, parseBlueprint, parseCompilerOptions, parseGroups, parseSnapshot, pathToCondition, planToFindings, planToHash, planToSummary, selectGroups, selectHostPaths, serializeTypeScriptString, srcToEntry, srcToExports, srcToRoot };
|
|
4785
|
+
export { APP_BROWSER_DEV_DEPENDENCIES, APP_DEV_DEPENDENCIES, APP_MATRIX, APP_SERVER_DEV_DEPENDENCIES, ARTIFACT_TEMPLATES, BASE_DEV_DEPENDENCIES, BIN_CONFIGS, BIN_ENTRY_PATH, CATALOG_AGENT_PATH, CONFIG_TEMPLATES, CONFORMANCE_TEST_PATH, CONTROL_CHARACTER_PATTERN, Compiler, DEFAULT_ENGINES, DEFAULT_VERSION, DEPENDENCY_NAME_PATTERN, ENGINES_PATTERN, ENVIRONMENTS, EXECUTABLE_PATHS, EXTRA_NAME_PATTERN, EXTRA_RANGE_PATTERN, GLOBAL_SETUP_PATH, GROUPS, GUIDES_TEST_PATH, HEX_PATTERN, HOST_PATHS, INTEGRATION_TEST_PATH, INVALID_PATH_CHARACTER_PATTERN, 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_TOTAL_ARTIFACT_BYTES, MINIMUM_NODE_VERSION, NAME_PATTERN, ORCHESTRATION_PATH_NAMES, ORCHESTRATION_PATH_PREFIXES, ORKESTREL_RANGE_PATTERN, SERVICE_SCRIPT_PATH, SERVICE_SETUP_PATH, SERVICE_TEST_INCLUDE, SHOWCASE_CONFIG_PATH, SHOWCASE_DEV_DEPENDENCIES, SOURCE_BROWSER_DEV_DEPENDENCIES, SRC_MATRIX, ScaffoldError, VERSION_PATTERN, applyOverrides, artifactToFinding, artifactToHex, artifactsToQuestions, blueprintToConfigArtifacts, blueprintToDevDependencies, blueprintToDocumentArtifacts, blueprintToGuideArtifacts, blueprintToMachinery, blueprintToManifest, blueprintToOrchestrationArtifacts, blueprintToQuestions, blueprintToRootTsconfig, blueprintToRootVite, blueprintToScripts, blueprintToSourceArtifacts, blueprintToTestArtifacts, bytesToHex, catalogToLayers, cloneValue, compareVersions, computeBytes, computeHash, contentToHex, createBlueprint, createCompiler, dependenciesToQuestions, extractVersion, inferDrift, inferGroup, isArtifact, isAudit, isBlueprint, isCatalogEntry, isCollection, isCompilerHooks, isCompilerOptions, isContent, isDependency, isDependencyName, isEnvironment, isFinding, isGroup, isGroups, isHex, isMirror, isOverride, isPath, isPlan, isQuestion, isScaffoldError, isSnapshot, manifestToDependencies, manifestToName, matchesDriftReachability, matchesEngines, matchesOrchestrationPath, matchesRange, nameToGuide, nameToHostArtifacts, nameToRewrite, overridesToQuestions, parseBlueprint, parseCompilerOptions, parseGroups, parseSnapshot, pathToCondition, planToFindings, planToHash, planToSummary, selectGroups, selectHostPaths, serializeTypeScriptString, srcToEntry, srcToExports, srcToRoot };
|
|
4422
4786
|
|
|
4423
4787
|
//# sourceMappingURL=index.js.map
|