tungsten 0.5.0 → 0.5.1
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/.build-complete +1 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/Framework.d.ts.map +1 -1
- package/dist/Framework.js +8 -2
- package/dist/FrameworkConfig.d.ts +0 -1
- package/dist/FrameworkConfig.d.ts.map +1 -1
- package/dist/Servers/loadEnvsDev.d.ts.map +1 -1
- package/dist/Servers/loadEnvsDev.js +6 -1
- package/dist/env/droppedCoreEnvKeys.d.ts +5 -0
- package/dist/env/droppedCoreEnvKeys.d.ts.map +1 -0
- package/dist/env/droppedCoreEnvKeys.js +9 -0
- package/dist/frameworkConfigSchema.d.ts +11 -0
- package/dist/frameworkConfigSchema.d.ts.map +1 -1
- package/dist/frameworkConfigSchema.js +14 -1
- package/dist/getUserConfig.d.ts.map +1 -1
- package/dist/getUserConfig.js +7 -2
- package/dist/headChildren.d.ts +2 -0
- package/dist/headChildren.d.ts.map +1 -0
- package/dist/headChildren.js +16 -0
- package/dist/hydrate/hydrate.d.ts.map +1 -1
- package/dist/hydrate/hydrate.js +12 -17
- package/dist/render/addImportMap.d.ts.map +1 -1
- package/dist/render/addImportMap.js +1 -0
- package/dist/render/processHead.d.ts.map +1 -1
- package/dist/render/processHead.js +18 -12
- package/dist/update/integrateUpdateVdom.d.ts.map +1 -1
- package/dist/update/integrateUpdateVdom.js +3 -1
- package/package.json +1 -1
package/dist/Framework.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Framework.d.ts","sourceRoot":"","sources":["../src/Framework.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAMrC,OAAO,EAAE,SA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AWd,mBAAmB;YAcnB,MAAM;IAcd,eAAe,IAAI,OAAO,CAAC,SAAS,CAAC;IAgCrC,aAAa,CAAC,MAAM,EAAE,uBAAuB;IA0J7C,gBAAgB,IAAI,OAAO,CAAC,UAAU,CAAC;CAiEhD"}
|
package/dist/Framework.js
CHANGED
|
@@ -16,7 +16,8 @@ import { createInstanceConfigFile } from './build/createInstanceConfigFile.js';
|
|
|
16
16
|
import { createClientFiles } from './build/createClientFiles.js';
|
|
17
17
|
import { bundle } from './build/bundle.js';
|
|
18
18
|
import { TungstenError } from './TungstenError.js';
|
|
19
|
-
import { cliNews, cliOut } from './cliOutput.js';
|
|
19
|
+
import { cliNews, cliOut, cliWarn } from './cliOutput.js';
|
|
20
|
+
import { droppedCoreEnvKeys, droppedCoreEnvWarning } from './env/droppedCoreEnvKeys.js';
|
|
20
21
|
import { staticGen } from './staticGen/staticGen.js';
|
|
21
22
|
import { combineComponentCss } from './build/combineComponentCss.js';
|
|
22
23
|
import { frameworkCssPath } from './build/frameworkStylesheets.js';
|
|
@@ -244,6 +245,8 @@ export class Framework {
|
|
|
244
245
|
throwError('Framework.createEnvProd()', 'Your environment variables failed your private env schema (registerPrivateEnvSchema)\n' + privateResult.problems);
|
|
245
246
|
}
|
|
246
247
|
checkIsObject('Framework.createEnvProd()', 'the private env schema', privateResult.value);
|
|
248
|
+
const dropped = droppedCoreEnvKeys(tungstenCorePrivateEnvSchema, process.env, privateResult.value);
|
|
249
|
+
if (dropped.length > 0) cliWarn(droppedCoreEnvWarning('private', 'registerPrivateEnvSchema', dropped));
|
|
247
250
|
// tungstenCorePrivateEnvSchema has been configured not to mutate the result
|
|
248
251
|
// although this could change in if it is changed in the future
|
|
249
252
|
// we could toss the result of this parse and just use privateEnv
|
|
@@ -265,11 +268,14 @@ export class Framework {
|
|
|
265
268
|
// (key, value) => [key.slice('TUNGSTEN_PUBLIC_'.length), value]
|
|
266
269
|
// )
|
|
267
270
|
//console.log('env filtered for public env', filteredEnv)
|
|
268
|
-
const
|
|
271
|
+
const publicEnvInput = objectRemap(objectFilter(process.env, key => key.startsWith('TUNGSTEN_PUBLIC_')), (key, value) => [key.slice('TUNGSTEN_PUBLIC_'.length), value]);
|
|
272
|
+
const publicResult = await validate(envSchemas.publicEnvSchema, publicEnvInput);
|
|
269
273
|
if (!publicResult.success) {
|
|
270
274
|
throwError('Framework.createEnvProd()', 'Your public environment variables failed your public env schema (registerPublicEnvSchema)\n' + publicResult.problems);
|
|
271
275
|
}
|
|
272
276
|
checkIsObject('Framework.createEnvProd()', 'the public env schema', publicResult.value);
|
|
277
|
+
const dropped = droppedCoreEnvKeys(tungstenCorePublicEnvSchema, publicEnvInput, publicResult.value);
|
|
278
|
+
if (dropped.length > 0) cliWarn(droppedCoreEnvWarning('public', 'registerPublicEnvSchema', dropped));
|
|
273
279
|
const coreResult = await validate(tungstenCorePublicEnvSchema, publicResult.value);
|
|
274
280
|
if (!coreResult.success) {
|
|
275
281
|
throwError('Framework.createEnvProd()', 'Your public environment variables don\'t meet the Tungsten requirements\n' + coreResult.problems);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrameworkConfig.d.ts","sourceRoot":"","sources":["../src/FrameworkConfig.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,IAAI,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAA;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAGnD,KAAK,WAAW,GAAG,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAC5C,KAAK,cAAc,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AACtC,KAAK,kBAAkB,GAAG,MAAM,CAAA;AAEhC,MAAM,MAAM,oBAAoB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;AA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EAAE,CAAA;KAC9B,CAAA;IACD,sBAAsB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC1C,gBAAgB,CAAC,EAAE,oBAAoB,CAAA;IACvC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IAGf,qBAAqB,EAAE,OAAO,CAAA;IAC9B,6BAA6B,EAAE,OAAO,CAAA;IACtC,4BAA4B,EAAE,OAAO,CAAA;IAErC,qBAAqB,EAAE,OAAO,CAAA;IAC9B,GAAG,EAAE,OAAO,GAAG,QAAQ,CAAA;IACvB,GAAG,EAAE,OAAO,CAAA;CACf,CAAA;AAED,MAAM,MAAM,wCAAwC,GAC9C,2BAA2B,GAAG;IAC5B,gBAAgB,EAAE,IAAI,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;CACxB,CAAA;AAEL,MAAM,MAAM,2CAA2C,GACjD,2BAA2B,GAAG;IAC5B,gBAAgB,EAAE,KAAK,CAAA;CAC1B,CAAA;AAEL,MAAM,MAAM,uBAAuB,GAC7B,wCAAwC,GAAG,2CAA2C,CAAA;AAI5F,MAAM,MAAM,wBAAwB,GAAG,IAAI,CACvC,2BAA2B,EAC/B,YAAY,GAAG,gBAAgB,CAC9B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadEnvsDev.d.ts","sourceRoot":"","sources":["../../src/Servers/loadEnvsDev.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"loadEnvsDev.d.ts","sourceRoot":"","sources":["../../src/Servers/loadEnvsDev.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAWpE,KAAK,UAAU,GAAG;IACd,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAChC,EAAE,CAAC,EAAE,MAAM,CAAC;CACf,CAAA;AAED,wBAAsB,WAAW,CAC7B,MAAM,EAAE,uBAAuB,EAE/B,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,UAAU,EAC7B,UAAU,EAAE,OAAO,EACnB,eAAe,UAAQ,EAEvB,eAAe,CAAC,EAAE,MAAM,iBAkI3B"}
|
|
@@ -3,7 +3,8 @@ import { readFile as readFilePromise, access as accessPromise } from 'fs/promise
|
|
|
3
3
|
import { remap as objectRemap, filter as objectFilter } from 'sxy-lib/objects.js';
|
|
4
4
|
import { getEnvSchemasDev } from '../env/getEnvSchemas.js';
|
|
5
5
|
import dotenv from 'dotenv';
|
|
6
|
-
import { cliLog, cliOut } from '../cliOutput.js';
|
|
6
|
+
import { cliLog, cliOut, cliWarn } from '../cliOutput.js';
|
|
7
|
+
import { droppedCoreEnvKeys, droppedCoreEnvWarning } from '../env/droppedCoreEnvKeys.js';
|
|
7
8
|
import { addToEnv } from '../env/addToEnv.js';
|
|
8
9
|
import { throwError } from 'tungsten/throwError.js';
|
|
9
10
|
import { tungstenCorePrivateEnvSchema } from './tungstenCorePrivateEnvSchema.js';
|
|
@@ -71,6 +72,8 @@ buildCodeFolder) {
|
|
|
71
72
|
throwError('Your environment variables failed your private env schema (registerPrivateEnvSchema)', '\n' + result.problems + '\nenv: ' + JSON.stringify(tempEnv, null, 4));
|
|
72
73
|
}
|
|
73
74
|
checkIsObject('loadEnvsDev()', 'the private env schema', result.value);
|
|
75
|
+
const dropped = droppedCoreEnvKeys(tungstenCorePrivateEnvSchema, tempEnv, result.value);
|
|
76
|
+
if (dropped.length > 0) cliWarn(droppedCoreEnvWarning('private', 'registerPrivateEnvSchema', dropped));
|
|
74
77
|
const coreResult = await validate(tungstenCorePrivateEnvSchema, result.value);
|
|
75
78
|
if (!coreResult.success) {
|
|
76
79
|
throwError('Your private environment variables don\'t meet the Tungsten requirements. Check .env / .env.private and the schema given to registerPrivateEnvSchema - it may need to coerce a value to the right type.',
|
|
@@ -91,6 +94,8 @@ buildCodeFolder) {
|
|
|
91
94
|
throwError('Your public environment variables failed your public env schema (registerPublicEnvSchema)', '\n' + result.problems + '\nenv: ' + JSON.stringify(tempEnv, null, 4) + '\nparsed public env ' + JSON.stringify(tempPublicEnv, null, 4));
|
|
92
95
|
}
|
|
93
96
|
checkIsObject('loadEnvsDev()', 'the public env schema', result.value);
|
|
97
|
+
const dropped = droppedCoreEnvKeys(tungstenCorePublicEnvSchema, tempPublicEnv, result.value);
|
|
98
|
+
if (dropped.length > 0) cliWarn(droppedCoreEnvWarning('public', 'registerPublicEnvSchema', dropped));
|
|
94
99
|
const coreResult = await validate(tungstenCorePublicEnvSchema, result.value);
|
|
95
100
|
if (!coreResult.success) {
|
|
96
101
|
throwError('Your public environment variables don\'t meet the Tungsten requirements. Check .env.public and the schema given to registerPublicEnvSchema - it may need to coerce a value to the right type.',
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function droppedCoreEnvKeys(coreSchema: {
|
|
2
|
+
entries: object;
|
|
3
|
+
}, input: object, output: object): string[];
|
|
4
|
+
export declare function droppedCoreEnvWarning(which: 'private' | 'public', registerName: string, keys: string[]): string;
|
|
5
|
+
//# sourceMappingURL=droppedCoreEnvKeys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"droppedCoreEnvKeys.d.ts","sourceRoot":"","sources":["../../src/env/droppedCoreEnvKeys.ts"],"names":[],"mappings":"AAIA,wBAAgB,kBAAkB,CAAC,UAAU,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAE3G;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,SAAS,GAAG,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAG/G"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// The core env schemas run on the app schema's output, so an app schema that keeps only what it
|
|
2
|
+
// lists takes tungsten's own variables out before tungsten sees them. The core schema's entries
|
|
3
|
+
// are the list of what tungsten reads.
|
|
4
|
+
export function droppedCoreEnvKeys(coreSchema, input, output) {
|
|
5
|
+
return Object.keys(coreSchema.entries).filter(key => key in input && !(key in output));
|
|
6
|
+
}
|
|
7
|
+
export function droppedCoreEnvWarning(which, registerName, keys) {
|
|
8
|
+
return `The ${which} env schema (${registerName}) dropped ${keys.join(', ')}, which tungsten reads.` + ` Add ${keys.length === 1 ? 'it' : 'them'} to the schema, or use one that passes unknown keys through`;
|
|
9
|
+
}
|
|
@@ -38,6 +38,11 @@ export declare const frameworkConfigValidator: v.VariantSchema<"useRootComponent
|
|
|
38
38
|
readonly serverMiddleware: v.ExactOptionalSchema<v.TupleSchema<[v.StringSchema<undefined>, v.StringSchema<undefined>, v.StringSchema<undefined>], undefined>, undefined>;
|
|
39
39
|
readonly apiRoutes: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
40
40
|
readonly apiPath: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
41
|
+
readonly suppressNoHeadWarning: v.ExactOptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
42
|
+
readonly suppressOriginMismatchWarning: v.ExactOptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
43
|
+
readonly suppressEnvOverwriteWarnings: v.ExactOptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
44
|
+
readonly warnOnFrameworkChange: v.ExactOptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
45
|
+
readonly hmr: v.ExactOptionalSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.LiteralSchema<"reload", undefined>], undefined>, undefined>;
|
|
41
46
|
readonly csr: v.ExactOptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
42
47
|
}, undefined>, v.ObjectSchema<{
|
|
43
48
|
readonly useRootComponent: v.LiteralSchema<false, undefined>;
|
|
@@ -73,7 +78,13 @@ export declare const frameworkConfigValidator: v.VariantSchema<"useRootComponent
|
|
|
73
78
|
readonly serverMiddleware: v.ExactOptionalSchema<v.TupleSchema<[v.StringSchema<undefined>, v.StringSchema<undefined>, v.StringSchema<undefined>], undefined>, undefined>;
|
|
74
79
|
readonly apiRoutes: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
75
80
|
readonly apiPath: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
81
|
+
readonly suppressNoHeadWarning: v.ExactOptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
82
|
+
readonly suppressOriginMismatchWarning: v.ExactOptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
83
|
+
readonly suppressEnvOverwriteWarnings: v.ExactOptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
84
|
+
readonly warnOnFrameworkChange: v.ExactOptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
85
|
+
readonly hmr: v.ExactOptionalSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.LiteralSchema<"reload", undefined>], undefined>, undefined>;
|
|
76
86
|
readonly csr: v.ExactOptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
77
87
|
}, undefined>], undefined>;
|
|
78
88
|
export type FrameworkConfig = v.InferOutput<typeof frameworkConfigValidator>;
|
|
89
|
+
export declare function unknownConfigKeys(config: unknown): string[];
|
|
79
90
|
//# sourceMappingURL=frameworkConfigSchema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frameworkConfigSchema.d.ts","sourceRoot":"","sources":["../src/frameworkConfigSchema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,IAAI,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAGnD,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAI5B,MAAM,WAAW,YAAa,SAAQ,kBAAkB;CAAG;
|
|
1
|
+
{"version":3,"file":"frameworkConfigSchema.d.ts","sourceRoot":"","sources":["../src/frameworkConfigSchema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,IAAI,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAGnD,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAI5B,MAAM,WAAW,YAAa,SAAQ,kBAAkB;CAAG;AA6E3D,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAGnC,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAO5E,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,EAAE,CAG3D"}
|
|
@@ -49,6 +49,12 @@ const frameworkConfigBaseEntries = {
|
|
|
49
49
|
serverMiddleware: v.exactOptional(v.tuple([v.string(), v.string(), v.string()])),
|
|
50
50
|
apiRoutes: v.exactOptional(v.string()),
|
|
51
51
|
apiPath: v.exactOptional(v.string()),
|
|
52
|
+
suppressNoHeadWarning: v.exactOptional(v.boolean()),
|
|
53
|
+
suppressOriginMismatchWarning: v.exactOptional(v.boolean()),
|
|
54
|
+
suppressEnvOverwriteWarnings: v.exactOptional(v.boolean()),
|
|
55
|
+
// accepted but not on the public config type: a framework developer's switch
|
|
56
|
+
warnOnFrameworkChange: v.exactOptional(v.boolean()),
|
|
57
|
+
hmr: v.exactOptional(v.union([v.boolean(), v.literal('reload')])),
|
|
52
58
|
csr: v.exactOptional(v.boolean())
|
|
53
59
|
};
|
|
54
60
|
const frameworkConfigWithRootComponentSchema = v.object({
|
|
@@ -62,4 +68,11 @@ const frameworkConfigWithoutRootComponentSchema = v.object({
|
|
|
62
68
|
});
|
|
63
69
|
// variant, not union: a plain union reports one issue at the union itself ("Expected Object but
|
|
64
70
|
// received Object"), where this picks the branch by useRootComponent and reports its actual fields
|
|
65
|
-
export const frameworkConfigValidator = v.variant('useRootComponent', [frameworkConfigWithRootComponentSchema, frameworkConfigWithoutRootComponentSchema]);
|
|
71
|
+
export const frameworkConfigValidator = v.variant('useRootComponent', [frameworkConfigWithRootComponentSchema, frameworkConfigWithoutRootComponentSchema]);
|
|
72
|
+
// v.object drops keys it does not list rather than rejecting them - right for a config that may
|
|
73
|
+
// carry another tool's entries, but a typo or a removed key then vanishes silently, so name them
|
|
74
|
+
const knownConfigKeys = new Set([...Object.keys(frameworkConfigBaseEntries), 'useRootComponent', 'rootComponent']);
|
|
75
|
+
export function unknownConfigKeys(config) {
|
|
76
|
+
if (typeof config !== 'object' || config === null) return [];
|
|
77
|
+
return Object.keys(config).filter(key => !knownConfigKeys.has(key));
|
|
78
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUserConfig.d.ts","sourceRoot":"","sources":["../src/getUserConfig.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAOxF,wBAAsB,aAAa,CAC/B,SAAS,GAAE,wBAAwB,GAAG,IAAW,EACjD,MAAM,GAAE,QAAQ,GAAG,OAAiB,GACrC,OAAO,CAAC,uBAAuB,CAAC,
|
|
1
|
+
{"version":3,"file":"getUserConfig.d.ts","sourceRoot":"","sources":["../src/getUserConfig.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAOxF,wBAAsB,aAAa,CAC/B,SAAS,GAAE,wBAAwB,GAAG,IAAW,EACjD,MAAM,GAAE,QAAQ,GAAG,OAAiB,GACrC,OAAO,CAAC,uBAAuB,CAAC,CA2BlC"}
|
package/dist/getUserConfig.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { defaultConfig } from './defaultConfig.js';
|
|
2
2
|
import { findUserConfig } from './findUserConfig.js';
|
|
3
|
-
import { frameworkConfigValidator } from './frameworkConfigSchema.js';
|
|
3
|
+
import { frameworkConfigValidator, unknownConfigKeys } from './frameworkConfigSchema.js';
|
|
4
4
|
import { makeFinalConfig } from './makeFinalConfig.js';
|
|
5
5
|
import { throwError } from './throwError.js';
|
|
6
|
-
import { cliOut } from './cliOutput.js';
|
|
6
|
+
import { cliOut, cliWarn } from './cliOutput.js';
|
|
7
7
|
import { validate } from './standardSchema.js';
|
|
8
8
|
export async function getUserConfig(overrides = null, volume = 'noisy') {
|
|
9
9
|
const userConfigOrNull = await findUserConfig(process.cwd(), volume);
|
|
@@ -15,6 +15,11 @@ export async function getUserConfig(overrides = null, volume = 'noisy') {
|
|
|
15
15
|
cliOut('Config', userConfig);
|
|
16
16
|
throwError('Your tungsten config did not match the required format', '\n' + result.problems);
|
|
17
17
|
}
|
|
18
|
+
// the validator drops what it does not list: say so, as a typo would otherwise vanish
|
|
19
|
+
const unknownKeys = unknownConfigKeys(userConfig.data);
|
|
20
|
+
if (unknownKeys.length > 0 && volume !== 'silent') {
|
|
21
|
+
cliWarn(`tungsten config: ignoring unknown ${unknownKeys.length === 1 ? 'key' : 'keys'} ${unknownKeys.join(', ')}`);
|
|
22
|
+
}
|
|
18
23
|
const finalConfig = makeFinalConfig(result.value, overrides);
|
|
19
24
|
//console.log('finalConfig', finalConfig)
|
|
20
25
|
return finalConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headChildren.d.ts","sourceRoot":"","sources":["../src/headChildren.ts"],"names":[],"mappings":"AAKA,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAW9D"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// processHead unshifts everything the framework adds to the head in front of the app's own
|
|
2
|
+
// children, each marked data--t-internal (or data--t-persist, for what a re-created head keeps);
|
|
3
|
+
// dev banners are appended after them. The app's children are the contiguous run in between,
|
|
4
|
+
// and this is its start - where hydration matches them and where an update's pointer begins
|
|
5
|
+
export function appHeadChildrenStart(head) {
|
|
6
|
+
const children = head.childNodes;
|
|
7
|
+
let index = 0;
|
|
8
|
+
while (index < children.length) {
|
|
9
|
+
const child = children[index];
|
|
10
|
+
if (child.nodeType !== 1) break;
|
|
11
|
+
const element = child; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- nodeType 1 is an element
|
|
12
|
+
if (!element.hasAttribute('data--t-internal') && !element.hasAttribute('data--t-persist')) break;
|
|
13
|
+
index++;
|
|
14
|
+
}
|
|
15
|
+
return index;
|
|
16
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydrate.d.ts","sourceRoot":"","sources":["../../src/hydrate/hydrate.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAQnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAmBxD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"hydrate.d.ts","sourceRoot":"","sources":["../../src/hydrate/hydrate.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAQnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAmBxD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAO7C,OAAO,EACH,yBAAyB,EAC5B,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAmBlD,OAAO,EAC4B,KAAK,uBAAuB,EAC9D,MAAM,oCAAoC,CAAA;AAS3C,OAAO,0BAA0B,CAAA;AASjC,MAAM,MAAM,WAAW,GAAG;IACtB,UAAU,EAAE,OAAO,CAAA;IACnB,UAAU,EAAE,uBAAuB,EAAE,CAAA;IAGrC,WAAW,EAAE,OAAO,CAAA;CACvB,CAAA;AACD,wBAAgB,sBAAsB,IAAI,WAAW,CAEpD;AAID,wBAAsB,OAAO,CACzB,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,yBAAyB,GAAG,IAAI,EAC/C,cAAc,EAAE,cAAc,iBAgEjC;AAyBD,wBAAsB,oBAAoB,CACtC,aAAa,SAAS,yBAAyB,CAAC,GAAG,EAAE,GAAG,CAAC,EAEzD,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,WAAW,EAIjB,KAAK,GAAE,YAAY,CAAC,aAAa,CAAC,CAAC,OAAO,CAAM,EAAE,sJAAsJ;AACxM,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,SAAS,CAAC,EAAE,OAAO,GACpB,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,CA6DtC"}
|
package/dist/hydrate/hydrate.js
CHANGED
|
@@ -4,6 +4,7 @@ import { $number, $string, makeRenderedContentNodeNonRendered, makeRenderedConte
|
|
|
4
4
|
import { ContentNodeElementIsHtml, ContentNodeIsHtml, ContentNodeIsComponent, ContentNodeComponentIsClassComponent, ContentNodeIsFragment, ContentNodeIsElement } from '../ContentNode.js';
|
|
5
5
|
import { IsHTMLElement } from '../DomNodes.js';
|
|
6
6
|
import { DomPointer } from '../DomPointer.js';
|
|
7
|
+
import { appHeadChildrenStart } from '../headChildren.js';
|
|
7
8
|
import { DomRegion } from '../DomRegion.js';
|
|
8
9
|
//import { FunctionComponent } from '../FunctionComponent.js'
|
|
9
10
|
import { FunctionElement } from '../FunctionComponentStandIn.js';
|
|
@@ -453,31 +454,25 @@ parentElement, domPointer, instance, meta) {
|
|
|
453
454
|
}
|
|
454
455
|
}
|
|
455
456
|
debug(node, node[$type], typeof node[$type], node[$type] === 'head');
|
|
457
|
+
// the head hydrates like any element below, its children matched from appHeadChildrenStart
|
|
458
|
+
// (past what the server added). Hydration used to skip the children, and the record with no
|
|
459
|
+
// children then made the first root update re-create them all, duplicating the title and metas
|
|
456
460
|
if (node[$type] === 'head') {
|
|
457
|
-
const
|
|
458
|
-
if (
|
|
459
|
-
throwError('hydrateNodeSingle', `expected to find a head node, instead found nodeType ${
|
|
461
|
+
const headDomNode = domPointer.get();
|
|
462
|
+
if (headDomNode.nodeType !== 1 || headDomNode.nodeName.toLocaleLowerCase() !== 'head') {
|
|
463
|
+
throwError('hydrateNodeSingle', `expected to find a head node, instead found nodeType ${headDomNode.nodeType}, nodeName ${headDomNode.nodeName}`);
|
|
460
464
|
}
|
|
461
|
-
// collect
|
|
465
|
+
// collect the head children a head re-created on the client keeps (createHtmlElement)
|
|
462
466
|
const persistentHeadChildren = [];
|
|
463
|
-
const
|
|
464
|
-
for (const child of domChildren) {
|
|
467
|
+
for (const child of headDomNode.childNodes) {
|
|
465
468
|
if (child.nodeType === 1) {
|
|
466
|
-
const el = child;
|
|
469
|
+
const el = child; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- nodeType 1 is an element
|
|
467
470
|
if (el.hasAttribute('data--t-persist')) {
|
|
468
|
-
persistentHeadChildren.push(el.cloneNode(true));
|
|
471
|
+
persistentHeadChildren.push(el.cloneNode(true)); // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- a clone of an element is an element
|
|
469
472
|
}
|
|
470
473
|
}
|
|
471
474
|
}
|
|
472
|
-
//const domChildrenPointer = new DomPointer(node as HTMLHeadElement)
|
|
473
475
|
instance.persistentHeadChildren = persistentHeadChildren;
|
|
474
|
-
debug('head node - skipping, because we add a lot to this during initial render, breaking matching');
|
|
475
|
-
domPointer.increment();
|
|
476
|
-
//return { [$type]: $head, domNode: node as HTMLElement } // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
477
|
-
return {
|
|
478
|
-
[$type]: 'head',
|
|
479
|
-
domNode: node
|
|
480
|
-
}; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
481
476
|
}
|
|
482
477
|
if (ContentNodeIsHtml(node)) {
|
|
483
478
|
// HTML el
|
|
@@ -543,7 +538,7 @@ parentElement, domPointer, instance, meta) {
|
|
|
543
538
|
});
|
|
544
539
|
} else if (node[$props].__opaque !== true && validChildren(children)) {
|
|
545
540
|
debug('node.props.children', children);
|
|
546
|
-
const childDomPointer = new DomPointer(domNode);
|
|
541
|
+
const childDomPointer = new DomPointer(domNode, node[$type] === 'head' ? appHeadChildrenStart(domNode) : 0);
|
|
547
542
|
renderedChildren = await hydrateNode(children, parentElement, childDomPointer, instance, meta);
|
|
548
543
|
}
|
|
549
544
|
meta.selectValue = outerSelectValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addImportMap.d.ts","sourceRoot":"","sources":["../../src/render/addImportMap.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,mBAAmB,CAAA;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAQ9D,wBAAgB,YAAY,CAAC,IAAI,EAAE,mCAAmC,EAAE,aAAa,EAAE,aAAa,EAChG,mBAAmB,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"addImportMap.d.ts","sourceRoot":"","sources":["../../src/render/addImportMap.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,mBAAmB,CAAA;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAQ9D,wBAAgB,YAAY,CAAC,IAAI,EAAE,mCAAmC,EAAE,aAAa,EAAE,aAAa,EAChG,mBAAmB,EAAE,aAAa,QAiCrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processHead.d.ts","sourceRoot":"","sources":["../../src/render/processHead.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAK7C,OAAO,EAAE,oBAAoB,EAAqB,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"processHead.d.ts","sourceRoot":"","sources":["../../src/render/processHead.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAK7C,OAAO,EAAE,oBAAoB,EAAqB,MAAM,qBAAqB,CAAA;AAY7E,wBAAgB,WAAW,CACvB,QAAQ,EAAE,oBAAoB,EAC9B,QAAQ,EAAE,QAAQ,QA0JrB"}
|
|
@@ -6,7 +6,11 @@ import { windowGlobalEnvStatement } from 'tungsten/env/windowGlobalEnvStatement.
|
|
|
6
6
|
import { devErrorPageClearRetryScript } from '../Servers/devErrorPageAutoRetry.js';
|
|
7
7
|
// process the tree returned by the root component
|
|
8
8
|
// doing things like ensuring there is are html and head elements,
|
|
9
|
-
// and adding necessary style and script tags
|
|
9
|
+
// and adding necessary style and script tags.
|
|
10
|
+
// Every node added here is unshifted in front of the app's own head children and carries
|
|
11
|
+
// data--t-internal (a bare attribute: a true value renders as one), which is how hydration and
|
|
12
|
+
// updates find where the app's children start (appHeadChildrenStart). data--t-persist marks the
|
|
13
|
+
// ones a head re-created on the client keeps.
|
|
10
14
|
export function processHead(headNode, headData) {
|
|
11
15
|
const {
|
|
12
16
|
instance,
|
|
@@ -22,7 +26,7 @@ export function processHead(headNode, headData) {
|
|
|
22
26
|
headNode[$props].children.unshift({
|
|
23
27
|
[$type]: 'link',
|
|
24
28
|
[$props]: {
|
|
25
|
-
'data--t-internal':
|
|
29
|
+
'data--t-internal': true,
|
|
26
30
|
'data--t-persist': true,
|
|
27
31
|
rel: 'stylesheet',
|
|
28
32
|
href: `${siteBasePath}/${componentCssFolder}/${componentCssFile}`
|
|
@@ -33,7 +37,7 @@ export function processHead(headNode, headData) {
|
|
|
33
37
|
headNode[$props].children.unshift({
|
|
34
38
|
[$type]: 'link',
|
|
35
39
|
[$props]: {
|
|
36
|
-
'data--t-internal':
|
|
40
|
+
'data--t-internal': true,
|
|
37
41
|
'data--t-persist': true,
|
|
38
42
|
rel: 'stylesheet',
|
|
39
43
|
href: `${siteBasePath}${frameworkCss}`
|
|
@@ -44,7 +48,7 @@ export function processHead(headNode, headData) {
|
|
|
44
48
|
const scriptNode = {
|
|
45
49
|
[$type]: 'script',
|
|
46
50
|
[$props]: {
|
|
47
|
-
'data--t-internal':
|
|
51
|
+
'data--t-internal': true,
|
|
48
52
|
src: dev ? `/${clientFolder}/client.js` : `${siteBasePath}/bundle/clientWithEnv.js`
|
|
49
53
|
}
|
|
50
54
|
};
|
|
@@ -55,7 +59,7 @@ export function processHead(headNode, headData) {
|
|
|
55
59
|
headNode[$props].children.unshift({
|
|
56
60
|
[$type]: 'script',
|
|
57
61
|
[$props]: {
|
|
58
|
-
'data--t-internal':
|
|
62
|
+
'data--t-internal': true,
|
|
59
63
|
children: headData.docInitScript
|
|
60
64
|
}
|
|
61
65
|
});
|
|
@@ -66,7 +70,7 @@ export function processHead(headNode, headData) {
|
|
|
66
70
|
const envScriptNode = {
|
|
67
71
|
[$type]: 'script',
|
|
68
72
|
[$props]: {
|
|
69
|
-
'data--t-internal':
|
|
73
|
+
'data--t-internal': true,
|
|
70
74
|
children: windowGlobalEnvStatement('tungstenPublicEnv', headData.tungstenPublicEnv)
|
|
71
75
|
}
|
|
72
76
|
};
|
|
@@ -78,7 +82,7 @@ export function processHead(headNode, headData) {
|
|
|
78
82
|
const cjsHelpersScriptNode = {
|
|
79
83
|
[$type]: 'script',
|
|
80
84
|
[$props]: {
|
|
81
|
-
'data--t-internal':
|
|
85
|
+
'data--t-internal': true,
|
|
82
86
|
src: `${siteBasePath}/${clientFolder}/cjsHelpers.js`
|
|
83
87
|
}
|
|
84
88
|
};
|
|
@@ -91,7 +95,7 @@ export function processHead(headNode, headData) {
|
|
|
91
95
|
const clearErrorRetryScriptNode = {
|
|
92
96
|
[$type]: 'script',
|
|
93
97
|
[$props]: {
|
|
94
|
-
'data--t-internal':
|
|
98
|
+
'data--t-internal': true,
|
|
95
99
|
children: devErrorPageClearRetryScript
|
|
96
100
|
}
|
|
97
101
|
};
|
|
@@ -103,7 +107,7 @@ export function processHead(headNode, headData) {
|
|
|
103
107
|
const liveReloadScriptNode = {
|
|
104
108
|
[$type]: 'script',
|
|
105
109
|
[$props]: {
|
|
106
|
-
'data--t-internal':
|
|
110
|
+
'data--t-internal': true,
|
|
107
111
|
type: 'module',
|
|
108
112
|
src: `${siteBasePath}/${clientFolder}/${hmr === true ? 'hmr.js' : 'liveReload.js'}`
|
|
109
113
|
}
|
|
@@ -127,6 +131,7 @@ export function processHead(headNode, headData) {
|
|
|
127
131
|
const varsScriptNode = {
|
|
128
132
|
[$type]: 'script',
|
|
129
133
|
[$props]: {
|
|
134
|
+
'data--t-internal': true,
|
|
130
135
|
children: varsScriptContent
|
|
131
136
|
}
|
|
132
137
|
};
|
|
@@ -134,14 +139,15 @@ export function processHead(headNode, headData) {
|
|
|
134
139
|
const contentTypeMetaNode = {
|
|
135
140
|
[$type]: 'meta',
|
|
136
141
|
[$props]: {
|
|
137
|
-
'data--t-internal':
|
|
142
|
+
'data--t-internal': true,
|
|
138
143
|
'data--t-persist': true,
|
|
139
144
|
'http-equiv': 'Content-Type',
|
|
140
145
|
content: 'text/html; charset=utf-8'
|
|
141
146
|
}
|
|
142
147
|
};
|
|
143
148
|
headNode[$props].children.unshift(contentTypeMetaNode);
|
|
144
|
-
//
|
|
145
|
-
//
|
|
149
|
+
// Idea, not built (2023): a "before" prop on an app head child would hoist it above the
|
|
150
|
+
// framework's nodes, so its script runs first. If built, appHeadChildrenStart's leading-run
|
|
151
|
+
// skip no longer holds: the app's children would then sit on both sides of the marked ones.
|
|
146
152
|
if (dev) addImportMap(headNode, importAliases, clientImportAliases);
|
|
147
153
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integrateUpdateVdom.d.ts","sourceRoot":"","sources":["../../src/update/integrateUpdateVdom.ts"],"names":[],"mappings":"AASA,OAAO,E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AAO,CAAC,EAC3C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAC/C,SAAS,EAAE,OAAO,EAClB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,WAAW,GACvB,OAAO,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC,CAqD7C;AAED,wBAAgB,kBAAkB,CAC9B,IAAI,EAAE,mBAAmB,CAAC,yBAAyB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,GAC/D,IAAI,CAON;AA6RD,wBAAsB,wBAAwB,CAC1C,UAAU,EAAE,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,GAC5E,OAAO,CAAC,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,CAiC3C;AAED,wBAAsB,qBAAqB,CACvC,UAAU,EAAE,qBAAqB,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,yBAAyB,CAAC,GAAG,EAAE,GAAG,CAAC,GAC1F,OAAO,CAAC,qBAAqB,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,CAyCjD"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IsHTMLElement } from '../DomNodes.js';
|
|
2
2
|
import { DomRegion } from '../DomRegion.js';
|
|
3
3
|
import { DomPointer } from '../DomPointer.js';
|
|
4
|
+
import { appHeadChildrenStart } from '../headChildren.js';
|
|
4
5
|
import { ContentNodeComponentIsClassComponent, ContentNodeIsNonRendered, ContentNodeIsLiteral, ContentNodeIsHtml, ContentNodeIsComponent, ContentNodeIsArray, ContentNodeIsFragment, ContentNodeIsElement, ContentNodeElementHasValidKey } from '../ContentNode.js';
|
|
5
6
|
import { StringIsHtmlEvent, htmlEvents } from '../htmlEvents.js';
|
|
6
7
|
import { out, warn } from '../appOutput.js';
|
|
@@ -507,7 +508,8 @@ async function updateHtmlElement(tungstenElement, instance, newNode, oldNode, do
|
|
|
507
508
|
newNode: newChildren,
|
|
508
509
|
oldNode: oldChildren,
|
|
509
510
|
domRegion: new DomRegion(domNode),
|
|
510
|
-
|
|
511
|
+
// the head's children start past what the server added to it
|
|
512
|
+
domPointer: new DomPointer(domNode, newNode[$type] === 'head' ? appHeadChildrenStart(domNode) : 0),
|
|
511
513
|
parentNode: newNode
|
|
512
514
|
});
|
|
513
515
|
// Reapply the controlled value after reconciling the options. Updating the
|