tungsten 0.2.7 → 0.2.9
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/Components.d.ts +3 -1
- package/dist/Components.d.ts.map +1 -1
- package/dist/Components.js +100 -51
- package/dist/DomNodes.js +2 -2
- package/dist/FrameworkConfig.d.ts +2 -0
- package/dist/FrameworkConfig.d.ts.map +1 -1
- package/dist/FunctionComponentStandIn.d.ts +2 -0
- package/dist/FunctionComponentStandIn.d.ts.map +1 -1
- package/dist/FunctionComponentStandIn.js +16 -3
- package/dist/Instance/ClientRuntimeContext.d.ts +8 -0
- package/dist/Instance/ClientRuntimeContext.d.ts.map +1 -0
- package/dist/Instance/ClientRuntimeContext.js +1 -0
- package/dist/Instance/Instance.d.ts +20 -1
- package/dist/Instance/Instance.d.ts.map +1 -1
- package/dist/Instance/Instance.js +59 -11
- package/dist/Servers/loadEnvsDev.d.ts +1 -1
- package/dist/Servers/loadEnvsDev.d.ts.map +1 -1
- package/dist/Servers/loadEnvsDev.js +18 -3
- package/dist/Store/makeStore.d.ts.map +1 -1
- package/dist/Store/makeStore.js +7 -14
- package/dist/auth/passwordHashing.sxyt.js +2 -2
- package/dist/babelPlugins/BabelTransformPackageImports.d.ts +1 -0
- package/dist/babelPlugins/BabelTransformPackageImports.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformPackageImports.js +109 -70
- package/dist/bin/commands/compile.sxyt.js +76 -1
- package/dist/build/compileJavascript.d.ts.map +1 -1
- package/dist/build/compileJavascript.js +13 -1
- package/dist/build/makeBabelUserDevConfig.d.ts +1 -1
- package/dist/build/makeBabelUserDevConfig.d.ts.map +1 -1
- package/dist/build/makeBabelUserDevConfig.js +2 -1
- package/dist/componentProxyHandlers.d.ts +2 -2
- package/dist/componentProxyHandlers.d.ts.map +1 -1
- package/dist/componentProxyHandlers.js +70 -44
- package/dist/componentProxyHandlers.sxyt.d.ts +2 -0
- package/dist/componentProxyHandlers.sxyt.d.ts.map +1 -0
- package/dist/componentProxyHandlers.sxyt.js +130 -0
- package/dist/findUserConfig.d.ts +1 -1
- package/dist/findUserConfig.d.ts.map +1 -1
- package/dist/findUserConfig.js +2 -2
- package/dist/frameworkConfigSchema.d.ts +4 -0
- package/dist/frameworkConfigSchema.d.ts.map +1 -1
- package/dist/frameworkConfigSchema.js +1 -0
- package/dist/getUserConfig.d.ts +1 -1
- package/dist/getUserConfig.d.ts.map +1 -1
- package/dist/getUserConfig.js +2 -2
- package/dist/hooks/useState.js +1 -1
- package/dist/indexInner.d.ts +0 -1
- package/dist/indexInner.d.ts.map +1 -1
- package/dist/indexInner.js +1 -1
- package/dist/update/UpdateScheduler.d.ts +17 -0
- package/dist/update/UpdateScheduler.d.ts.map +1 -0
- package/dist/update/UpdateScheduler.js +113 -0
- package/dist/update/integrateUpdateVdom.d.ts +11 -1
- package/dist/update/integrateUpdateVdom.d.ts.map +1 -1
- package/dist/update/integrateUpdateVdom.js +117 -59
- package/dist/{react-zone.d.ts → zones/react.d.ts} +5 -5
- package/dist/zones/react.d.ts.map +1 -0
- package/dist/{react-zone.js → zones/react.js} +3 -3
- package/package.json +7 -4
- package/readme.md +80 -0
- package/dist/react-zone.d.ts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { execFile } from 'child_process';
|
|
2
|
-
import { mkdtemp, readFile, rm, writeFile } from 'fs/promises';
|
|
2
|
+
import { mkdir, mkdtemp, readFile, rm, writeFile } from 'fs/promises';
|
|
3
3
|
import { tmpdir } from 'os';
|
|
4
4
|
import { join } from 'path';
|
|
5
5
|
import { promisify } from 'util';
|
|
@@ -58,4 +58,79 @@ describe('tungsten compile', ({
|
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
|
+
it('reports an unsupported node dependency once and continues compiling', async () => {
|
|
62
|
+
const projectDir = await mkdtemp(join(tmpdir(), 'tungsten-compile-node-dependency-test-'));
|
|
63
|
+
const cliLocation = join(findProjectDir(import.meta.url), 'dist', 'bin', 'index.js');
|
|
64
|
+
const packageDir = join(projectDir, 'node_modules', 'fixture-package');
|
|
65
|
+
const sourceDir = join(projectDir, 'src');
|
|
66
|
+
try {
|
|
67
|
+
await mkdir(packageDir, {
|
|
68
|
+
recursive: true
|
|
69
|
+
});
|
|
70
|
+
await mkdir(sourceDir, {
|
|
71
|
+
recursive: true
|
|
72
|
+
});
|
|
73
|
+
await writeFile(join(projectDir, 'package.json'), '{"type":"module"}');
|
|
74
|
+
await writeFile(join(projectDir, 'tungsten.config.js'), 'export default { codeDir: "src", useRootComponent: false }');
|
|
75
|
+
await writeFile(join(sourceDir, 'entry.js'), 'import fixture from \'fixture-package\'; export { fixture }');
|
|
76
|
+
await writeFile(join(packageDir, 'package.json'), '{"name":"fixture-package","version":"1.0.0","main":"index.js"}');
|
|
77
|
+
await writeFile(join(packageDir, 'index.js'), 'module.exports = require(\'missing-native-module\')');
|
|
78
|
+
const {
|
|
79
|
+
stdout
|
|
80
|
+
} = await execFileAsync(process.execPath, [cliLocation, 'compile', '--js', '--output', '.tungsten/test', '--quiet'], {
|
|
81
|
+
cwd: projectDir
|
|
82
|
+
});
|
|
83
|
+
expect(stdout).to.contain('Your code that is compiled may depend on a node module - this is not allowed.');
|
|
84
|
+
expect(stdout).to.contain('src/entry.js\n -> fixture-package/index.js\n -> missing-native-module (unresolved)');
|
|
85
|
+
expect(stdout).not.to.contain('Require stack:');
|
|
86
|
+
expect(stdout).not.to.contain('process file err');
|
|
87
|
+
expect(stdout.split('Your code that is compiled may depend on a node module - this is not allowed.')).to.have.length(2);
|
|
88
|
+
expect(stdout).to.contain('Compile complete');
|
|
89
|
+
await readFile(join(projectDir, '.tungsten/test/code/entry.js'), 'utf8');
|
|
90
|
+
} finally {
|
|
91
|
+
await rm(projectDir, {
|
|
92
|
+
recursive: true,
|
|
93
|
+
force: true
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
it('skips package compilation for files selected by a JavaScript glob', async () => {
|
|
98
|
+
const projectDir = await mkdtemp(join(tmpdir(), 'tungsten-skip-package-compilation-test-'));
|
|
99
|
+
const cliLocation = join(findProjectDir(import.meta.url), 'dist', 'bin', 'index.js');
|
|
100
|
+
const packageDir = join(projectDir, 'node_modules', 'fixture-package');
|
|
101
|
+
const sourceDir = join(projectDir, 'src');
|
|
102
|
+
try {
|
|
103
|
+
await mkdir(packageDir, {
|
|
104
|
+
recursive: true
|
|
105
|
+
});
|
|
106
|
+
await mkdir(sourceDir, {
|
|
107
|
+
recursive: true
|
|
108
|
+
});
|
|
109
|
+
await writeFile(join(projectDir, 'package.json'), '{"type":"module"}');
|
|
110
|
+
await writeFile(join(projectDir, 'tungsten.config.js'), 'export default {' + ' codeDir: "src",' + ' useRootComponent: false,' + ' skipPackageCompilation: "**/*.domTest.js"' + ' }');
|
|
111
|
+
await writeFile(join(sourceDir, 'component.domTest.js'), "import fixture from 'fixture-package'; export { fixture }");
|
|
112
|
+
await writeFile(join(packageDir, 'package.json'), '{"name":"fixture-package","version":"1.0.0","main":"index.js"}');
|
|
113
|
+
await writeFile(join(packageDir, 'index.js'), 'module.exports = 1');
|
|
114
|
+
const {
|
|
115
|
+
stdout
|
|
116
|
+
} = await execFileAsync(process.execPath, [cliLocation, 'compile', '--js', '--output', '.tungsten/test', '--quiet'], {
|
|
117
|
+
cwd: projectDir
|
|
118
|
+
});
|
|
119
|
+
const compiled = await readFile(join(projectDir, '.tungsten/test/code/component.domTest.js'), 'utf8');
|
|
120
|
+
expect(stdout).to.contain('Compile complete');
|
|
121
|
+
expect(compiled).to.contain("from 'fixture-package'");
|
|
122
|
+
let packageWasCopied = true;
|
|
123
|
+
try {
|
|
124
|
+
await readFile(join(projectDir, '.tungsten/test/.packages/fixture-package@1.0.0/index.js'), 'utf8');
|
|
125
|
+
} catch {
|
|
126
|
+
packageWasCopied = false;
|
|
127
|
+
}
|
|
128
|
+
expect(packageWasCopied).to.equal(false);
|
|
129
|
+
} finally {
|
|
130
|
+
await rm(projectDir, {
|
|
131
|
+
recursive: true,
|
|
132
|
+
force: true
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
});
|
|
61
136
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compileJavascript.d.ts","sourceRoot":"","sources":["../../src/build/compileJavascript.ts"],"names":[],"mappings":"AAEA,OAAO,QAAQ,MAAM,UAAU,CAAA;AAO/B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAetC,KAAK,uBAAuB,GAAG;IAC3B,OAAO,EAAE,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAA;IAClC,WAAW,EAAE,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAA;IACtC,aAAa,EAAE,aAAa,CAAA;IAC5B,cAAc,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACrC,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACnC,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,eAAe,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,0BAA0B,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CAAA;CAC9F,CAAA;AAKD,wBAAsB,iBAAiB,CACnC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,uBAAuB,EACtD,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EACrE,aAAa,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,UAAO,EAC1E,OAAO,GAAE,wBAA6B,GACvC,OAAO,CAAC,uBAAuB,CAAC,
|
|
1
|
+
{"version":3,"file":"compileJavascript.d.ts","sourceRoot":"","sources":["../../src/build/compileJavascript.ts"],"names":[],"mappings":"AAEA,OAAO,QAAQ,MAAM,UAAU,CAAA;AAO/B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAetC,KAAK,uBAAuB,GAAG;IAC3B,OAAO,EAAE,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAA;IAClC,WAAW,EAAE,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAA;IACtC,aAAa,EAAE,aAAa,CAAA;IAC5B,cAAc,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACrC,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACnC,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,eAAe,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,0BAA0B,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CAAA;CAC9F,CAAA;AAKD,wBAAsB,iBAAiB,CACnC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,uBAAuB,EACtD,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EACrE,aAAa,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,UAAO,EAC1E,OAAO,GAAE,wBAA6B,GACvC,OAAO,CAAC,uBAAuB,CAAC,CAuTlC"}
|
|
@@ -22,6 +22,17 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
22
22
|
let importAliases = {};
|
|
23
23
|
let promises = [];
|
|
24
24
|
let config;
|
|
25
|
+
const skipPackageCompilationPatterns = appConfig.skipPackageCompilation === undefined ? [] : Array.isArray(appConfig.skipPackageCompilation) ? appConfig.skipPackageCompilation : [appConfig.skipPackageCompilation];
|
|
26
|
+
const skipPackageCompilationFiles = new Set();
|
|
27
|
+
async function refreshSkipPackageCompilationFiles() {
|
|
28
|
+
skipPackageCompilationFiles.clear();
|
|
29
|
+
const matchingFiles = await globby(skipPackageCompilationPatterns, {
|
|
30
|
+
cwd: codeLocation,
|
|
31
|
+
absolute: true
|
|
32
|
+
});
|
|
33
|
+
for (const file of matchingFiles) skipPackageCompilationFiles.add(slash(file));
|
|
34
|
+
}
|
|
35
|
+
await refreshSkipPackageCompilationFiles();
|
|
25
36
|
if (mode === 'dev') {
|
|
26
37
|
dependencyGraphDir = options.packagesCacheLocation ?? join(projectDir, packagesCacheFolder);
|
|
27
38
|
dependencyGraphLocation = join(dependencyGraphDir, '.dependency-graph.js');
|
|
@@ -29,7 +40,7 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
29
40
|
dependencyGraph = {};
|
|
30
41
|
importAliases = {};
|
|
31
42
|
promises = [];
|
|
32
|
-
config = makeBabelUserDevConfig(projectDir, codeLocation, sourceLocation, styleImportBase, buildLocation, buildCodeLocation, dependencyGraphDir, oldDependencyGraph, dependencyGraph, importAliases, promises);
|
|
43
|
+
config = makeBabelUserDevConfig(projectDir, codeLocation, sourceLocation, styleImportBase, buildLocation, buildCodeLocation, dependencyGraphDir, skipPackageCompilationFiles, oldDependencyGraph, dependencyGraph, importAliases, promises);
|
|
33
44
|
} else {
|
|
34
45
|
config = makeBabelUserProdConfig(projectDir, codeLocation, sourceLocation, styleImportBase);
|
|
35
46
|
}
|
|
@@ -183,6 +194,7 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
183
194
|
if (event === 'unlink') {
|
|
184
195
|
await deleteTransformedFile(file);
|
|
185
196
|
} else {
|
|
197
|
+
if (event === 'add') await refreshSkipPackageCompilationFiles();
|
|
186
198
|
await transformFile(file);
|
|
187
199
|
}
|
|
188
200
|
const failures = await settleDeferredWork();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TransformOptions } from '@babel/core';
|
|
2
2
|
import type { ImportAliases } from './ImportAliases.js';
|
|
3
3
|
import { DependencyGraph } from '../babelPlugins/BabelTransformPackageImports.js';
|
|
4
|
-
export declare function makeBabelUserDevConfig(projectDir: string, absCodeDir: string, absSourceDir: string, absStyleImportBase: string, buildLocation: string, buildCodeLocation: string, packagesCacheLocation: string, oldDependencyGraph: DependencyGraph, dependencyGraph: DependencyGraph, importAliases: ImportAliases, promises: Promise<any>[]): TransformOptions;
|
|
4
|
+
export declare function makeBabelUserDevConfig(projectDir: string, absCodeDir: string, absSourceDir: string, absStyleImportBase: string, buildLocation: string, buildCodeLocation: string, packagesCacheLocation: string, skipPackageCompilationFiles: ReadonlySet<string>, oldDependencyGraph: DependencyGraph, dependencyGraph: DependencyGraph, importAliases: ImportAliases, promises: Promise<any>[]): TransformOptions;
|
|
5
5
|
//# sourceMappingURL=makeBabelUserDevConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeBabelUserDevConfig.d.ts","sourceRoot":"","sources":["../../src/build/makeBabelUserDevConfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAKnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,OAAO,EAAoC,eAAe,EAAE,MAAM,iDAAiD,CAAA;AAMnH,wBAAgB,sBAAsB,CAClC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,kBAAkB,EAAE,MAAM,EAC1B,aAAa,EAAE,MAAM,EACrB,iBAAiB,EAAE,MAAM,EACzB,qBAAqB,EAAE,MAAM,EAC7B,kBAAkB,EAAE,eAAe,EACnC,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,GACzB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"makeBabelUserDevConfig.d.ts","sourceRoot":"","sources":["../../src/build/makeBabelUserDevConfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAKnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,OAAO,EAAoC,eAAe,EAAE,MAAM,iDAAiD,CAAA;AAMnH,wBAAgB,sBAAsB,CAClC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,kBAAkB,EAAE,MAAM,EAC1B,aAAa,EAAE,MAAM,EACrB,iBAAiB,EAAE,MAAM,EACzB,qBAAqB,EAAE,MAAM,EAC7B,2BAA2B,EAAE,WAAW,CAAC,MAAM,CAAC,EAChD,kBAAkB,EAAE,eAAe,EACnC,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,GACzB,gBAAgB,CA4BlB"}
|
|
@@ -6,7 +6,7 @@ import { MakeBabelTransformPackageImports } from "../babelPlugins/BabelTransform
|
|
|
6
6
|
import { componentCssFolder, componentCssFile } from "../settings.js";
|
|
7
7
|
import userCommonConfig from "./babel.user.common.config.js";
|
|
8
8
|
import { MakeBabelTransformCssImports } from "../babelPlugins/BabelTransformCssImports.js";
|
|
9
|
-
export function makeBabelUserDevConfig(projectDir, absCodeDir, absSourceDir, absStyleImportBase, buildLocation, buildCodeLocation, packagesCacheLocation, oldDependencyGraph, dependencyGraph, importAliases, promises) {
|
|
9
|
+
export function makeBabelUserDevConfig(projectDir, absCodeDir, absSourceDir, absStyleImportBase, buildLocation, buildCodeLocation, packagesCacheLocation, skipPackageCompilationFiles, oldDependencyGraph, dependencyGraph, importAliases, promises) {
|
|
10
10
|
const userDevConfig = objectCopy(userCommonConfig);
|
|
11
11
|
userDevConfig.plugins.push(MakeBabelTransformPackageImports({
|
|
12
12
|
projectDir: projectDir,
|
|
@@ -14,6 +14,7 @@ export function makeBabelUserDevConfig(projectDir, absCodeDir, absSourceDir, abs
|
|
|
14
14
|
buildLocation,
|
|
15
15
|
buildCodeLocation,
|
|
16
16
|
packagesCacheLocation,
|
|
17
|
+
skipPackageCompilationFiles,
|
|
17
18
|
oldDependencyGraph,
|
|
18
19
|
dependencyGraph,
|
|
19
20
|
importAliases,
|
|
@@ -29,7 +29,7 @@ export declare const getStateSetProxyHandler: (element: StatefulComponentAny) =>
|
|
|
29
29
|
get: (set: Set<unknown>, key: string | symbol) => any;
|
|
30
30
|
has(set: Set<unknown>, key: string | symbol): boolean;
|
|
31
31
|
};
|
|
32
|
-
export declare function proxyObjectContent<O extends object>(element: StatefulComponentAny, object: O): void;
|
|
33
|
-
export declare function proxyArrayContent<A extends unknown[]>(element: StatefulComponentAny, array: A): void;
|
|
32
|
+
export declare function proxyObjectContent<O extends object>(element: StatefulComponentAny, object: O, adopted?: WeakMap<object, object>): void;
|
|
33
|
+
export declare function proxyArrayContent<A extends unknown[]>(element: StatefulComponentAny, array: A, adopted?: WeakMap<object, object>): void;
|
|
34
34
|
export {};
|
|
35
35
|
//# sourceMappingURL=componentProxyHandlers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentProxyHandlers.d.ts","sourceRoot":"","sources":["../src/componentProxyHandlers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"componentProxyHandlers.d.ts","sourceRoot":"","sources":["../src/componentProxyHandlers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAQ/E,KAAK,0BAA0B,CAAC,KAAK,SAAS,MAAM,IAC9C,yBAAyB,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,GAC1C,iBAAiB,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,CAAA;AAExC,KAAK,oBAAoB,GAAG,yBAAyB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;AAEvG,eAAO,MAAM,SAAS,eAAqB,CAAA;AAC3C,eAAO,MAAM,UAAU,eAAsB,CAAA;AAE7C,eAAO,MAAM,oBAAoB,GAAI,KAAK,SAAS,MAAM,EACxD,SAAS,0BAA0B,CAAC,KAAK,CAAC;eAC5B,KAAK,OAAO,MAAM,GAAG,MAAM;eAQ3B,KAAK,OAAO,MAAM,GAAG,MAAM,SAAS,OAAO;0BAmChC,KAAK,OAAO,MAAM,GAAG,MAAM;aAOxC,KAAK,OAAO,MAAM,GAAG,MAAM;CAItC,CAAA;AAGF,eAAO,MAAM,0BAA0B,GAAI,CAAC,SAAS,MAAM,EAAE,SAAS,oBAAoB;eAC3E,CAAC,OAAO,MAAM,GAAG,MAAM;eAQvB,CAAC,OAAO,MAAM,GAAG,MAAM,SAAS,OAAO;0BAkC5B,CAAC,OAAO,MAAM,GAAG,MAAM;aAOpC,CAAC,OAAO,MAAM,GAAG,MAAM;CAIlC,CAAA;AAGF,eAAO,MAAM,yBAAyB,GAAI,SAAS,oBAAoB;eA8BpD,OAAO,EAAE,OAAO,MAAM,GAAG,MAAM;eA7B5B,OAAO,EAAE,OAAO,MAAM,GAAG,MAAM,SAAS,OAAO;aAgEpD,OAAO,EAAE,OAAO,MAAM,GAAG,MAAM;wBAIpB,OAAO,EAAE,OAAO,MAAM,GAAG,MAAM;CAU1D,CAAA;AAID,eAAO,MAAM,uBAAuB,GAAI,SAAS,oBAAoB;eACtD,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,MAAM,GAAG,MAAM;aA+C7C,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,MAAM,GAAG,MAAM;CAItD,CAAA;AAIF,eAAO,MAAM,uBAAuB,GAAI,SAAS,oBAAoB;eACtD,GAAG,CAAC,OAAO,CAAC,OAAO,MAAM,GAAG,MAAM;aA0CpC,GAAG,CAAC,OAAO,CAAC,OAAO,MAAM,GAAG,MAAM;CAI7C,CAAA;AAgCF,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,EAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,GAAE,OAAO,CAAC,MAAM,EAAE,MAAM,CAAiB,GAC3F,IAAI,CAiCN;AAED,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,OAAO,EAAE,EACjD,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,GAAE,OAAO,CAAC,MAAM,EAAE,MAAM,CAAiB,GAC1F,IAAI,CAkCN"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { KeyIsArrayMutatingFunction, KeyIsMapMutatingFunction, KeyIsSetMutatingFunction } from "./mutatingFunctions.js";
|
|
2
2
|
import { objectTypesToProxy } from "./objectTypesToProxy.js";
|
|
3
|
-
import {
|
|
3
|
+
import { warn } from "./output.js";
|
|
4
|
+
import { isDev } from "./isDev.js";
|
|
4
5
|
export const $original = Symbol('original');
|
|
5
6
|
export const $ownerName = Symbol('ownerName');
|
|
6
7
|
export const getStateProxyHandler = element => ({
|
|
@@ -31,9 +32,9 @@ export const getStateProxyHandler = element => ({
|
|
|
31
32
|
} else if (value instanceof Map) {
|
|
32
33
|
// Maps
|
|
33
34
|
//console.log('found a Map in state');
|
|
34
|
-
obj[key]
|
|
35
|
+
obj[key]
|
|
35
36
|
//= new Proxy(value, getStateMapProxyHandler(element))
|
|
36
|
-
proxyMap(value, element);
|
|
37
|
+
= proxyMap(value, element);
|
|
37
38
|
} else if (value instanceof Set) {
|
|
38
39
|
// Sets
|
|
39
40
|
//console.log('found a Set in state');
|
|
@@ -64,6 +65,9 @@ export const getStateProxyHandler = element => ({
|
|
|
64
65
|
export const getStateObjectProxyHandler = element => ({
|
|
65
66
|
get: (obj, key) => {
|
|
66
67
|
if (key === '__original') return obj; // return the internal object if requested
|
|
68
|
+
if (key === $original) return obj; // return the internal object if requested
|
|
69
|
+
// owner?
|
|
70
|
+
if (key === $ownerName) return element.constructor.name;
|
|
67
71
|
return obj[key]; // Proxy typing allowed accessing keys outside of the type.
|
|
68
72
|
// So act on that obj as an object that accept all string | symbol keys
|
|
69
73
|
},
|
|
@@ -317,7 +321,7 @@ export const getStateSetProxyHandler = element => ({
|
|
|
317
321
|
// }
|
|
318
322
|
// }
|
|
319
323
|
// }
|
|
320
|
-
export function proxyObjectContent(element, object) {
|
|
324
|
+
export function proxyObjectContent(element, object, adopted = new WeakMap()) {
|
|
321
325
|
//console.log('proxying object content', object, 'for', element.constructor.name)
|
|
322
326
|
for (const key in object) {
|
|
323
327
|
//console.log('proxy key', key)
|
|
@@ -327,34 +331,33 @@ export function proxyObjectContent(element, object) {
|
|
|
327
331
|
if (Array.isArray(value)) {
|
|
328
332
|
object[key]
|
|
329
333
|
//= new Proxy(value, getStateObjectProxyHandler(element))
|
|
330
|
-
= proxyArray(value, element);
|
|
334
|
+
= proxyArray(value, element, adopted);
|
|
331
335
|
} else if (typeof value === 'object' && value !== null
|
|
332
336
|
// && value.constructor.name === 'Object'
|
|
333
337
|
&& objectTypesToProxy.includes(value.constructor.name) // ensure that it is an object literal or otherwise an approve object type
|
|
334
338
|
) {
|
|
335
339
|
// plain objects
|
|
336
340
|
//proxyObjectContent(element, value)
|
|
337
|
-
// check that this thing hasn't already been proxied somewhere?
|
|
338
341
|
object[key]
|
|
339
342
|
//= new Proxy(value, getStateObjectProxyHandler(element))
|
|
340
|
-
= proxyObject(value, element);
|
|
343
|
+
= proxyObject(value, element, adopted);
|
|
341
344
|
} else if (value instanceof Map) {
|
|
342
345
|
// Maps
|
|
343
346
|
//console.log('proxying a Map in state');
|
|
344
347
|
object[key]
|
|
345
348
|
//= new Proxy(value, getStateMapProxyHandler(element))
|
|
346
|
-
= proxyMap(value, element);
|
|
349
|
+
= proxyMap(value, element, adopted);
|
|
347
350
|
} else if (value instanceof Set) {
|
|
348
351
|
// Sets
|
|
349
352
|
//console.log('proxying a Set in state');
|
|
350
353
|
object[key]
|
|
351
354
|
//= new Proxy(value, getStateSetProxyHandler(element))
|
|
352
|
-
= proxySet(value, element);
|
|
355
|
+
= proxySet(value, element, adopted);
|
|
353
356
|
}
|
|
354
357
|
}
|
|
355
358
|
}
|
|
356
359
|
}
|
|
357
|
-
export function proxyArrayContent(element, array) {
|
|
360
|
+
export function proxyArrayContent(element, array, adopted = new WeakMap()) {
|
|
358
361
|
//console.log('proxying array content', array, 'for', element.constructor.name)
|
|
359
362
|
for (const key in array) {
|
|
360
363
|
//console.log('proxying arr key', key)
|
|
@@ -365,7 +368,7 @@ export function proxyArrayContent(element, array) {
|
|
|
365
368
|
//proxyArrayContent(element, value)
|
|
366
369
|
array[key]
|
|
367
370
|
//= new Proxy(value, getStateObjectProxyHandler(element))
|
|
368
|
-
= proxyArray(value, element);
|
|
371
|
+
= proxyArray(value, element, adopted);
|
|
369
372
|
} else if (typeof value === 'object' && value !== null
|
|
370
373
|
// && value.constructor.name === 'Object'
|
|
371
374
|
&& objectTypesToProxy.includes(value.constructor.name) // ensure that it is an object literal or otherwise an approve object type
|
|
@@ -374,58 +377,81 @@ export function proxyArrayContent(element, array) {
|
|
|
374
377
|
//proxyObjectContent(element, value)
|
|
375
378
|
array[key]
|
|
376
379
|
//= new Proxy(value, getStateObjectProxyHandler(element))
|
|
377
|
-
= proxyObject(value, element);
|
|
380
|
+
= proxyObject(value, element, adopted);
|
|
378
381
|
} else if (value instanceof Map) {
|
|
379
382
|
// Maps
|
|
380
383
|
//console.log('proxying a Map in state');
|
|
381
384
|
array[key]
|
|
382
385
|
//= new Proxy(value, getStateMapProxyHandler(element))
|
|
383
|
-
= proxyMap(value, element);
|
|
386
|
+
= proxyMap(value, element, adopted);
|
|
384
387
|
} else if (value instanceof Set) {
|
|
385
388
|
// Sets
|
|
386
389
|
//console.log('proxying a Set in state');
|
|
387
390
|
array[key]
|
|
388
391
|
//= new Proxy(value, getStateSetProxyHandler(element))
|
|
389
|
-
= proxySet(value, element);
|
|
392
|
+
= proxySet(value, element, adopted);
|
|
390
393
|
}
|
|
391
394
|
}
|
|
392
395
|
}
|
|
393
396
|
}
|
|
394
|
-
|
|
397
|
+
// An object may only live in one component's state. Anything arriving that is already owned
|
|
398
|
+
// (i.e. is one of our state proxies) is adopted as a shallow copy of its original, so the two
|
|
399
|
+
// components never alias. Shallow is deliberate: the caller walks the contents and re-enters
|
|
400
|
+
// this for each owned child, so the existing recursion does the deep work.
|
|
401
|
+
function adoptIntoState(value, element) {
|
|
402
|
+
if (!($original in value && $ownerName in value)) return value;
|
|
403
|
+
if (isDev) warn(`${element.constructor.name} stored an object already owned by` + ` ${String(value[$ownerName])}'s state — a copy was taken.`);
|
|
404
|
+
const original = value[$original]; // the raw target, not via the get traps —
|
|
405
|
+
// spreading the proxy would yield proxied children
|
|
406
|
+
if (Array.isArray(original)) return [...original];
|
|
407
|
+
if (original instanceof Set) return new Set(original);
|
|
408
|
+
if (original instanceof Map) return new Map(original);
|
|
409
|
+
return {
|
|
410
|
+
...original
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
// `adopted` maps each raw original seen in this pass to the proxy that replaced it. Registered
|
|
414
|
+
// before recursing into contents, so cycles terminate and an object referenced twice in one
|
|
415
|
+
// state tree stays one object instead of silently becoming two.
|
|
416
|
+
function proxyObject(obj, element, adopted = new WeakMap()) {
|
|
395
417
|
//console.log('proxyObject', obj, element.constructor.name)
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
return new Proxy(obj, getStateObjectProxyHandler(element)); // if an plan object was set, proxy it too. If an object has a class other than Object, we'll leave it alone
|
|
418
|
+
const raw = $original in obj ? obj[$original] : obj;
|
|
419
|
+
const existing = adopted.get(raw);
|
|
420
|
+
if (existing) return existing;
|
|
421
|
+
obj = adoptIntoState(obj, element);
|
|
422
|
+
const proxy = new Proxy(obj, getStateObjectProxyHandler(element)); // if an plan object was set, proxy it too. If an object has a class other than Object, we'll leave it alone
|
|
423
|
+
adopted.set(raw, proxy);
|
|
424
|
+
proxyObjectContent(element, obj, adopted);
|
|
425
|
+
return proxy;
|
|
405
426
|
}
|
|
406
|
-
function proxyArray(arr, element) {
|
|
427
|
+
function proxyArray(arr, element, adopted = new WeakMap()) {
|
|
407
428
|
//console.log('proxyArray')
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
return new Proxy(arr, getStateArrayProxyHandler(element));
|
|
429
|
+
const raw = $original in arr ? arr[$original] : arr;
|
|
430
|
+
const existing = adopted.get(raw);
|
|
431
|
+
if (existing) return existing;
|
|
432
|
+
arr = adoptIntoState(arr, element);
|
|
433
|
+
const proxy = new Proxy(arr, getStateArrayProxyHandler(element));
|
|
434
|
+
adopted.set(raw, proxy);
|
|
435
|
+
proxyArrayContent(element, arr, adopted);
|
|
436
|
+
return proxy;
|
|
417
437
|
}
|
|
418
|
-
function proxySet(set, element) {
|
|
438
|
+
function proxySet(set, element, adopted = new WeakMap()) {
|
|
419
439
|
//console.log('proxySet')
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
440
|
+
const raw = $original in set ? set[$original] : set;
|
|
441
|
+
const existing = adopted.get(raw);
|
|
442
|
+
if (existing) return existing;
|
|
443
|
+
set = adoptIntoState(set, element);
|
|
444
|
+
const proxy = new Proxy(set, getStateSetProxyHandler(element));
|
|
445
|
+
adopted.set(raw, proxy);
|
|
446
|
+
return proxy;
|
|
424
447
|
}
|
|
425
|
-
function proxyMap(map, element) {
|
|
448
|
+
function proxyMap(map, element, adopted = new WeakMap()) {
|
|
426
449
|
//console.log('proxyMap')
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
450
|
+
const raw = $original in map ? map[$original] : map;
|
|
451
|
+
const existing = adopted.get(raw);
|
|
452
|
+
if (existing) return existing;
|
|
453
|
+
map = adoptIntoState(map, element);
|
|
454
|
+
const proxy = new Proxy(map, getStateMapProxyHandler(element));
|
|
455
|
+
adopted.set(raw, proxy);
|
|
456
|
+
return proxy;
|
|
431
457
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"componentProxyHandlers.sxyt.d.ts","sourceRoot":"","sources":["../src/componentProxyHandlers.sxyt.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
|
+
import { describe } from 'sxy-test-runner';
|
|
5
|
+
import { expect } from 'chai';
|
|
6
|
+
import { proxyObjectContent, getStateProxyHandler, $original, $ownerName } from "./componentProxyHandlers.js";
|
|
7
|
+
class FakeComponent {
|
|
8
|
+
constructor() {
|
|
9
|
+
_defineProperty(this, "__initialized", true);
|
|
10
|
+
_defineProperty(this, "updates", 0);
|
|
11
|
+
}
|
|
12
|
+
__stateUpdated() {
|
|
13
|
+
this.updates++;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
class ParentComp extends FakeComponent {}
|
|
17
|
+
class ChildComp extends FakeComponent {}
|
|
18
|
+
// proxyObjectContent proxies a state object's contents in place, the same entry point
|
|
19
|
+
// Components.__init uses, so state.<key> afterwards is a state-object proxy
|
|
20
|
+
function makeState(element, state) {
|
|
21
|
+
proxyObjectContent(element, state);
|
|
22
|
+
return state;
|
|
23
|
+
}
|
|
24
|
+
describe('componentProxyHandlers state adoption', ({
|
|
25
|
+
it
|
|
26
|
+
}) => {
|
|
27
|
+
it('exposes $original and $ownerName on state object proxies', () => {
|
|
28
|
+
const parent = new ParentComp();
|
|
29
|
+
const state = makeState(parent, {
|
|
30
|
+
data: {
|
|
31
|
+
x: 1
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
expect(state.data[$ownerName]).to.equal('ParentComp');
|
|
35
|
+
expect(state.data[$original]).to.deep.equal({
|
|
36
|
+
x: 1
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
it('adopts an object owned by another component as a copy instead of throwing', () => {
|
|
40
|
+
const parent = new ParentComp();
|
|
41
|
+
const parentState = makeState(parent, {
|
|
42
|
+
data: {
|
|
43
|
+
x: 1,
|
|
44
|
+
nested: {
|
|
45
|
+
y: 2
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
const child = new ChildComp();
|
|
50
|
+
const childState = makeState(child, {
|
|
51
|
+
data: parentState.data
|
|
52
|
+
});
|
|
53
|
+
expect(childState.data).to.not.equal(parentState.data);
|
|
54
|
+
expect(childState.data.x).to.equal(1);
|
|
55
|
+
expect(childState.data.nested.y).to.equal(2);
|
|
56
|
+
// the two components must not alias, at any depth
|
|
57
|
+
childState.data.x = 99;
|
|
58
|
+
childState.data.nested.y = 55;
|
|
59
|
+
expect(parentState.data.x).to.equal(1);
|
|
60
|
+
expect(parentState.data.nested.y).to.equal(2);
|
|
61
|
+
expect(parent.updates).to.equal(0);
|
|
62
|
+
expect(child.updates).to.be.greaterThan(0);
|
|
63
|
+
});
|
|
64
|
+
it('adopts via the top-level state set trap too', () => {
|
|
65
|
+
const parent = new ParentComp();
|
|
66
|
+
const parentState = makeState(parent, {
|
|
67
|
+
list: [1, {
|
|
68
|
+
deep: true
|
|
69
|
+
}]
|
|
70
|
+
});
|
|
71
|
+
const child = new ChildComp();
|
|
72
|
+
const childStateTarget = {
|
|
73
|
+
list: undefined
|
|
74
|
+
};
|
|
75
|
+
const childState = new Proxy(childStateTarget, getStateProxyHandler(child));
|
|
76
|
+
childState.list = parentState.list;
|
|
77
|
+
expect(childState.list).to.not.equal(parentState.list);
|
|
78
|
+
childState.list.push(2);
|
|
79
|
+
expect(childState.list.length).to.equal(3);
|
|
80
|
+
expect(parentState.list.length).to.equal(2);
|
|
81
|
+
});
|
|
82
|
+
it('preserves shared references within one state tree', () => {
|
|
83
|
+
const el = new ParentComp();
|
|
84
|
+
const shared = {
|
|
85
|
+
v: 1
|
|
86
|
+
};
|
|
87
|
+
const state = makeState(el, {
|
|
88
|
+
a: shared,
|
|
89
|
+
b: shared
|
|
90
|
+
});
|
|
91
|
+
expect(state.a).to.equal(state.b);
|
|
92
|
+
state.a.v = 2;
|
|
93
|
+
expect(state.b.v).to.equal(2);
|
|
94
|
+
});
|
|
95
|
+
it('terminates on self-referencing objects', () => {
|
|
96
|
+
const el = new ParentComp();
|
|
97
|
+
const cyc = {
|
|
98
|
+
n: 1
|
|
99
|
+
};
|
|
100
|
+
cyc.self = cyc;
|
|
101
|
+
const state = makeState(el, {
|
|
102
|
+
cyc
|
|
103
|
+
});
|
|
104
|
+
expect(state.cyc.self).to.equal(state.cyc);
|
|
105
|
+
expect(state.cyc.self.self.n).to.equal(1);
|
|
106
|
+
});
|
|
107
|
+
it('adopts Maps and Sets as copies', () => {
|
|
108
|
+
const parent = new ParentComp();
|
|
109
|
+
const parentState = makeState(parent, {
|
|
110
|
+
m: new Map([['k', 1]]),
|
|
111
|
+
s: new Set([1, 2])
|
|
112
|
+
});
|
|
113
|
+
const child = new ChildComp();
|
|
114
|
+
const childState = makeState(child, {
|
|
115
|
+
m: parentState.m,
|
|
116
|
+
s: parentState.s
|
|
117
|
+
});
|
|
118
|
+
childState.m.set('k', 2);
|
|
119
|
+
childState.s.add(3);
|
|
120
|
+
expect(parentState.m.get('k')).to.equal(1);
|
|
121
|
+
expect(parentState.s.has(3)).to.equal(false);
|
|
122
|
+
});
|
|
123
|
+
it('assigns a Map set into top-level state (missing assignment fix)', () => {
|
|
124
|
+
const el = new ParentComp();
|
|
125
|
+
const state = new Proxy({}, getStateProxyHandler(el));
|
|
126
|
+
state.m = new Map([['k', 1]]);
|
|
127
|
+
expect(state.m).to.not.equal(undefined);
|
|
128
|
+
expect(state.m.get('k')).to.equal(1);
|
|
129
|
+
});
|
|
130
|
+
});
|
package/dist/findUserConfig.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findUserConfig.d.ts","sourceRoot":"","sources":["../src/findUserConfig.ts"],"names":[],"mappings":"AAaA,wBAAsB,cAAc,CAAC,UAAU,EAAE,MAAM;;;;
|
|
1
|
+
{"version":3,"file":"findUserConfig.d.ts","sourceRoot":"","sources":["../src/findUserConfig.ts"],"names":[],"mappings":"AAaA,wBAAsB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,GAAE,QAAQ,GAAG,OAAiB;;;;UAsE5F"}
|
package/dist/findUserConfig.js
CHANGED
|
@@ -6,7 +6,7 @@ import { cliNote, cliWarn } from "./cliOutput.js";
|
|
|
6
6
|
import { TungstenError } from "./TungstenError.js";
|
|
7
7
|
import { packageNameCapitalized } from "./settings.js";
|
|
8
8
|
//import { throwError } from './throwError.js'
|
|
9
|
-
export async function findUserConfig(projectDir) {
|
|
9
|
+
export async function findUserConfig(projectDir, volume = 'noisy') {
|
|
10
10
|
const packageConfig = await loadPackageDotJsonFromDir(projectDir); // eslint-disable-line no-type-assertion/no-type-assertion
|
|
11
11
|
if (packageConfig === null) {
|
|
12
12
|
throw new TungstenError(`findUserConfig() error: Could not find project tungsten config`);
|
|
@@ -14,7 +14,7 @@ export async function findUserConfig(projectDir) {
|
|
|
14
14
|
const configBases = [projectDir + '/' + configName, projectDir + '/config/' + configName].map(location => slash(location));
|
|
15
15
|
async function foundConfig(type, location) {
|
|
16
16
|
//const [configType, configLocation] = configInfo
|
|
17
|
-
cliNote(`${packageNameCapitalized} using user config at ${location}`);
|
|
17
|
+
if (volume !== 'silent') cliNote(`${packageNameCapitalized} using user config at ${location}`);
|
|
18
18
|
const config = (await import('file://' + location)).default;
|
|
19
19
|
return {
|
|
20
20
|
data: config,
|
|
@@ -38,6 +38,7 @@ declare const frameworkConfigWithRootComponentValidator: import("arktype/interna
|
|
|
38
38
|
packageSystem?: "rewrites" | "aliases";
|
|
39
39
|
ignoreDirs?: string[];
|
|
40
40
|
ignorePatterns?: string | string[];
|
|
41
|
+
skipPackageCompilation?: string | string[];
|
|
41
42
|
serverMiddleware?: [string, string, string];
|
|
42
43
|
apiRoutes?: string;
|
|
43
44
|
apiPath?: string;
|
|
@@ -82,6 +83,7 @@ declare const frameworkConfigWithoutRootComponentValidator: import("arktype/inte
|
|
|
82
83
|
packageSystem?: "rewrites" | "aliases";
|
|
83
84
|
ignoreDirs?: string[];
|
|
84
85
|
ignorePatterns?: string | string[];
|
|
86
|
+
skipPackageCompilation?: string | string[];
|
|
85
87
|
serverMiddleware?: [string, string, string];
|
|
86
88
|
apiRoutes?: string;
|
|
87
89
|
apiPath?: string;
|
|
@@ -125,6 +127,7 @@ export declare const frameworkConfigValidator: import("arktype/internal/variants
|
|
|
125
127
|
packageSystem?: "rewrites" | "aliases";
|
|
126
128
|
ignoreDirs?: string[];
|
|
127
129
|
ignorePatterns?: string | string[];
|
|
130
|
+
skipPackageCompilation?: string | string[];
|
|
128
131
|
serverMiddleware?: [string, string, string];
|
|
129
132
|
apiRoutes?: string;
|
|
130
133
|
apiPath?: string;
|
|
@@ -168,6 +171,7 @@ export declare const frameworkConfigValidator: import("arktype/internal/variants
|
|
|
168
171
|
packageSystem?: "rewrites" | "aliases";
|
|
169
172
|
ignoreDirs?: string[];
|
|
170
173
|
ignorePatterns?: string | string[];
|
|
174
|
+
skipPackageCompilation?: string | string[];
|
|
171
175
|
serverMiddleware?: [string, string, string];
|
|
172
176
|
apiRoutes?: string;
|
|
173
177
|
apiPath?: string;
|
|
@@ -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;
|
|
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;AAyDnD,QAAA,MAAM,yCAAyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAK7C,CAAA;AAEF,QAAA,MAAM,4CAA4C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAIhD,CAAA;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAEoB,CAAA;AAEzD,KAAK,mCAAmC,GAAG,OAAO,yCAAyC,CAAC,KAAK,CAAA;AACjG,KAAK,sCAAsC,GAAG,OAAO,4CAA4C,CAAC,KAAK,CAAA;AAIvG,UAAU,gCACN,SAAQ,IAAI,CAAC,mCAAmC,EAAE,cAAc,GAAG,cAAc,CAAC;IAClF,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,YAAY,CAAC,EAAE,kBAAkB,CAAA;CACpC;AAED,UAAU,mCACN,SAAQ,IAAI,CAAC,sCAAsC,EAAE,cAAc,GAAG,cAAc,CAAC;IACrF,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,YAAY,CAAC,EAAE,kBAAkB,CAAA;CACpC;AAED,MAAM,MAAM,eAAe,GAAG,gCAAgC,GAAG,mCAAmC,CAAA"}
|
|
@@ -47,6 +47,7 @@ const frameworkConfigBaseValidator = arkType({
|
|
|
47
47
|
'ignoreDirs?': 'string[]',
|
|
48
48
|
// rename to ignoreFolders?
|
|
49
49
|
'ignorePatterns?': 'string | string[]',
|
|
50
|
+
'skipPackageCompilation?': 'string | string[]',
|
|
50
51
|
'serverMiddleware?': ['string', 'string', 'string'],
|
|
51
52
|
'apiRoutes?': 'string',
|
|
52
53
|
'apiPath?': 'string'
|
package/dist/getUserConfig.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FrameworkConfigComplete } from './FrameworkConfig.js';
|
|
2
|
-
export declare function getUserConfig(): Promise<FrameworkConfigComplete>;
|
|
2
|
+
export declare function getUserConfig(volume?: 'silent' | 'noisy'): Promise<FrameworkConfigComplete>;
|
|
3
3
|
//# sourceMappingURL=getUserConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUserConfig.d.ts","sourceRoot":"","sources":["../src/getUserConfig.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAM9D,wBAAsB,aAAa,
|
|
1
|
+
{"version":3,"file":"getUserConfig.d.ts","sourceRoot":"","sources":["../src/getUserConfig.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAM9D,wBAAsB,aAAa,CAAC,MAAM,GAAE,QAAQ,GAAG,OAAiB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAyB1G"}
|
package/dist/getUserConfig.js
CHANGED
|
@@ -5,8 +5,8 @@ import { frameworkConfigValidator } from "./frameworkConfigSchema.js";
|
|
|
5
5
|
import { makeFinalConfig } from "./makeFinalConfig.js";
|
|
6
6
|
import { throwError } from "./throwError.js";
|
|
7
7
|
import { cliOut } from "./cliOutput.js";
|
|
8
|
-
export async function getUserConfig() {
|
|
9
|
-
const userConfigOrNull = await findUserConfig(process.cwd());
|
|
8
|
+
export async function getUserConfig(volume = 'noisy') {
|
|
9
|
+
const userConfigOrNull = await findUserConfig(process.cwd(), volume);
|
|
10
10
|
//frameworkCon
|
|
11
11
|
if (userConfigOrNull !== null) {
|
|
12
12
|
const userConfig = userConfigOrNull;
|
package/dist/hooks/useState.js
CHANGED
|
@@ -24,7 +24,7 @@ export function useState(...defaultValue) {
|
|
|
24
24
|
// not just current state value
|
|
25
25
|
//if (newValue !== c.state[])
|
|
26
26
|
c.state[index] = newValue;
|
|
27
|
-
c.
|
|
27
|
+
c.__queueUpdate();
|
|
28
28
|
}
|
|
29
29
|
if (index.toString() in c.state) {
|
|
30
30
|
//console.log('useState re-run', c.state[index])
|