@orkestrel/scaffold 0.0.17 → 0.0.18
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/tests/setupPolicy.ts +4 -3
- package/dist/src/core/index.cjs +27 -31
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +1 -1
- package/dist/src/core/index.d.ts +1 -1
- package/dist/src/core/index.js +27 -31
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +2 -2
- package/dist/src/server/index.cjs.map +1 -1
- package/package.json +4 -4
|
@@ -240,7 +240,7 @@ export function isSelfContained(source: ts.SourceFile): boolean {
|
|
|
240
240
|
const clause = statement.importClause
|
|
241
241
|
const named = clause?.namedBindings
|
|
242
242
|
const erased =
|
|
243
|
-
clause?.
|
|
243
|
+
clause?.phaseModifier === ts.SyntaxKind.TypeKeyword ||
|
|
244
244
|
(clause !== undefined &&
|
|
245
245
|
clause.name === undefined &&
|
|
246
246
|
named !== undefined &&
|
|
@@ -248,8 +248,9 @@ export function isSelfContained(source: ts.SourceFile): boolean {
|
|
|
248
248
|
named.elements.length > 0 &&
|
|
249
249
|
named.elements.every((element) => element.isTypeOnly))
|
|
250
250
|
if (erased) continue
|
|
251
|
-
|
|
252
|
-
|
|
251
|
+
const moduleSpecifier = statement.moduleSpecifier
|
|
252
|
+
if (!ts.isStringLiteral(moduleSpecifier)) return false
|
|
253
|
+
const specifier = moduleSpecifier.text
|
|
253
254
|
if (!specifier.startsWith('node:') || !isBuiltin(specifier)) return false
|
|
254
255
|
builtin = true
|
|
255
256
|
}
|
package/dist/src/core/index.cjs
CHANGED
|
@@ -227,7 +227,7 @@ var DEFAULT_VERSION = "0.0.1";
|
|
|
227
227
|
/** The `engines.node` range the `blueprint` builder fills. */
|
|
228
228
|
var DEFAULT_ENGINES = `>=${MINIMUM_NODE_VERSION}`;
|
|
229
229
|
/** The devDependency range generated packages pin `@orkestrel/scaffold` at. */
|
|
230
|
-
var SCAFFOLD_RANGE = "^0.0.
|
|
230
|
+
var SCAFFOLD_RANGE = "^0.0.18";
|
|
231
231
|
/** Tooling versions shared by scaffold and every generated workspace. */
|
|
232
232
|
var BASE_DEV_DEPENDENCIES = Object.freeze({
|
|
233
233
|
"@microsoft/api-extractor": "^7.58.12",
|
|
@@ -4467,9 +4467,7 @@ describe('createApplication', () => {
|
|
|
4467
4467
|
'x'.repeat(204),
|
|
4468
4468
|
\`\${' '.repeat(MAX_APPLICATION_NAME_INPUT_LENGTH)}x\`,
|
|
4469
4469
|
]) {
|
|
4470
|
-
expect(() => Reflect.apply(createApplication, undefined, [value])).
|
|
4471
|
-
ApplicationError,
|
|
4472
|
-
)
|
|
4470
|
+
expect(() => Reflect.apply(createApplication, undefined, [value])).toThrow(ApplicationError)
|
|
4473
4471
|
}
|
|
4474
4472
|
const error = new ApplicationError('CONFIG', 'invalid')
|
|
4475
4473
|
expect(isApplicationError(error)).toBe(true)
|
|
@@ -4544,7 +4542,7 @@ describe('createBrowserApplication', () => {
|
|
|
4544
4542
|
{ name: 'x'.repeat(204) },
|
|
4545
4543
|
{ name: \`\${' '.repeat(MAX_BROWSER_APPLICATION_NAME_INPUT_LENGTH)}x\` },
|
|
4546
4544
|
]) {
|
|
4547
|
-
expect(() => Reflect.apply(createBrowserApplication, undefined, [value])).
|
|
4545
|
+
expect(() => Reflect.apply(createBrowserApplication, undefined, [value])).toThrow(
|
|
4548
4546
|
BrowserApplicationError,
|
|
4549
4547
|
)
|
|
4550
4548
|
}
|
|
@@ -4569,14 +4567,14 @@ describe('createBrowserApplication', () => {
|
|
|
4569
4567
|
const revocable = Proxy.revocable({}, {})
|
|
4570
4568
|
revocable.revoke()
|
|
4571
4569
|
|
|
4572
|
-
expect(() => parseBrowserApplicationOptions(accessor)).
|
|
4570
|
+
expect(() => parseBrowserApplicationOptions(accessor)).toThrow(BrowserApplicationError)
|
|
4573
4571
|
expect(reads).toBe(0)
|
|
4574
|
-
expect(() => Reflect.apply(createBrowserApplication, undefined, [hostile])).
|
|
4572
|
+
expect(() => Reflect.apply(createBrowserApplication, undefined, [hostile])).toThrow(
|
|
4573
|
+
BrowserApplicationError,
|
|
4574
|
+
)
|
|
4575
|
+
expect(() => Reflect.apply(createBrowserApplication, undefined, [revocable.proxy])).toThrow(
|
|
4575
4576
|
BrowserApplicationError,
|
|
4576
4577
|
)
|
|
4577
|
-
expect(() =>
|
|
4578
|
-
Reflect.apply(createBrowserApplication, undefined, [revocable.proxy]),
|
|
4579
|
-
).toThrowError(BrowserApplicationError)
|
|
4580
4578
|
expect(isBrowserApplicationError(new BrowserApplicationError('CONFIG', 'invalid'))).toBe(true)
|
|
4581
4579
|
expect(isBrowserApplicationError(new Error('plain'))).toBe(false)
|
|
4582
4580
|
expect(isBrowserApplicationError(revocable.proxy)).toBe(false)
|
|
@@ -4679,20 +4677,20 @@ describe('ApplicationServer', () => {
|
|
|
4679
4677
|
})
|
|
4680
4678
|
|
|
4681
4679
|
it('validates direct options before allocating a listener', () => {
|
|
4682
|
-
expect(() => createApplicationServer({ host: ' ' })).
|
|
4680
|
+
expect(() => createApplicationServer({ host: ' ' })).toThrow(
|
|
4683
4681
|
expect.objectContaining({ code: 'CONFIG' }),
|
|
4684
4682
|
)
|
|
4685
|
-
expect(() => createApplicationServer({ port: Number.NaN })).
|
|
4683
|
+
expect(() => createApplicationServer({ port: Number.NaN })).toThrow(
|
|
4686
4684
|
expect.objectContaining({ code: 'CONFIG' }),
|
|
4687
4685
|
)
|
|
4688
|
-
expect(() => createApplicationServer({ port: -1 })).
|
|
4686
|
+
expect(() => createApplicationServer({ port: -1 })).toThrow(
|
|
4689
4687
|
expect.objectContaining({ code: 'CONFIG' }),
|
|
4690
4688
|
)
|
|
4691
|
-
expect(() => createApplicationServer({ timeout: 0 })).
|
|
4689
|
+
expect(() => createApplicationServer({ timeout: 0 })).toThrow(
|
|
4692
4690
|
expect.objectContaining({ code: 'CONFIG' }),
|
|
4693
4691
|
)
|
|
4694
4692
|
for (const value of [null, 42, [], { host: 42 }, { port: [42] }]) {
|
|
4695
|
-
expect(() => Reflect.apply(createApplicationServer, undefined, [value])).
|
|
4693
|
+
expect(() => Reflect.apply(createApplicationServer, undefined, [value])).toThrow(
|
|
4696
4694
|
expect.objectContaining({ code: 'CONFIG' }),
|
|
4697
4695
|
)
|
|
4698
4696
|
}
|
|
@@ -4712,14 +4710,10 @@ describe('ApplicationServer', () => {
|
|
|
4712
4710
|
expect(server.port).toBe(0)
|
|
4713
4711
|
|
|
4714
4712
|
process.env.APP_PORT = '1e3'
|
|
4715
|
-
expect(() => createApplicationServer()).
|
|
4716
|
-
expect.objectContaining({ code: 'CONFIG' }),
|
|
4717
|
-
)
|
|
4713
|
+
expect(() => createApplicationServer()).toThrow(expect.objectContaining({ code: 'CONFIG' }))
|
|
4718
4714
|
process.env.APP_PORT = '0'
|
|
4719
4715
|
process.env.APP_START_TIMEOUT = '0'
|
|
4720
|
-
expect(() => createApplicationServer()).
|
|
4721
|
-
expect.objectContaining({ code: 'CONFIG' }),
|
|
4722
|
-
)
|
|
4716
|
+
expect(() => createApplicationServer()).toThrow(expect.objectContaining({ code: 'CONFIG' }))
|
|
4723
4717
|
} finally {
|
|
4724
4718
|
if (previousHost === undefined) delete process.env.APP_HOST
|
|
4725
4719
|
else process.env.APP_HOST = previousHost
|
|
@@ -5088,15 +5082,13 @@ describe('application environment parsers', () => {
|
|
|
5088
5082
|
'999.999.999.999',
|
|
5089
5083
|
\`\${'a'.repeat(64)}.example\`,
|
|
5090
5084
|
])('rejects hostile APP_HOST value %s before listener allocation', (value) => {
|
|
5091
|
-
expect(() => parseApplicationHost(value)).
|
|
5092
|
-
expect.objectContaining({ code: 'CONFIG' }),
|
|
5093
|
-
)
|
|
5085
|
+
expect(() => parseApplicationHost(value)).toThrow(expect.objectContaining({ code: 'CONFIG' }))
|
|
5094
5086
|
})
|
|
5095
5087
|
|
|
5096
5088
|
it.each([null, 42, [], { port: [42] }, { timeout: 0 }])(
|
|
5097
5089
|
'rejects hostile option container or leaf value %#',
|
|
5098
5090
|
(value) => {
|
|
5099
|
-
expect(() => parseApplicationServerOptions(value)).
|
|
5091
|
+
expect(() => parseApplicationServerOptions(value)).toThrow(
|
|
5100
5092
|
expect.objectContaining({ code: 'CONFIG' }),
|
|
5101
5093
|
)
|
|
5102
5094
|
},
|
|
@@ -5119,7 +5111,7 @@ describe('application environment parsers', () => {
|
|
|
5119
5111
|
])(
|
|
5120
5112
|
'rejects inherited, unknown, symbolic, accessor, instance, and hostile proxy options %#',
|
|
5121
5113
|
(value) => {
|
|
5122
|
-
expect(() => parseApplicationServerOptions(value)).
|
|
5114
|
+
expect(() => parseApplicationServerOptions(value)).toThrow(
|
|
5123
5115
|
expect.objectContaining({ code: 'CONFIG' }),
|
|
5124
5116
|
)
|
|
5125
5117
|
},
|
|
@@ -5630,7 +5622,7 @@ function packageManifest(spec) {
|
|
|
5630
5622
|
}
|
|
5631
5623
|
if (spec.bin) scripts["test:src:bin"] = "vitest run --config vite.config.ts --no-cache --reporter=dot --project src:bin";
|
|
5632
5624
|
if (spec.integration) scripts["test:integration"] = "vitest run --config vite.config.ts --no-cache --reporter=dot --project integration";
|
|
5633
|
-
if (spec.bin && spec.integration) scripts["test:equivalence"] = "node -e \"const c=require('node:child_process'),
|
|
5625
|
+
if (spec.bin && spec.integration) scripts["test:equivalence"] = "node -e \"const c=require('node:child_process'),p=process.env.npm_execpath;if(p===undefined)process.exit(1);const r=c.spawnSync(process.execPath,[p,'run','test:integration'],{stdio:'inherit',env:{...process.env,SCAFFOLD_BOUNDARY_EQUIVALENCE:'1'}});process.exit(r.status??1)\"";
|
|
5634
5626
|
if (spec.service) scripts["test:service"] = "vitest run --config vite.config.ts --no-cache --reporter=dot --project service";
|
|
5635
5627
|
if (spec.app.length > 0) {
|
|
5636
5628
|
scripts["test:app"] = "vitest run --config vite.config.ts --no-cache --reporter=dot " + spec.app.map((environment) => `--project ${APP_MATRIX[environment].project}`).join(" ");
|
|
@@ -5724,6 +5716,7 @@ function rootTsconfig(src, app = []) {
|
|
|
5724
5716
|
target: "ESNext",
|
|
5725
5717
|
module: "ESNext",
|
|
5726
5718
|
moduleResolution: "bundler",
|
|
5719
|
+
allowImportingTsExtensions: true,
|
|
5727
5720
|
lib: [
|
|
5728
5721
|
"ESNext",
|
|
5729
5722
|
"DOM",
|
|
@@ -7824,6 +7817,7 @@ ${EXPORT_KEYWORD} const srcServer = (config?: UserConfig): UserConfig =>
|
|
|
7824
7817
|
outDir: 'dist/src/server',
|
|
7825
7818
|
target: 'node22',
|
|
7826
7819
|
rolldownOptions: {
|
|
7820
|
+
platform: 'node',
|
|
7827
7821
|
external: (id: string) => id.startsWith('node:') || id.startsWith('@orkestrel/'),
|
|
7828
7822
|
},
|
|
7829
7823
|
},
|
|
@@ -7947,6 +7941,7 @@ ${EXPORT_KEYWORD} const srcServer = (config?: UserConfig): UserConfig =>
|
|
|
7947
7941
|
outDir: 'dist/src/server',
|
|
7948
7942
|
target: 'node22',
|
|
7949
7943
|
rolldownOptions: {
|
|
7944
|
+
platform: 'node',
|
|
7950
7945
|
external: (id: string) =>
|
|
7951
7946
|
id === '@src/core' || id.startsWith('node:') || id.startsWith('@orkestrel/'),
|
|
7952
7947
|
output: [
|
|
@@ -8131,6 +8126,7 @@ ${EXPORT_KEYWORD} const srcServer = (config?: UserConfig): UserConfig =>
|
|
|
8131
8126
|
outDir: 'dist/src/server',
|
|
8132
8127
|
target: 'node22',
|
|
8133
8128
|
rolldownOptions: {
|
|
8129
|
+
platform: 'node',
|
|
8134
8130
|
external: (id: string) =>
|
|
8135
8131
|
${coreExternal}id.startsWith('node:') || id.startsWith('@orkestrel/'),${coreOutput}
|
|
8136
8132
|
},
|
|
@@ -8309,7 +8305,7 @@ import {
|
|
|
8309
8305
|
outputBoundary,
|
|
8310
8306
|
srcCore,
|
|
8311
8307
|
resolveWorkspacePath,
|
|
8312
|
-
} from '../../vite.config'
|
|
8308
|
+
} from '../../vite.config.ts'
|
|
8313
8309
|
|
|
8314
8310
|
export default defineConfig(
|
|
8315
8311
|
srcCore({
|
|
@@ -8394,7 +8390,7 @@ function srcViteConfig(environment) {
|
|
|
8394
8390
|
const anchor = environment === "browser" ? "srcBrowser" : "srcServer";
|
|
8395
8391
|
return `import { defineConfig } from 'vite'
|
|
8396
8392
|
import dts from 'vite-plugin-dts'
|
|
8397
|
-
import { ${anchor}, resolveWorkspacePath } from '../../vite.config'
|
|
8393
|
+
import { ${anchor}, resolveWorkspacePath } from '../../vite.config.ts'
|
|
8398
8394
|
|
|
8399
8395
|
// Types are bundled inline by vite-plugin-dts (see configs/src/vite.core.config.ts
|
|
8400
8396
|
// for the same pattern).
|
|
@@ -8447,7 +8443,7 @@ function binTsconfig() {
|
|
|
8447
8443
|
*/
|
|
8448
8444
|
function binViteConfig() {
|
|
8449
8445
|
return `import { defineConfig } from 'vite'
|
|
8450
|
-
import { srcBin } from '../../vite.config'
|
|
8446
|
+
import { srcBin } from '../../vite.config.ts'
|
|
8451
8447
|
|
|
8452
8448
|
// The \`scaffold\` executable build — a single ESM lib file, no declarations (an
|
|
8453
8449
|
// executable ships no types), with the \`#!/usr/bin/env node\` shebang re-emitted via
|
|
@@ -8514,7 +8510,7 @@ function appTsconfig(environment, hasCore) {
|
|
|
8514
8510
|
function appViteConfig(environment) {
|
|
8515
8511
|
const anchor = environment === "browser" ? "appBrowser" : "appServer";
|
|
8516
8512
|
return `import { defineConfig } from 'vite'
|
|
8517
|
-
import { ${anchor} } from '../../vite.config'
|
|
8513
|
+
import { ${anchor} } from '../../vite.config.ts'
|
|
8518
8514
|
|
|
8519
8515
|
export default defineConfig(${anchor}())
|
|
8520
8516
|
`;
|