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