@orkestrel/scaffold 0.0.12 → 0.0.13

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.
@@ -5875,7 +5875,7 @@ ${renderedProjects}
5875
5875
  ${fitsPrintWidth(inlineRegistrations) ? inlineRegistrations : ` [
5876
5876
  ${renderedRegistrations.map((registration) => ` ${registration},`).join("\n")}
5877
5877
  ],`}
5878
- hasChromium,
5878
+ chromiumPath !== undefined,
5879
5879
  process.argv,
5880
5880
  ),`;
5881
5881
  }
@@ -7252,11 +7252,66 @@ import {
7252
7252
  fstatSync,
7253
7253
  lstatSync,
7254
7254
  openSync,
7255
- readSync,
7255
+ ${needsBrowser ? " readdirSync,\n" : ""} readSync,
7256
7256
  realpathSync,
7257
- } from 'node:fs'
7258
- import { dirname, isAbsolute, relative, resolve as resolvePath, sep } from 'node:path'
7259
- ${playwrightImports}${vueImports}${needsBrowser ? `\n${CONST_KEYWORD} hasChromium = existsSync(chromium.executablePath())\n` : ""}
7257
+ ${needsBrowser ? " statSync,\n" : ""}} from 'node:fs'
7258
+ import { ${needsBrowser ? "basename, " : ""}dirname, isAbsolute, relative, resolve as resolvePath, sep } from 'node:path'
7259
+ ${playwrightImports}${vueImports}${needsBrowser ? `\n/** Chromium executable layouts inside a \`chromium-<revision>\` browsers-directory entry, per platform. */
7260
+ ${EXPORT_KEYWORD} ${CONST_KEYWORD} CHROMIUM_LAYOUTS = Object.freeze([
7261
+ 'chrome-linux/chrome',
7262
+ 'chrome-linux64/chrome',
7263
+ 'chrome-win/chrome.exe',
7264
+ 'chrome-win64/chrome.exe',
7265
+ 'chrome-mac/Chromium.app/Contents/MacOS/Chromium',
7266
+ 'chrome-mac-arm64/Chromium.app/Contents/MacOS/Chromium',
7267
+ ])
7268
+
7269
+ /**
7270
+ * Resolve a launchable Chromium executable: the pinned revision when installed,
7271
+ * otherwise a \`chromium\` / \`chromium.exe\` alias or any other \`chromium-*\`
7272
+ * revision under the same Playwright browsers directory. A pinned-revision miss
7273
+ * is not Chromium absence — managed containers ship one usable build (often
7274
+ * behind a revision-agnostic alias) for many Playwright versions.
7275
+ */
7276
+ ${EXPORT_KEYWORD} function resolveChromium(pinned: string): string | undefined {
7277
+ if (existsSync(pinned)) return pinned
7278
+ let revisionRoot = dirname(pinned)
7279
+ for (;;) {
7280
+ if (/^chromium-\\d+$/.test(basename(revisionRoot))) break
7281
+ const parent = dirname(revisionRoot)
7282
+ if (parent === revisionRoot) return undefined
7283
+ revisionRoot = parent
7284
+ }
7285
+ const browsersRoot = dirname(revisionRoot)
7286
+ for (const alias of ['chromium', 'chromium.exe']) {
7287
+ const candidate = resolvePath(browsersRoot, alias)
7288
+ if (existsSync(candidate) && statSync(candidate).isFile()) return candidate
7289
+ }
7290
+ let entries: readonly string[]
7291
+ try {
7292
+ entries = readdirSync(browsersRoot)
7293
+ } catch {
7294
+ return undefined
7295
+ }
7296
+ const revisions = entries
7297
+ .filter((entry) => /^chromium-\\d+$/.test(entry))
7298
+ .sort((a, b) => Number(b.slice('chromium-'.length)) - Number(a.slice('chromium-'.length)))
7299
+ for (const revision of revisions) {
7300
+ for (const layout of CHROMIUM_LAYOUTS) {
7301
+ const candidate = resolvePath(browsersRoot, revision, layout)
7302
+ if (existsSync(candidate)) return candidate
7303
+ }
7304
+ }
7305
+ return undefined
7306
+ }
7307
+
7308
+ ${CONST_KEYWORD} chromiumPinned = chromium.executablePath()
7309
+ ${CONST_KEYWORD} chromiumPath = resolveChromium(chromiumPinned)
7310
+ ${CONST_KEYWORD} chromiumOptions =
7311
+ chromiumPath === undefined || chromiumPath === chromiumPinned
7312
+ ? {}
7313
+ : { launchOptions: { executablePath: chromiumPath } }
7314
+ ` : ""}
7260
7315
  ${EXPORT_KEYWORD} function resolveWorkspacePath(relativePath: string): string {
7261
7316
  return fileURLToPath(new URL(relativePath, import.meta.url))
7262
7317
  }
@@ -7596,7 +7651,7 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
7596
7651
  }),
7597
7652
  browser: {
7598
7653
  enabled: true,
7599
- provider: playwright(),
7654
+ provider: playwright(chromiumOptions),
7600
7655
  instances: [{ browser: 'chromium', headless: true }],
7601
7656
  },
7602
7657
  fileParallelism: false,
@@ -7729,7 +7784,7 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
7729
7784
  }),
7730
7785
  browser: {
7731
7786
  enabled: true,
7732
- provider: playwright(),
7787
+ provider: playwright(chromiumOptions),
7733
7788
  instances: [{ browser: 'chromium', headless: true }],
7734
7789
  },
7735
7790
  fileParallelism: false,
@@ -7895,7 +7950,7 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
7895
7950
  }),
7896
7951
  browser: {
7897
7952
  enabled: true,
7898
- provider: playwright(),
7953
+ provider: playwright(chromiumOptions),
7899
7954
  instances: [{ browser: 'chromium', headless: true }],
7900
7955
  },
7901
7956
  fileParallelism: false,
@@ -8024,7 +8079,7 @@ ${EXPORT_KEYWORD} function appBrowser(...config: readonly never[]): UserConfig {
8024
8079
  },
8025
8080
  browser: {
8026
8081
  enabled: true,
8027
- provider: playwright(),
8082
+ provider: playwright(chromiumOptions),
8028
8083
  instances: [{ browser: 'chromium', headless: true }],
8029
8084
  },
8030
8085
  fileParallelism: false,