@orkestrel/scaffold 0.0.4 → 0.0.5

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.
@@ -217,7 +217,7 @@ var DEFAULT_VERSION = "0.0.1";
217
217
  /** The `engines.node` range the `blueprint` builder fills. */
218
218
  var DEFAULT_ENGINES = `>=${MINIMUM_NODE_VERSION}`;
219
219
  /** The devDependency range generated packages pin `@orkestrel/scaffold` at. */
220
- var SCAFFOLD_RANGE = "^0.0.4";
220
+ var SCAFFOLD_RANGE = "^0.0.5";
221
221
  /** Tooling versions shared by scaffold and every generated workspace. */
222
222
  var BASE_DEV_DEPENDENCIES = Object.freeze({
223
223
  "@microsoft/api-extractor": "^7.58.12",
@@ -5684,30 +5684,69 @@ function rootTsconfig(src, app = []) {
5684
5684
  });
5685
5685
  }
5686
5686
  /**
5687
+ * Derive which host-specific machinery a workspace's generated root
5688
+ * `vite.config.ts` carries from its declared environments.
5689
+ *
5690
+ * @remarks
5691
+ * This is the SOLE derivation of that set; `rootViteConfig`,
5692
+ * `singleSrcViteConfig`, `applicationViteConfig`, and `configArtifacts` all
5693
+ * read it rather than recomputing an axis of their own. Nothing here selects
5694
+ * a boundary GUARANTEE — the environment-boundary plugin, its module-graph
5695
+ * AST audit, and stylesheet rejection ship in every shape.
5696
+ *
5697
+ * @param src - The declared published `Environment[]`.
5698
+ * @param app - The declared application `Environment[]`, defaulting to none.
5699
+ * @param engine - Whether the workspace also builds its own executable.
5700
+ * @returns The machinery set the generated header renders.
5701
+ *
5702
+ * @example
5703
+ * ```ts
5704
+ * viteMachinery(['core']) // { browser: false, vue: false, output: true }
5705
+ * viteMachinery([], ['core']) // { browser: false, vue: false, output: false }
5706
+ * ```
5707
+ */
5708
+ function viteMachinery(src, app = [], engine = false) {
5709
+ const unbuilt = src.length === 0 && app.length > 0 && !engine && app.every((environment) => environment === "core");
5710
+ return {
5711
+ browser: src.includes("browser") || app.includes("browser"),
5712
+ vue: app.includes("browser"),
5713
+ output: !unbuilt
5714
+ };
5715
+ }
5716
+ /**
5687
5717
  * The rendered import / `resolve` header block every `rootViteConfig` shape
5688
- * prefixes — the official Playwright provider import appears only when
5689
- * `needsPlaywright`, per the three grounded `rootViteConfig`
5690
- * shapes: unconditional for a multi-environment blueprint, conditional on the
5691
- * sole environment being `'browser'` for a single non-`core` environment, absent for
5692
- * `core`-only.
5693
- *
5694
- * @param needsPlaywright - Whether this shape ships a browser test project (and so needs Playwright).
5695
- * @param needsVue - Whether the generated root imports the Vue Vite plugin.
5718
+ * prefixes — the environment boundary and every guarantee it enforces ship
5719
+ * unconditionally; `machinery` selects only the host-specific pipelines layered
5720
+ * over them, per the three grounded `rootViteConfig` shapes: browser machinery
5721
+ * unconditional for a multi-environment blueprint carrying `browser`,
5722
+ * conditional on the sole environment being `'browser'` for a single non-`core`
5723
+ * environment, absent for `core`-only.
5724
+ *
5725
+ * @param machinery - The host-specific machinery this shape carries, from `viteMachinery`.
5696
5726
  * @returns The rendered header block, newline-terminated.
5697
5727
  *
5698
5728
  * @example
5699
5729
  * ```ts
5700
- * viteHeader(false).includes('@vitest/browser-playwright') // false
5701
- * viteHeader(true).includes('@vitest/browser-playwright') // true
5730
+ * viteHeader(viteMachinery(['core'])).includes('@vitest/browser-playwright') // false
5731
+ * viteHeader(viteMachinery(['core', 'browser'])).includes('@vitest/browser-playwright') // true
5702
5732
  * ```
5703
5733
  */
5704
- function viteHeader(needsPlaywright, needsVue = false) {
5705
- const playwrightImports = needsPlaywright ? `import { playwright } from '@vitest/browser-playwright'
5734
+ function viteHeader(machinery) {
5735
+ const { browser: needsBrowser, vue: needsVue, output: needsOutput } = machinery;
5736
+ const playwrightImports = needsBrowser ? `import { playwright } from '@vitest/browser-playwright'
5706
5737
  import { chromium } from 'playwright'
5707
5738
  ` : "";
5708
5739
  const vueImports = needsVue ? `import vue from '@vitejs/plugin-vue'
5709
5740
  import { parse as parseVue } from 'vue/compiler-sfc'
5710
5741
  ` : "";
5742
+ const viteTypeImports = needsVue ? `import type {
5743
+ CSSOptions,
5744
+ HtmlAssetSource,
5745
+ HTMLOptions,
5746
+ Plugin,
5747
+ ResolvedConfig,
5748
+ UserConfig,
5749
+ } from 'vite'` : needsBrowser ? `import type { CSSOptions, Plugin, ResolvedConfig, UserConfig } from 'vite'` : `import type { Plugin, UserConfig } from 'vite'`;
5711
5750
  const vueBoundary = needsVue ? `,
5712
5751
  transform: {
5713
5752
  order: 'pre',
@@ -5867,11 +5906,10 @@ import { parse as parseVue } from 'vue/compiler-sfc'
5867
5906
  }
5868
5907
  return restored === code ? null : restored
5869
5908
  },
5870
- }` : `,
5909
+ }` : needsBrowser ? `,
5871
5910
  transform: {
5872
5911
  order: 'pre',
5873
5912
  async handler(code, id) {
5874
- const restored = /[?&]html-proxy(?:[=&]|$)/.test(id) ? restoreIgnoredHtml(code) : code
5875
5913
  const target = workspacePath(id)
5876
5914
  const physicalImporter = physicalPath(id)
5877
5915
  const importerPackageRoot = trustedPackageRootFor(physicalImporter, trustedPackageRoots)
@@ -5885,15 +5923,13 @@ import { parse as parseVue } from 'vue/compiler-sfc'
5885
5923
  }
5886
5924
  const environmentModule =
5887
5925
  target !== undefined && /^(?:app|src)\\/(?:core|browser|server)\\//.test(target)
5888
- if (!environmentModule && importerPackageRoot === undefined) {
5889
- return restored === code ? null : restored
5890
- }
5926
+ if (!environmentModule && importerPackageRoot === undefined) return null
5891
5927
  if (isCSSRequest(id)) {
5892
5928
  const config = resolvedConfig
5893
5929
  if (config === undefined) {
5894
5930
  this.error('Environment boundary requires resolved Vite configuration')
5895
5931
  }
5896
- const stylesheet = await preprocessCSS(restored, id, config)
5932
+ const stylesheet = await preprocessCSS(code, id, config)
5897
5933
  for (const dependency of stylesheet.deps ?? []) {
5898
5934
  const physicalDependency = physicalPath(dependency)
5899
5935
  const dependencyTarget = workspacePath(physicalDependency)
@@ -5907,7 +5943,7 @@ import { parse as parseVue } from 'vue/compiler-sfc'
5907
5943
  if (dependencyError !== undefined) this.error(dependencyError)
5908
5944
  }
5909
5945
  }
5910
- for (const source of await environmentAssetSources(restored, id)) {
5946
+ for (const source of await environmentAssetSources(code, id)) {
5911
5947
  const normalizedSource = source.replaceAll('\\\\', '/')
5912
5948
  const sourceError = environmentSourceError(owner, normalizedSource)
5913
5949
  if (sourceError !== undefined) this.error(sourceError)
@@ -5950,12 +5986,74 @@ import { parse as parseVue } from 'vue/compiler-sfc'
5950
5986
  const assetError = environmentPathError(owner, resolvedSource)
5951
5987
  if (assetError !== undefined) this.error(assetError)
5952
5988
  }
5953
- return restored === code ? null : restored
5989
+ return null
5990
+ },
5991
+ }` : `,
5992
+ transform: {
5993
+ order: 'pre',
5994
+ async handler(code, id) {
5995
+ const target = workspacePath(id)
5996
+ const physicalImporter = physicalPath(id)
5997
+ const importerPackageRoot = trustedPackageRootFor(physicalImporter, trustedPackageRoots)
5998
+ if (target === undefined) {
5999
+ if (isOutsideWorkspacePath(id) && importerPackageRoot === undefined) {
6000
+ this.error('Environment modules cannot import files outside the workspace')
6001
+ }
6002
+ } else {
6003
+ const pathError = environmentPathError(owner, target)
6004
+ if (pathError !== undefined) this.error(pathError)
6005
+ }
6006
+ const environmentModule =
6007
+ target !== undefined && /^(?:app|src)\\/(?:core|browser|server)\\//.test(target)
6008
+ if (!environmentModule && importerPackageRoot === undefined) return null
6009
+ for (const source of await environmentAssetSources(code, id)) {
6010
+ const normalizedSource = source.replaceAll('\\\\', '/')
6011
+ const sourceError = environmentSourceError(owner, normalizedSource)
6012
+ if (sourceError !== undefined) this.error(sourceError)
6013
+ const [sourcePath] = normalizedSource.split(/[?#]/)
6014
+ if (sourcePath !== undefined && isBuiltin(sourcePath)) continue
6015
+ const resolution = await this.resolve(normalizedSource, id, { skipSelf: true })
6016
+ const fallbackSource = sourceFallback(physicalImporter, normalizedSource)
6017
+ const physicalSource = physicalPath(resolution?.id ?? fallbackSource)
6018
+ if (importerPackageRoot !== undefined) {
6019
+ const pathLike =
6020
+ normalizedSource.startsWith('.') ||
6021
+ normalizedSource.startsWith('/') ||
6022
+ /^file:/i.test(normalizedSource) ||
6023
+ /^[A-Za-z]:[\\\\/]/.test(normalizedSource)
6024
+ if (pathLike && !containedPath(importerPackageRoot, physicalSource)) {
6025
+ this.error(
6026
+ 'Dependency modules cannot import files outside their physical package root',
6027
+ )
6028
+ }
6029
+ if (!pathLike && !containedPath(importerPackageRoot, physicalSource)) {
6030
+ const packageName = packageNameOf(normalizedSource)
6031
+ const packageRoot = normalizedSource.startsWith('#')
6032
+ ? workspacePath(physicalSource) === undefined
6033
+ ? packageRootForResolved(physicalSource)
6034
+ : undefined
6035
+ : packageName === undefined
6036
+ ? undefined
6037
+ : packageRootOf(packageName, physicalSource)
6038
+ if (packageRoot === undefined || !containedPath(packageRoot, physicalSource)) {
6039
+ this.error('Resolved dependencies must remain inside their physical package root')
6040
+ }
6041
+ trustedPackageRoots.add(packageRoot)
6042
+ }
6043
+ continue
6044
+ }
6045
+ const resolvedSource = workspacePath(physicalSource)
6046
+ if (resolvedSource === undefined) {
6047
+ this.error('Environment modules cannot import files outside the workspace')
6048
+ }
6049
+ const assetError = environmentPathError(owner, resolvedSource)
6050
+ if (assetError !== undefined) this.error(assetError)
6051
+ }
6052
+ return null
5954
6053
  },
5955
6054
  }`;
5956
6055
  const environmentBoundary = `
5957
- ${CONST_KEYWORD} WORKSPACE_ROOT = realpathSync.native(dirname(fileURLToPath(import.meta.url)))
5958
- ${EXPORT_KEYWORD} ${CONST_KEYWORD} IMPORT_META_ENV_PREFIX = 'import.meta.env.'
6056
+ ${CONST_KEYWORD} WORKSPACE_ROOT = realpathSync.native(dirname(fileURLToPath(import.meta.url)))${needsVue ? `\n${EXPORT_KEYWORD} ${CONST_KEYWORD} IMPORT_META_ENV_PREFIX = 'import.meta.env.'` : ""}
5959
6057
 
5960
6058
  ${EXPORT_KEYWORD} function physicalPath(path: string): string {
5961
6059
  const [pathWithoutQuery] = path.split('?')
@@ -6000,9 +6098,9 @@ ${EXPORT_KEYWORD} function containedPath(root: string, target: string): boolean
6000
6098
  relativePath === '' ||
6001
6099
  (relativePath !== '..' && !relativePath.startsWith(\`..\${sep}\`) && !isAbsolute(relativePath))
6002
6100
  )
6003
- }
6101
+ }${needsVue ? `
6004
6102
 
6005
- ${needsVue ? `${EXPORT_KEYWORD} function browserServerRoots(): readonly string[] {
6103
+ ${EXPORT_KEYWORD} function browserServerRoots(): readonly string[] {
6006
6104
  const roots: string[] = []
6007
6105
  for (const path of [
6008
6106
  'app/browser',
@@ -6284,7 +6382,7 @@ ${EXPORT_KEYWORD} function environmentSourceError(owner: string, source: string)
6284
6382
  return undefined
6285
6383
  }
6286
6384
 
6287
- ${EXPORT_KEYWORD} function stylesheetAssetError(
6385
+ ${needsBrowser ? `${EXPORT_KEYWORD} function stylesheetAssetError(
6288
6386
  source: string | undefined,
6289
6387
  value: string,
6290
6388
  ): string | undefined {
@@ -6331,7 +6429,7 @@ ${EXPORT_KEYWORD} function stylesheetAssetError(
6331
6429
  return undefined
6332
6430
  }
6333
6431
 
6334
- ${EXPORT_KEYWORD} function enforceOutputPath(configured: string, expected: string): void {
6432
+ ` : ""}${needsOutput ? `${EXPORT_KEYWORD} function enforceOutputPath(configured: string, expected: string): void {
6335
6433
  if (relative(expected, configured) !== '') {
6336
6434
  throw new Error(
6337
6435
  '[orkestrel-output-boundary] Build output must use its exact configured workspace directory',
@@ -6398,7 +6496,7 @@ ${EXPORT_KEYWORD} function outputBoundary(output: string): Plugin {
6398
6496
  }
6399
6497
  }
6400
6498
 
6401
- ${EXPORT_KEYWORD} function decodeAssetSource(source: string): string | undefined {
6499
+ ` : ""}${EXPORT_KEYWORD} function decodeAssetSource(source: string): string | undefined {
6402
6500
  try {
6403
6501
  return decodeURI(source)
6404
6502
  } catch {
@@ -6406,7 +6504,7 @@ ${EXPORT_KEYWORD} function decodeAssetSource(source: string): string | undefined
6406
6504
  }
6407
6505
  }
6408
6506
 
6409
- ${EXPORT_KEYWORD} function filterHtmlAssetSource(
6507
+ ${needsVue ? `${EXPORT_KEYWORD} function filterHtmlAssetSource(
6410
6508
  data: Parameters<NonNullable<HtmlAssetSource['filter']>>[0],
6411
6509
  ): boolean {
6412
6510
  const decoded = decodeAssetSource(data.value)
@@ -6551,7 +6649,7 @@ ${EXPORT_KEYWORD} function maskIgnoredHtml(environmentKeys: ReadonlySet<string>,
6551
6649
  )
6552
6650
  }
6553
6651
 
6554
- ${EXPORT_KEYWORD} function restoreIgnoredHtml(code: string): string {
6652
+ ` : ""}${needsVue ? `${EXPORT_KEYWORD} function restoreIgnoredHtml(code: string): string {
6555
6653
  const literals = code.replace(
6556
6654
  /(?<prefix>[vV][iI][tT][eE])&#45;(?<suffix>[iI][gG][nN][oO][rR][eE])/gu,
6557
6655
  '$<prefix>-$<suffix>',
@@ -6607,7 +6705,7 @@ ${EXPORT_KEYWORD} function finalizeHtml(): Plugin {
6607
6705
  }
6608
6706
  }
6609
6707
 
6610
- ${EXPORT_KEYWORD} async function environmentAssetSources(
6708
+ ` : ""}${EXPORT_KEYWORD} async function environmentAssetSources(
6611
6709
  code: string,
6612
6710
  id: string,
6613
6711
  emitted = false,
@@ -6692,23 +6790,19 @@ ${EXPORT_KEYWORD} async function environmentAssetSources(
6692
6790
  }
6693
6791
  },
6694
6792
  })
6695
- visitor.visit(parseAst(transformed.code, null, path))
6793
+ visitor.visit(parseSync(path, transformed.code).program)
6696
6794
  return sources
6697
6795
  }
6698
6796
 
6699
6797
  ${EXPORT_KEYWORD} function environmentBoundary(
6700
6798
  owner: 'src/core' | 'src/browser' | 'src/server' | 'app/core' | 'app/browser' | 'app/server',
6701
6799
  ): Plugin {
6702
- const trustedPackageRoots = new Set<string>()
6703
- let environmentRoot = WORKSPACE_ROOT
6704
- let resolvedConfig: ResolvedConfig | undefined
6800
+ const trustedPackageRoots = new Set<string>()${needsOutput ? "\n let environmentRoot = WORKSPACE_ROOT" : ""}${needsBrowser ? "\n let resolvedConfig: ResolvedConfig | undefined" : ""}
6705
6801
  return {
6706
6802
  name: 'orkestrel-environment-boundary',
6707
- enforce: 'pre',
6708
- configResolved(config) {
6709
- environmentRoot = physicalPath(config.root)
6710
- resolvedConfig = config
6711
- },
6803
+ enforce: 'pre',${needsOutput || needsBrowser ? `
6804
+ configResolved(config) {${needsOutput ? "\n environmentRoot = physicalPath(config.root)" : ""}${needsBrowser ? "\n resolvedConfig = config" : ""}
6805
+ },` : ""}
6712
6806
  ${needsVue ? ` configureServer(server) {
6713
6807
  if (owner !== 'app/browser') return
6714
6808
  const roots = browserServerRoots()
@@ -6841,7 +6935,7 @@ ${needsVue ? ` configureServer(server) {
6841
6935
  }
6842
6936
  }
6843
6937
  return null
6844
- },
6938
+ },${needsOutput ? `
6845
6939
  async generateBundle(_options, bundle) {
6846
6940
  for (const output of Object.values(bundle)) {
6847
6941
  if (output.type === 'chunk') {
@@ -6871,7 +6965,7 @@ ${needsVue ? ` configureServer(server) {
6871
6965
  if (pathError !== undefined) this.error(pathError)
6872
6966
  }
6873
6967
  }
6874
- },
6968
+ },` : ""}
6875
6969
  buildEnd(error) {
6876
6970
  if (error !== undefined) return
6877
6971
  for (const id of this.getModuleIds()) {
@@ -6892,16 +6986,10 @@ ${needsVue ? ` configureServer(server) {
6892
6986
  }
6893
6987
  }
6894
6988
  `;
6895
- return `import type {
6896
- CSSOptions,
6897
- HtmlAssetSource,
6898
- HTMLOptions,
6899
- Plugin,
6900
- ResolvedConfig,
6901
- UserConfig,
6902
- } from 'vite'
6903
- import { isCSSRequest, parseAst, preprocessCSS, transformWithOxc, Visitor } from 'vite'
6904
- import { defineConfig, mergeConfig } from 'vitest/config'
6989
+ return `${viteTypeImports}
6990
+ ${needsBrowser ? `import { isCSSRequest, parseSync, preprocessCSS, transformWithOxc, Visitor } from 'vite'
6991
+ ` : `import { parseSync, transformWithOxc, Visitor } from 'vite'
6992
+ `}import { defineConfig, mergeConfig } from 'vitest/config'
6905
6993
  import tsconfig from './tsconfig.json' with { type: 'json' }
6906
6994
  import { fileURLToPath, URL } from 'node:url'
6907
6995
  import { isBuiltin } from 'node:module'
@@ -6916,8 +7004,7 @@ import {
6916
7004
  realpathSync,
6917
7005
  } from 'node:fs'
6918
7006
  import { dirname, isAbsolute, relative, resolve as resolvePath, sep } from 'node:path'
6919
- ${playwrightImports}${vueImports}
6920
- ${needsPlaywright ? `${CONST_KEYWORD} hasChromium = existsSync(chromium.executablePath())\n` : ""}
7007
+ ${playwrightImports}${vueImports}${needsBrowser ? `\n${CONST_KEYWORD} hasChromium = existsSync(chromium.executablePath())\n` : ""}
6921
7008
  ${EXPORT_KEYWORD} function resolveWorkspacePath(relativePath: string): string {
6922
7009
  return fileURLToPath(new URL(relativePath, import.meta.url))
6923
7010
  }
@@ -6938,7 +7025,7 @@ ${CONST_KEYWORD} resolve = {
6938
7025
  }, {}),
6939
7026
  }
6940
7027
 
6941
- ${EXPORT_KEYWORD} ${CONST_KEYWORD} ENVIRONMENT_CSS = Object.freeze({
7028
+ ${needsBrowser ? `${EXPORT_KEYWORD} ${CONST_KEYWORD} ENVIRONMENT_CSS = Object.freeze({
6942
7029
  transformer: 'lightningcss',
6943
7030
  lightningcss: {
6944
7031
  visitor: () => {
@@ -6969,7 +7056,7 @@ ${EXPORT_KEYWORD} ${CONST_KEYWORD} ENVIRONMENT_CSS = Object.freeze({
6969
7056
  },
6970
7057
  },
6971
7058
  } satisfies CSSOptions)
6972
- ${EXPORT_KEYWORD} ${CONST_KEYWORD} PACKAGE_MANIFEST_BYTES = 1_048_576
7059
+ ` : ""}${EXPORT_KEYWORD} ${CONST_KEYWORD} PACKAGE_MANIFEST_BYTES = 1_048_576
6973
7060
  ${EXPORT_KEYWORD} ${CONST_KEYWORD} ENVIRONMENT_MODULE_BYTES = 8_388_608
6974
7061
  ${environmentBoundary}`;
6975
7062
  }
@@ -7006,7 +7093,8 @@ function policyViteProject() {
7006
7093
  * ```
7007
7094
  */
7008
7095
  function singleSrcViteConfig(environment) {
7009
- const header = viteHeader(environment === "browser");
7096
+ const machinery = viteMachinery([environment]);
7097
+ const header = viteHeader(machinery);
7010
7098
  if (environment === "browser") return `${header}
7011
7099
  ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
7012
7100
  mergeConfig(
@@ -7014,10 +7102,7 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
7014
7102
  resolve,
7015
7103
  css: ENVIRONMENT_CSS,
7016
7104
  publicDir: false,
7017
- plugins: [
7018
- outputBoundary('dist/src/browser'),
7019
- environmentBoundary('src/browser'),
7020
- ],
7105
+ plugins: [outputBoundary('dist/src/browser'), environmentBoundary('src/browser')],
7021
7106
  build: {
7022
7107
  assetsInlineLimit: 0,
7023
7108
  emptyOutDir: true,
@@ -7077,13 +7162,9 @@ export default defineConfig({
7077
7162
  ${EXPORT_KEYWORD} const srcServer = (config?: UserConfig): UserConfig =>
7078
7163
  mergeConfig(
7079
7164
  {
7080
- resolve,
7081
- css: ENVIRONMENT_CSS,
7165
+ resolve,${machinery.browser ? "\n css: ENVIRONMENT_CSS," : ""}
7082
7166
  publicDir: false,
7083
- plugins: [
7084
- outputBoundary('dist/src/server'),
7085
- environmentBoundary('src/server'),
7086
- ],
7167
+ plugins: [outputBoundary('dist/src/server'), environmentBoundary('src/server')],
7087
7168
  build: {
7088
7169
  emptyOutDir: true,
7089
7170
  sourcemap: true,
@@ -7165,7 +7246,8 @@ export default defineConfig({
7165
7246
  function rootViteConfig(src, engine = false) {
7166
7247
  const hasCore = src.includes("core");
7167
7248
  const nonCore = src.filter((environment) => environment !== "core");
7168
- const header = viteHeader(src.includes("browser"));
7249
+ const machinery = viteMachinery(src);
7250
+ const header = viteHeader(machinery);
7169
7251
  if (!hasCore) {
7170
7252
  const [onlyEnvironment] = nonCore;
7171
7253
  if (onlyEnvironment === "browser" || onlyEnvironment === "server") return singleSrcViteConfig(onlyEnvironment);
@@ -7177,10 +7259,7 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
7177
7259
  {
7178
7260
  css: ENVIRONMENT_CSS,
7179
7261
  publicDir: false,
7180
- plugins: [
7181
- outputBoundary('dist/src/browser'),
7182
- environmentBoundary('src/browser'),
7183
- ],
7262
+ plugins: [outputBoundary('dist/src/browser'), environmentBoundary('src/browser')],
7184
7263
  build: {
7185
7264
  assetsInlineLimit: 0,
7186
7265
  lib: {
@@ -7216,13 +7295,9 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
7216
7295
  ${EXPORT_KEYWORD} const srcServer = (config?: UserConfig): UserConfig =>
7217
7296
  srcCore(
7218
7297
  mergeConfig(
7219
- {
7220
- css: ENVIRONMENT_CSS,
7298
+ {${machinery.browser ? "\n css: ENVIRONMENT_CSS," : ""}
7221
7299
  publicDir: false,
7222
- plugins: [
7223
- outputBoundary('dist/src/server'),
7224
- environmentBoundary('src/server'),
7225
- ],
7300
+ plugins: [outputBoundary('dist/src/server'), environmentBoundary('src/server')],
7226
7301
  build: {
7227
7302
  lib: {
7228
7303
  entry: resolveWorkspacePath('src/server/index.ts'),
@@ -7372,7 +7447,8 @@ export default defineConfig({
7372
7447
  */
7373
7448
  function applicationViteConfig(src, app, engine = false) {
7374
7449
  const hasSourceCore = src.includes("core");
7375
- const header = viteHeader(src.includes("browser") || app.includes("browser"), app.includes("browser"));
7450
+ const machinery = viteMachinery(src, app, engine);
7451
+ const header = viteHeader(machinery);
7376
7452
  const projects = [];
7377
7453
  const blocks = [];
7378
7454
  if (src.includes("core")) {
@@ -7381,8 +7457,7 @@ function applicationViteConfig(src, app, engine = false) {
7381
7457
  ${EXPORT_KEYWORD} const srcCore = (config?: UserConfig): UserConfig =>
7382
7458
  mergeConfig(
7383
7459
  {
7384
- resolve,
7385
- css: ENVIRONMENT_CSS,
7460
+ resolve,${machinery.browser ? "\n css: ENVIRONMENT_CSS," : ""}
7386
7461
  publicDir: false,
7387
7462
  plugins: [environmentBoundary('src/core')],
7388
7463
  build: { emptyOutDir: true, sourcemap: true, minify: false },
@@ -7464,8 +7539,7 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
7464
7539
  ${EXPORT_KEYWORD} const srcServer = (config?: UserConfig): UserConfig =>
7465
7540
  mergeConfig(
7466
7541
  {
7467
- resolve,
7468
- css: ENVIRONMENT_CSS,
7542
+ resolve,${machinery.browser ? "\n css: ENVIRONMENT_CSS," : ""}
7469
7543
  publicDir: false,
7470
7544
  plugins: [outputBoundary('dist/src/server'), environmentBoundary('src/server')],
7471
7545
  build: {
@@ -7501,8 +7575,7 @@ ${EXPORT_KEYWORD} const srcServer = (config?: UserConfig): UserConfig =>
7501
7575
  ${EXPORT_KEYWORD} const appCore = (config?: UserConfig): UserConfig =>
7502
7576
  mergeConfig(
7503
7577
  {
7504
- resolve,
7505
- css: ENVIRONMENT_CSS,
7578
+ resolve,${machinery.browser ? "\n css: ENVIRONMENT_CSS," : ""}
7506
7579
  publicDir: false,
7507
7580
  plugins: [environmentBoundary('app/core')],
7508
7581
  test: {
@@ -7579,8 +7652,7 @@ ${EXPORT_KEYWORD} function appBrowser(...config: readonly never[]): UserConfig {
7579
7652
  ${EXPORT_KEYWORD} const appServer = (config?: UserConfig): UserConfig =>
7580
7653
  mergeConfig(
7581
7654
  {
7582
- resolve,
7583
- css: ENVIRONMENT_CSS,
7655
+ resolve,${machinery.browser ? "\n css: ENVIRONMENT_CSS," : ""}
7584
7656
  publicDir: false,
7585
7657
  plugins: [outputBoundary('dist/app/server'), environmentBoundary('app/server')],
7586
7658
  build: {
@@ -7712,6 +7784,7 @@ function coreTsconfig() {
7712
7784
  * `configs/src/vite.core.config.ts` — inlines its own `build.lib` /
7713
7785
  * `rolldownOptions` (core's `srcCore` root export carries no build.lib).
7714
7786
  *
7787
+ * @param browser - Whether a declared browser environment enables the shared CSS pipeline.
7715
7788
  * @returns The core environment `vite.config.ts` file content, newline-terminated.
7716
7789
  *
7717
7790
  * @example
@@ -7719,12 +7792,11 @@ function coreTsconfig() {
7719
7792
  * coreViteConfig().includes('srcCore(') // true
7720
7793
  * ```
7721
7794
  */
7722
- function coreViteConfig() {
7795
+ function coreViteConfig(browser = true) {
7723
7796
  return `import { defineConfig } from 'vite'
7724
7797
  import dts from 'vite-plugin-dts'
7725
7798
  import {
7726
- ENVIRONMENT_CSS,
7727
- environmentBoundary,
7799
+ ${browser ? " ENVIRONMENT_CSS,\n" : ""} environmentBoundary,
7728
7800
  outputBoundary,
7729
7801
  srcCore,
7730
7802
  resolveWorkspacePath,
@@ -7732,8 +7804,7 @@ import {
7732
7804
 
7733
7805
  export default defineConfig(
7734
7806
  srcCore({
7735
- css: ENVIRONMENT_CSS,
7736
- publicDir: false,
7807
+ ${browser ? " css: ENVIRONMENT_CSS,\n" : ""} publicDir: false,
7737
7808
  plugins: [
7738
7809
  outputBoundary('dist/src/core'),
7739
7810
  environmentBoundary('src/core'),
@@ -7955,6 +8026,7 @@ ${spec.engine || spec.src.includes("browser") || spec.app.includes("browser") ?
7955
8026
  * ```
7956
8027
  */
7957
8028
  function configArtifacts(spec) {
8029
+ const machinery = viteMachinery(spec.src, spec.app, spec.engine);
7958
8030
  const artifacts = [{
7959
8031
  path: "tsconfig.json",
7960
8032
  group: "configs",
@@ -7970,7 +8042,7 @@ function configArtifacts(spec) {
7970
8042
  const row = SRC_MATRIX[environment];
7971
8043
  for (const path of row.configs) {
7972
8044
  const isTsconfig = path.endsWith(".json");
7973
- const content = environment === "core" ? isTsconfig ? coreTsconfig() : coreViteConfig() : isTsconfig ? srcTsconfig(environment) : srcViteConfig(environment);
8045
+ const content = environment === "core" ? isTsconfig ? coreTsconfig() : coreViteConfig(machinery.browser) : isTsconfig ? srcTsconfig(environment) : srcViteConfig(environment);
7974
8046
  artifacts.push({
7975
8047
  path,
7976
8048
  group: "configs",
@@ -9106,6 +9178,6 @@ function createBlueprint(data) {
9106
9178
  return candidate;
9107
9179
  }
9108
9180
  //#endregion
9109
- export { APP_BROWSER_DEV_DEPENDENCIES, APP_MATRIX, BASE_DEV_DEPENDENCIES, CATEGORIES, CHECKOUT_ACTION_SHA, COMPILER_ID, COMPILE_STAGES, CONST_KEYWORD, CONTROL_CHARACTER_PATTERN, Compiler, DEFAULT_ENGINES, DEFAULT_VERSION, DEPENDENCY_NAME_PATTERN, ENGINES_PATTERN, ENVIRONMENTS, EXPORT_KEYWORD, EXTRA_NAME_PATTERN, EXTRA_RANGE_PATTERN, FRESHNESS, FUNCTION_KEYWORD, GROUPS, HEX_PATTERN, HOST_PATHS, IMPORT_KEYWORD, INVALID_PATH_CHARACTER_PATTERN, JSON_PRINT_WIDTH, JSON_TAB_WIDTH, MAX_ARTIFACT_BYTES, MAX_ARTIFACT_HEX_LENGTH, MAX_COLLECTION_ITEMS, MAX_DATA_GRAPH_KEYS, MAX_DATA_GRAPH_NODES, MAX_DEPENDENCY_NAME_LENGTH, MAX_MANIFEST_BYTES, MAX_NAME_LENGTH, MAX_PATH_LENGTH, MAX_RANGE_LENGTH, MAX_SERIALIZED_INPUT_BYTES, MAX_TOTAL_ARTIFACT_BYTES, MINIMUM_NODE_VERSION, NAME_PATTERN, ORIGINS, ORKESTREL_RANGE_PATTERN, PlanManager, SCAFFOLD_RANGE, SETUP_NODE_ACTION_SHA, SOURCE_BROWSER_DEV_DEPENDENCIES, SRC_MATRIX, SYNC_BASELINE_PATTERN, ScaffoldError, TEMPLATES, TYPESCRIPT_EXTENSIONS, VERSION_PATTERN, alignTable, appTsconfig, appViteConfig, applicationArtifacts, applicationViteConfig, applyOverrides, artifactShape, auditToReview, blueprint, blueprintShape, blueprintToMembers, blueprintToPlan, bytesToHex, catalogNames, catalogToBlock, ciWorkflow, compareCodeUnit, computeColumnWidth, computeHash, configArtifacts, contentByteLength, contentCodePoint, contentToBytes, contentToHex, coreTsconfig, coreViteConfig, createBlueprint, createCompiler, createPlanManager, delimiterCell, dependency, dependencyShape, devDependenciesFor, diffPlan, dualCondition, entryFields, escapeHtmlText, exportsMap, fillArtifact, findFileConflict, findPathConflict, formatJson, guideArtifacts, guideMemberTable, guideMethods, guideTests, guideUsage, hasBlueprintEnvironment, hasOnlyDataProperties, hasValidArtifactBytes, hasValidArtifactHex, hasValidAuditBytes, hasValidBlueprintBytes, hasValidOverrideBytes, hasValidPlanBytes, hasValidPlanHex, hasValidSnapshotBytes, hasValidSyncReportBytes, hostGroup, inferGroup, isArtifact, isBehind, isBlueprint, isCompilerEventHooks, isDenseDataArray, isDependency, isEmitterErrorHandler, isMember, isOverride, isPlan, isPlanManagerEventHooks, isScaffoldError, isSyncReport, isWorkspaceName, manifestToDependencies, member, memberShape, override, overrideShape, ownDataValue, packageManifest, padCell, paritySpecifiers, parseBlueprint, parseBoundedJSON, parseCompilerOptions, parsePlan, parsePlanIds, parsePlanManagerOptions, parseSyncReport, pascalCase, pinPlan, planPayload, planShape, planToReview, planToSummary, policyViteProject, rangeToFreshness, renderArray, renderObject, renderValue, rootTsconfig, rootViteConfig, serializeTypeScriptString, singleSrcViteConfig, snapshotOf, snapshotPlan, sourceArtifacts, splitTableRow, srcTsconfig, srcVariant, srcViteConfig, stableStringify, syncReportShape, syncToReview, testArtifacts, validateBlueprint, validateDependencyArray, validatePlan, viteHeader };
9181
+ export { APP_BROWSER_DEV_DEPENDENCIES, APP_MATRIX, BASE_DEV_DEPENDENCIES, CATEGORIES, CHECKOUT_ACTION_SHA, COMPILER_ID, COMPILE_STAGES, CONST_KEYWORD, CONTROL_CHARACTER_PATTERN, Compiler, DEFAULT_ENGINES, DEFAULT_VERSION, DEPENDENCY_NAME_PATTERN, ENGINES_PATTERN, ENVIRONMENTS, EXPORT_KEYWORD, EXTRA_NAME_PATTERN, EXTRA_RANGE_PATTERN, FRESHNESS, FUNCTION_KEYWORD, GROUPS, HEX_PATTERN, HOST_PATHS, IMPORT_KEYWORD, INVALID_PATH_CHARACTER_PATTERN, JSON_PRINT_WIDTH, JSON_TAB_WIDTH, MAX_ARTIFACT_BYTES, MAX_ARTIFACT_HEX_LENGTH, MAX_COLLECTION_ITEMS, MAX_DATA_GRAPH_KEYS, MAX_DATA_GRAPH_NODES, MAX_DEPENDENCY_NAME_LENGTH, MAX_MANIFEST_BYTES, MAX_NAME_LENGTH, MAX_PATH_LENGTH, MAX_RANGE_LENGTH, MAX_SERIALIZED_INPUT_BYTES, MAX_TOTAL_ARTIFACT_BYTES, MINIMUM_NODE_VERSION, NAME_PATTERN, ORIGINS, ORKESTREL_RANGE_PATTERN, PlanManager, SCAFFOLD_RANGE, SETUP_NODE_ACTION_SHA, SOURCE_BROWSER_DEV_DEPENDENCIES, SRC_MATRIX, SYNC_BASELINE_PATTERN, ScaffoldError, TEMPLATES, TYPESCRIPT_EXTENSIONS, VERSION_PATTERN, alignTable, appTsconfig, appViteConfig, applicationArtifacts, applicationViteConfig, applyOverrides, artifactShape, auditToReview, blueprint, blueprintShape, blueprintToMembers, blueprintToPlan, bytesToHex, catalogNames, catalogToBlock, ciWorkflow, compareCodeUnit, computeColumnWidth, computeHash, configArtifacts, contentByteLength, contentCodePoint, contentToBytes, contentToHex, coreTsconfig, coreViteConfig, createBlueprint, createCompiler, createPlanManager, delimiterCell, dependency, dependencyShape, devDependenciesFor, diffPlan, dualCondition, entryFields, escapeHtmlText, exportsMap, fillArtifact, findFileConflict, findPathConflict, formatJson, guideArtifacts, guideMemberTable, guideMethods, guideTests, guideUsage, hasBlueprintEnvironment, hasOnlyDataProperties, hasValidArtifactBytes, hasValidArtifactHex, hasValidAuditBytes, hasValidBlueprintBytes, hasValidOverrideBytes, hasValidPlanBytes, hasValidPlanHex, hasValidSnapshotBytes, hasValidSyncReportBytes, hostGroup, inferGroup, isArtifact, isBehind, isBlueprint, isCompilerEventHooks, isDenseDataArray, isDependency, isEmitterErrorHandler, isMember, isOverride, isPlan, isPlanManagerEventHooks, isScaffoldError, isSyncReport, isWorkspaceName, manifestToDependencies, member, memberShape, override, overrideShape, ownDataValue, packageManifest, padCell, paritySpecifiers, parseBlueprint, parseBoundedJSON, parseCompilerOptions, parsePlan, parsePlanIds, parsePlanManagerOptions, parseSyncReport, pascalCase, pinPlan, planPayload, planShape, planToReview, planToSummary, policyViteProject, rangeToFreshness, renderArray, renderObject, renderValue, rootTsconfig, rootViteConfig, serializeTypeScriptString, singleSrcViteConfig, snapshotOf, snapshotPlan, sourceArtifacts, splitTableRow, srcTsconfig, srcVariant, srcViteConfig, stableStringify, syncReportShape, syncToReview, testArtifacts, validateBlueprint, validateDependencyArray, validatePlan, viteHeader, viteMachinery };
9110
9182
 
9111
9183
  //# sourceMappingURL=index.js.map