tungsten 0.4.12 → 0.4.14
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/AnyComponent.d.ts.map +1 -1
- package/dist/Components.d.ts +40 -0
- package/dist/Components.d.ts.map +1 -1
- package/dist/Components.js +66 -77
- package/dist/DomPointer.js +1 -1
- package/dist/DomRegion.js +2 -2
- package/dist/Framework.js +1 -1
- package/dist/FrameworkConfig.d.ts.map +1 -1
- package/dist/Instance/Instance.js +1 -1
- package/dist/RenderedContentNode.d.ts.map +1 -1
- package/dist/RenderedContentNode.js +2 -1
- package/dist/Sass.d.ts.map +1 -1
- package/dist/Sass.js +1 -0
- package/dist/Servers/DevServer.d.ts.map +1 -1
- package/dist/Servers/DevServer.js +4 -3
- package/dist/Servers/ProdServer.js +1 -1
- package/dist/Servers/StaticSiteServer.js +1 -1
- package/dist/Servers/loadEnvsDev.d.ts +1 -1
- package/dist/Servers/loadEnvsDev.d.ts.map +1 -1
- package/dist/Servers/loadEnvsDev.js +4 -2
- package/dist/Servers/routing.d.ts.map +1 -1
- package/dist/Servers/routing.js +1 -1
- package/dist/Store/Store.js +1 -1
- package/dist/Store/TypeSafeStore.js +1 -1
- package/dist/Store/makeStore.js +1 -1
- package/dist/Store/registerStore.js +1 -1
- package/dist/TElement.js +1 -1
- package/dist/TungstenApp.js +6 -2
- package/dist/_client/cjsHelpers.d.ts.map +1 -1
- package/dist/_client/cjsHelpers.js +4 -2
- package/dist/_client/client.js +0 -14
- package/dist/_client/hmr.d.ts +2 -0
- package/dist/_client/hmr.d.ts.map +1 -0
- package/dist/_client/hmr.js +65 -0
- package/dist/_client/liveReload.d.ts +2 -0
- package/dist/_client/liveReload.d.ts.map +1 -0
- package/dist/_client/liveReload.js +6 -0
- package/dist/_client/liveReloadSource.d.ts +3 -0
- package/dist/_client/liveReloadSource.d.ts.map +1 -0
- package/dist/_client/liveReloadSource.js +25 -0
- package/dist/api/getExport.d.ts.map +1 -1
- package/dist/api/getExport.js +1 -0
- package/dist/babelPlugins/BabelTransformBindDirect.js +2 -0
- package/dist/babelPlugins/BabelTransformBindVar.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformComponentState.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformComponentStyles.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformComponentStyles.js +5 -4
- package/dist/babelPlugins/BabelTransformCssImports.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformCssImports.js +2 -2
- package/dist/babelPlugins/BabelTransformDependencyImportsOld.js +1 -1
- package/dist/babelPlugins/BabelTransformDeproxyState.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformPackageImports.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformPackageImports.js +10 -5
- package/dist/babelPlugins/BabelTransformRemoveBlocks.d.ts.map +1 -1
- package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsCjs.d.ts.map +1 -1
- package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsCjs.js +2 -1
- package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsEsm.d.ts.map +1 -1
- package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsEsm.js +2 -1
- package/dist/babelPlugins/transformPackageImports/getWebLocationOfPackageFile.js +1 -1
- package/dist/bin/args.js +1 -1
- package/dist/bin/commands/build.js +1 -1
- package/dist/bin/commands/compileSimplePackage.js +1 -0
- package/dist/bin/index.d.ts.map +1 -1
- package/dist/bin/index.js +11 -3
- package/dist/bin/vendorHook.d.ts +3 -0
- package/dist/bin/vendorHook.d.ts.map +1 -0
- package/dist/bin/vendorHook.js +34 -0
- package/dist/browserStorage.js +4 -2
- package/dist/build/babel.user.common.config.d.ts +2 -0
- package/dist/build/babel.user.common.config.d.ts.map +1 -1
- package/dist/build/babel.user.common.config.js +10 -4
- package/dist/build/bundle.d.ts.map +1 -1
- package/dist/build/bundle.js +10 -1
- package/dist/build/compileJavascript.d.ts.map +1 -1
- package/dist/build/compileJavascript.js +40 -27
- package/dist/build/compileStyles.js +4 -4
- package/dist/build/copyAssets.js +3 -3
- package/dist/build/copyPublicFiles.js +3 -3
- package/dist/build/createClientFiles.d.ts.map +1 -1
- package/dist/build/createClientFiles.js +4 -8
- package/dist/build/frameworkStylesheets.js +1 -1
- package/dist/build/getAllSxyClientModules.d.ts.map +1 -1
- package/dist/build/getAllSxyClientModules.js +4 -28
- package/dist/build/getSxyClientPackageAliases.d.ts.map +1 -1
- package/dist/build/getSxyClientPackageAliases.js +3 -1
- package/dist/build/makeBabelUserDevConfig.d.ts.map +1 -1
- package/dist/build/makeBabelUserProdConfig.d.ts.map +1 -1
- package/dist/build/rollupExtractComponentStylesheets.js +1 -1
- package/dist/build/sassImportParser.js +2 -2
- package/dist/build/tallyBabel.d.ts +3 -0
- package/dist/build/tallyBabel.d.ts.map +1 -0
- package/dist/build/tallyBabel.js +11 -0
- package/dist/clone.js +4 -4
- package/dist/compat/context.d.ts.map +1 -1
- package/dist/compat/types.d.ts.map +1 -1
- package/dist/componentProxyHandlers.d.ts +20 -13
- package/dist/componentProxyHandlers.d.ts.map +1 -1
- package/dist/componentProxyHandlers.js +134 -94
- package/dist/components/Stylesheet.d.ts +1 -2
- package/dist/components/Stylesheet.d.ts.map +1 -1
- package/dist/components/Stylesheet.js +1 -1
- package/dist/components/bindable/BindableCheckbox.d.ts.map +1 -1
- package/dist/components/bindable/BindableInput.d.ts.map +1 -1
- package/dist/components/bindable/BindableInputTypedLegacy.d.ts.map +1 -1
- package/dist/components/bindable/BindableRadio.d.ts.map +1 -1
- package/dist/components/bindable/BindableTextarea.d.ts.map +1 -1
- package/dist/components/library/RichTextEditor/RichTextEditor.js +2 -2
- package/dist/components/library/RichTextEditor/contentTree.js +1 -1
- package/dist/concat.d.ts.map +1 -1
- package/dist/concat.js +2 -2
- package/dist/copy.d.ts.map +1 -1
- package/dist/createRoutes.d.ts +1 -1
- package/dist/createRoutes.d.ts.map +1 -1
- package/dist/env/Env.js +2 -2
- package/dist/env/getEnvSchemas.d.ts +2 -2
- package/dist/env/getEnvSchemas.d.ts.map +1 -1
- package/dist/env/getEnvSchemas.js +7 -5
- package/dist/env/windowGlobalEnvStatement.d.ts.map +1 -1
- package/dist/findProjectDir.d.ts.map +1 -1
- package/dist/findProjectDir.js +18 -4
- package/dist/findUserConfig.js +2 -2
- package/dist/foreach.js +1 -0
- package/dist/frameworkConfigSchema.js +2 -2
- package/dist/getComponent.d.ts.map +1 -1
- package/dist/getComponentDev.d.ts.map +1 -1
- package/dist/getRoutes.d.ts.map +1 -1
- package/dist/getRoutes.js +13 -22
- package/dist/getRoutesDevs.d.ts.map +1 -1
- package/dist/getStackTrace.js +1 -1
- package/dist/glob.d.ts +5 -0
- package/dist/glob.d.ts.map +1 -0
- package/dist/glob.js +103 -0
- package/dist/helpers/getFetchCompatibleHeaders.js +2 -2
- package/dist/hmr/applyHmrModule.js +5 -5
- package/dist/hmr/componentIdentity.js +1 -1
- package/dist/hmr/instanceRegistry.js +2 -2
- package/dist/hooks/useReducer.d.ts.map +1 -1
- package/dist/hooks/useState.d.ts.map +1 -1
- package/dist/hooks/useState.js +2 -8
- package/dist/hydrate/hydrate.d.ts +1 -1
- package/dist/hydrate/hydrate.d.ts.map +1 -1
- package/dist/hydrate/hydrate.js +29 -25
- package/dist/hydrate/reconcileHydratedAttributes.js +2 -2
- package/dist/indexInner.d.ts +1 -1
- package/dist/indexInner.d.ts.map +1 -1
- package/dist/indexInner.js +1 -0
- package/dist/makeFinalConfig.d.ts.map +1 -1
- package/dist/makeFinalConfig.js +2 -2
- package/dist/markOptionSelected.js +1 -1
- package/dist/mergeConfigs.d.ts.map +1 -1
- package/dist/mergeConfigs.js +11 -2
- package/dist/mutatingFunctions.d.ts +2 -1
- package/dist/mutatingFunctions.d.ts.map +1 -1
- package/dist/mutatingFunctions.js +10 -4
- package/dist/postcssPlugins/TransformCssNames.js +2 -2
- package/dist/rawHtml/parseHtml.js +1 -1
- package/dist/render/componentNodeToRenderingTree.d.ts.map +1 -1
- package/dist/render/componentNodeToRenderingTree.js +6 -17
- package/dist/render/contentToHtml.d.ts.map +1 -1
- package/dist/render/contentToHtml.js +1 -1
- package/dist/render/getFunctionBodyAsString.d.ts.map +1 -1
- package/dist/render/getFunctionBodyAsString.js +2 -5
- package/dist/render/processHead.d.ts.map +1 -1
- package/dist/render/processHead.js +5 -34
- package/dist/render/processProps.js +2 -2
- package/dist/render/renderingTreeToHtml.d.ts.map +1 -1
- package/dist/render/rootToHtml.d.ts.map +1 -1
- package/dist/routing/Route.js +1 -1
- package/dist/routing/RouteDataFunction.type.d.ts.map +1 -1
- package/dist/routing/RoutesWithSafeParams.js +1 -1
- package/dist/routing/WebRedirect.d.ts.map +1 -1
- package/dist/routing/compareRequestToRegex.js +2 -2
- package/dist/routing/getPathPriority.js +1 -1
- package/dist/serverRpc.d.ts.map +1 -1
- package/dist/signals/tracking.d.ts +33 -0
- package/dist/signals/tracking.d.ts.map +1 -0
- package/dist/signals/tracking.js +87 -0
- package/dist/slash.d.ts +2 -0
- package/dist/slash.d.ts.map +1 -0
- package/dist/slash.js +5 -0
- package/dist/spawnShellCommand.js +1 -1
- package/dist/staticGen/staticGen.d.ts.map +1 -1
- package/dist/staticGen/staticGen.js +9 -7
- package/dist/staticGen/staticGenFunctions.js +1 -1
- package/dist/style/jssToCss.d.ts.map +1 -1
- package/dist/style/jssToCss.js +11 -9
- package/dist/style/unusedStyles.d.ts.map +1 -1
- package/dist/testing/host.js +11 -11
- package/dist/testing/hydrateTestApp.d.ts.map +1 -1
- package/dist/testing/hydrateTestApp.js +9 -9
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/installTestStyleProcessors.js +1 -1
- package/dist/testing/loadEnv.d.ts +4 -1
- package/dist/testing/loadEnv.d.ts.map +1 -1
- package/dist/testing/loadEnv.js +2 -2
- package/dist/testing/temp/componentPackageMock.js +3 -3
- package/dist/timeProfiler.d.ts +4 -0
- package/dist/timeProfiler.d.ts.map +1 -1
- package/dist/timeProfiler.js +16 -0
- package/dist/todo.js +2 -1
- package/dist/update/integrateUpdateVdom.d.ts.map +1 -1
- package/dist/update/integrateUpdateVdom.js +17 -14
- package/dist/update/integrateUpdateVdomPrebuild.js +5 -5
- package/dist/warnOnFrameworkChange.js +1 -1
- package/dist/watch.js +2 -2
- package/package.json +14 -33
- package/types/modules.d.ts +0 -1
- package/vendor/babel-core.js +26 -0
- package/vendor/babel-parser.js +9 -0
- package/vendor/babel-plugin-syntax-import-assertions.js +50 -0
- package/vendor/babel-preset-react.js +872 -0
- package/vendor/babel-preset-typescript.js +26 -0
- package/vendor/babel-types.js +9 -0
- package/vendor/chalk-extensions.js +1994 -0
- package/vendor/chalk.js +647 -0
- package/vendor/chokidar.js +6889 -0
- package/vendor/chunk-1TN2rK3j.js +1218 -0
- package/vendor/chunk-1UuLTU0U.js +34 -0
- package/vendor/chunk-B_NeooyV.js +86 -0
- package/vendor/chunk-C12hSZn7.js +88 -0
- package/vendor/chunk-C3YkUGz5.js +19 -0
- package/vendor/chunk-C3fcZDjl.js +41964 -0
- package/vendor/chunk-C9FSKeSx.js +14603 -0
- package/vendor/chunk-CPArXGxa.js +14623 -0
- package/vendor/cjs-module-lexer.js +6 -0
- package/vendor/dotenv.js +412 -0
- package/vendor/express.js +40577 -0
- package/vendor/import-meta-resolve.js +2201 -0
- package/vendor/manifest.json +29 -0
- package/vendor/postcss.js +8546 -0
- package/vendor/serialize-javascript.js +293 -0
- package/vendor/sxy-lib-arrays.js +113 -0
- package/vendor/sxy-lib-object-copy.js +1781 -0
- package/vendor/sxy-lib-objects.js +156 -0
- package/vendor/sxy-lib-promises.js +47 -0
- package/vendor/sxy-package-investigator.js +202 -0
- package/vendor/valibot.js +7664 -0
- package/dist/Servers/hono/DevServerHono.d.ts +0 -2
- package/dist/Servers/hono/DevServerHono.d.ts.map +0 -1
- package/dist/Servers/hono/DevServerHono.js +0 -423
- package/dist/Servers/hono/ProdServerHono.d.ts +0 -2
- package/dist/Servers/hono/ProdServerHono.d.ts.map +0 -1
- package/dist/Servers/hono/ProdServerHono.js +0 -220
- package/dist/Servers/hono/TungstenServerHono.d.ts +0 -6
- package/dist/Servers/hono/TungstenServerHono.d.ts.map +0 -1
- package/dist/Servers/hono/TungstenServerHono.js +0 -36
- package/dist/api/ApiEndpointHono.d.ts +0 -3
- package/dist/api/ApiEndpointHono.d.ts.map +0 -1
- package/dist/api/ApiEndpointHono.js +0 -1
- package/dist/api/ApiRouteHono.d.ts +0 -7
- package/dist/api/ApiRouteHono.d.ts.map +0 -1
- package/dist/api/ApiRouteHono.js +0 -1
- package/dist/api/ApiRoutesHono.d.ts +0 -5
- package/dist/api/ApiRoutesHono.d.ts.map +0 -1
- package/dist/api/ApiRoutesHono.js +0 -1
- package/dist/api/getApiRoutesHono.d.ts +0 -6
- package/dist/api/getApiRoutesHono.d.ts.map +0 -1
- package/dist/api/getApiRoutesHono.js +0 -14
- package/dist/build/compilePackages.d.ts +0 -2
- package/dist/build/compilePackages.d.ts.map +0 -1
- package/dist/build/compilePackages.js +0 -89
- package/dist/build/findRequiredUserModule.d.ts +0 -2
- package/dist/build/findRequiredUserModule.d.ts.map +0 -1
- package/dist/build/findRequiredUserModule.js +0 -36
- package/dist/build/processPackage.d.ts +0 -4
- package/dist/build/processPackage.d.ts.map +0 -1
- package/dist/build/processPackage.js +0 -91
- package/dist/build/tallyBabelPlugins.d.ts +0 -3
- package/dist/build/tallyBabelPlugins.d.ts.map +0 -1
- package/dist/build/tallyBabelPlugins.js +0 -63
- package/dist/testing/loadEnvSetup.d.ts +0 -2
- package/dist/testing/loadEnvSetup.d.ts.map +0 -1
- package/dist/testing/loadEnvSetup.js +0 -7
- package/sxy-loader.config.js +0 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vendorHook.d.ts","sourceRoot":"","sources":["../../src/bin/vendorHook.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;AAE1D,wBAAgB,kBAAkB,IAAI,gBAAgB,CA2BrD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { registerHooks } from 'node:module';
|
|
2
|
+
import { existsSync, readFileSync, statSync } from 'node:fs';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
5
|
+
import { cliWarn } from '../cliOutput.js';
|
|
6
|
+
export function registerVendorHook() {
|
|
7
|
+
const packageDir = dirname(dirname(dirname(fileURLToPath(import.meta.url))));
|
|
8
|
+
const vendorDir = join(packageDir, 'vendor');
|
|
9
|
+
const manifestPath = join(vendorDir, 'manifest.json');
|
|
10
|
+
if (!existsSync(manifestPath)) return 'none';
|
|
11
|
+
const manifest = JSON.parse(readFileSync(manifestPath, 'utf8')); // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- our own file
|
|
12
|
+
const lockfile = join(packageDir, 'pnpm-lock.yaml');
|
|
13
|
+
// a linked checkout whose dependencies moved on: fall back rather than run a stale bundle
|
|
14
|
+
if (manifest.lockfile !== undefined && existsSync(lockfile)) {
|
|
15
|
+
const stat = statSync(lockfile);
|
|
16
|
+
if (stat.size !== manifest.lockfile.size || stat.mtimeMs !== manifest.lockfile.mtimeMs) {
|
|
17
|
+
cliWarn('vendor bundle is older than pnpm-lock.yaml - loading dependencies from node_modules (pnpm build-vendor)');
|
|
18
|
+
return 'stale';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const entries = new Map(Object.entries(manifest.specifiers).map(([specifier, name]) => [specifier, pathToFileURL(join(vendorDir, `${name}.js`)).href]));
|
|
22
|
+
registerHooks({
|
|
23
|
+
resolve(specifier, context, next) {
|
|
24
|
+
const url = entries.get(specifier);
|
|
25
|
+
// require() callers want module.exports, which the ESM wrappers do not hand back the same way
|
|
26
|
+
if (url === undefined || context.conditions.includes('require')) return next(specifier, context);
|
|
27
|
+
return {
|
|
28
|
+
url,
|
|
29
|
+
shortCircuit: true
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return 'active';
|
|
34
|
+
}
|
package/dist/browserStorage.js
CHANGED
|
@@ -38,7 +38,7 @@ export class TungstenLocalStorage {
|
|
|
38
38
|
_defineProperty(this, "clear", () => {
|
|
39
39
|
localStorage.clear();
|
|
40
40
|
for (const key in _classPrivateFieldGet(_subscribers, this)) {
|
|
41
|
-
_classPrivateFieldGet(_push, this).call(this, key, undefined); // eslint-disable-line
|
|
41
|
+
_classPrivateFieldGet(_push, this).call(this, key, undefined); // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- TS is being a wanker about keys of object
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
_defineProperty(this, "key", index => localStorage.key(index));
|
|
@@ -60,6 +60,7 @@ export class TungstenLocalStorage {
|
|
|
60
60
|
if (subs) {
|
|
61
61
|
for (const element of subs) {
|
|
62
62
|
if ('shouldStoreComponentUpdate' in element && element.shouldStoreComponentUpdate !== undefined) {
|
|
63
|
+
// eslint-disable-line @typescript-eslint/no-unnecessary-condition -- the field can be declared yet unset
|
|
63
64
|
if (!element.shouldStoreComponentUpdate(key, value)) {
|
|
64
65
|
continue;
|
|
65
66
|
}
|
|
@@ -95,7 +96,7 @@ export class TungstenSessionStorage {
|
|
|
95
96
|
_defineProperty(this, "clear", () => {
|
|
96
97
|
sessionStorage.clear();
|
|
97
98
|
for (const key in _classPrivateFieldGet(_subscribers2, this)) {
|
|
98
|
-
_classPrivateFieldGet(_push2, this).call(this, key, undefined); // eslint-disable-line
|
|
99
|
+
_classPrivateFieldGet(_push2, this).call(this, key, undefined); // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- TS is being a wanker about keys of object
|
|
99
100
|
}
|
|
100
101
|
});
|
|
101
102
|
_defineProperty(this, "key", index => sessionStorage.key(index));
|
|
@@ -117,6 +118,7 @@ export class TungstenSessionStorage {
|
|
|
117
118
|
if (subs) {
|
|
118
119
|
for (const element of subs) {
|
|
119
120
|
if ('shouldStoreComponentUpdate' in element && element.shouldStoreComponentUpdate !== undefined) {
|
|
121
|
+
// eslint-disable-line @typescript-eslint/no-unnecessary-condition -- the field can be declared yet unset
|
|
120
122
|
if (!element.shouldStoreComponentUpdate(key, value)) {
|
|
121
123
|
continue;
|
|
122
124
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"babel.user.common.config.d.ts","sourceRoot":"","sources":["../../src/build/babel.user.common.config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAoB,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"babel.user.common.config.d.ts","sourceRoot":"","sources":["../../src/build/babel.user.common.config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAoB,MAAM,aAAa,CAAA;AAW/D,wBAAgB,gBAAgB,IAAI,UAAU,CAG7C;AAMD,QAAA,MAAM,gBAAgB;;;;aAcb,UAAU,EAAE;aAMZ,UAAU,EAAE;CACO,CAAA;AAE5B,eAAe,gBAAgB,CAAA"}
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
import { MakeBabelTransformJsxExtensionsToJs } from "../babelPlugins/BabelTransformJsxExtensionsToJs.js";
|
|
2
2
|
import { buildFolder } from "../settings.js";
|
|
3
|
+
import { createRequire } from "module";
|
|
3
4
|
import babelPresetReactModule from "@babel/preset-react";
|
|
4
|
-
import babelPresetTypescriptModule from "@babel/preset-typescript";
|
|
5
5
|
const babelPresetReact = babelPresetReactModule.default;
|
|
6
|
-
const
|
|
6
|
+
const require = createRequire(import.meta.url);
|
|
7
7
|
// config `typescript: true`: appended after preset-react so babel runs it first (presets run last
|
|
8
8
|
// to first). allowDeclareFields matches tsc's useDefineForClassFields: `x: T` stays a field,
|
|
9
9
|
// `declare x: T` is erased - without it babel erases both.
|
|
10
|
+
// required on demand: ~95 modules that only this flag needs
|
|
10
11
|
export function typescriptPreset() {
|
|
12
|
+
const babelPresetTypescript = require("@babel/preset-typescript").default;
|
|
11
13
|
return [babelPresetTypescript, {
|
|
12
14
|
allowDeclareFields: true
|
|
13
15
|
}];
|
|
14
16
|
}
|
|
15
|
-
import babelPluginCssToJs from "babel-plugin-css-to-js";
|
|
16
17
|
const regexEscape = r => r.replaceAll(".", "\\.");
|
|
17
18
|
const ignoreRegex = new RegExp(`(node_modules|${regexEscape(buildFolder)})`);
|
|
18
19
|
const userCommonConfig = {
|
|
19
20
|
ignore: [ignoreRegex],
|
|
21
|
+
// the config is all here: no per-file search up the tree for .babelrc / babel.config.*
|
|
22
|
+
babelrc: false,
|
|
23
|
+
configFile: false,
|
|
20
24
|
presets: [[babelPresetReact, {
|
|
21
25
|
"runtime": "automatic",
|
|
22
26
|
"importSource": "tungsten"
|
|
@@ -29,6 +33,8 @@ const userCommonConfig = {
|
|
|
29
33
|
// widen to allow pushing
|
|
30
34
|
// no alias plugin: preset-react's `tungsten/jsx-runtime` import resolves through the package's
|
|
31
35
|
// exports map (node, rollup, the packages plugin) and the dev import map has the same key
|
|
32
|
-
plugins: [MakeBabelTransformJsxExtensionsToJs()
|
|
36
|
+
plugins: [MakeBabelTransformJsxExtensionsToJs()
|
|
37
|
+
// no css-to-js: the lowercase css`…` tag it compiled is not used; css="…" is a plain string prop
|
|
38
|
+
] // widen to allow pushing
|
|
33
39
|
};
|
|
34
40
|
export default userCommonConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/build/bundle.ts"],"names":[],"mappings":"AAWA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,UAAQ,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/build/bundle.ts"],"names":[],"mappings":"AAWA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,UAAQ,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,oBAyD1F"}
|
package/dist/build/bundle.js
CHANGED
|
@@ -17,7 +17,16 @@ export async function bundle(projectDir, quiet = false, targets) {
|
|
|
17
17
|
const externalModules = [
|
|
18
18
|
//'node-fetch'
|
|
19
19
|
];
|
|
20
|
-
const
|
|
20
|
+
const includeCd = true; // the command runs in the framework dir so
|
|
21
|
+
// does not need to cd to it - but keeping
|
|
22
|
+
// the cd lets the command be run from the
|
|
23
|
+
// consuming project folder, which is useful
|
|
24
|
+
// for debugging, which is basically why we
|
|
25
|
+
// print it to begin with.
|
|
26
|
+
const entryFile = join(projectDir, prodBuildFolder, clientFolder, 'client.js');
|
|
27
|
+
const outFile = join(projectDir, bundleFolder, 'client.js');
|
|
28
|
+
const configFile = join(frameworkDir, frameworkDistFolder, 'build/rollup.user.prod.config.js');
|
|
29
|
+
const command = (includeCd ? `cd "${frameworkDir}" && ` : '') + `npx rollup` + ` --input "${entryFile}"` + ` --file "${outFile}"` + ` --config "${configFile}"` + (externalModules.length > 0 ? ` --external ${externalModules.join(',')}` : ``) + ` --inlineDynamicImports --format iife`;
|
|
21
30
|
if (!quiet) cliLog('bundle command:', command);
|
|
22
31
|
// the rollup config reads this back; a browserslist query can hold commas, which rollup's own
|
|
23
32
|
// --environment flag would split on
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compileJavascript.d.ts","sourceRoot":"","sources":["../../src/build/compileJavascript.ts"],"names":[],"mappings":"AAGA,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;AAmBtC,KAAK,uBAAuB,GAAG;IAC3B,OAAO,EAAE,QAAQ,CAAC,SAAS,GAA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uBAAuB,CAAC,CA4gBlC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { join, dirname } from 'path';
|
|
1
|
+
import { join, dirname, isAbsolute } from 'path';
|
|
2
2
|
import { pathToFileURL } from 'url';
|
|
3
3
|
import chokidar from 'chokidar';
|
|
4
|
-
import {
|
|
4
|
+
import { transformSync as babelTransformSync } from '@babel/core';
|
|
5
5
|
import fs, { promises as fsPromises } from 'fs';
|
|
6
|
-
import slash from 'slash';
|
|
6
|
+
import slash from '../slash.js';
|
|
7
7
|
import serializeJavascript from 'serialize-javascript';
|
|
8
|
-
import {
|
|
8
|
+
import { glob } from '../glob.js';
|
|
9
9
|
import { devRawBuildFolder, packagesCacheFolder, prodRawBuildFolder, stylesCacheFolder } from '../settings.js';
|
|
10
10
|
import { frameworkVersion } from './frameworkDestLocation.js';
|
|
11
11
|
import { makeBabelUserDevConfig } from './makeBabelUserDevConfig.js';
|
|
@@ -13,7 +13,7 @@ import { makeBabelUserProdConfig } from './makeBabelUserProdConfig.js';
|
|
|
13
13
|
import { makeBabelRawConfig } from './makeBabelRawConfig.js';
|
|
14
14
|
import { cliOut, cliLog, cliError, cliWarn } from '../cliOutput.js'; // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
15
15
|
import { createTimeProfiler, isProfiling, tallied } from '../timeProfiler.js';
|
|
16
|
-
import {
|
|
16
|
+
import { tallyBabel } from './tallyBabel.js';
|
|
17
17
|
import { TungstenError } from '../TungstenError.js';
|
|
18
18
|
import { getFrameworkDir } from '../getFrameworkDir.js';
|
|
19
19
|
// The graph writeDependencyGraph() left behind on the previous run, naming a compiled copy of every
|
|
@@ -52,9 +52,8 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
52
52
|
const skipPackageCompilationFiles = new Set();
|
|
53
53
|
async function refreshSkipPackageCompilationFiles() {
|
|
54
54
|
skipPackageCompilationFiles.clear();
|
|
55
|
-
const matchingFiles = await
|
|
56
|
-
cwd: codeLocation
|
|
57
|
-
absolute: true
|
|
55
|
+
const matchingFiles = await glob(skipPackageCompilationPatterns, {
|
|
56
|
+
cwd: codeLocation
|
|
58
57
|
});
|
|
59
58
|
for (const file of matchingFiles) skipPackageCompilationFiles.add(slash(file));
|
|
60
59
|
}
|
|
@@ -76,8 +75,8 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
76
75
|
// per-plugin attribution of the transform's time, only when someone is looking: the wrappers
|
|
77
76
|
// run per AST node
|
|
78
77
|
if (isProfiling()) {
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
tallyBabel(config);
|
|
79
|
+
tallyBabel(rawConfig);
|
|
81
80
|
if (mode === 'dev' && compilePackages) {
|
|
82
81
|
cliWarn(`profiling serves linked packages from the packages cache -` + ` pass --fresh after rebuilding one, or this run compiles stale code`);
|
|
83
82
|
}
|
|
@@ -114,12 +113,15 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
114
113
|
failedFiles.delete(file);
|
|
115
114
|
return;
|
|
116
115
|
}
|
|
116
|
+
// each transform runs synchronously up to its write, so both are in flight together
|
|
117
|
+
const writes = [];
|
|
117
118
|
if (client) {
|
|
118
|
-
transformTo(file, config, join(buildCodeLocation, outputRel(file)), 'babel transform', true);
|
|
119
|
+
writes.push(transformTo(file, sourceContent, config, join(buildCodeLocation, outputRel(file)), 'babel transform', true));
|
|
119
120
|
}
|
|
120
121
|
if (raw) {
|
|
121
|
-
transformTo(file, rawConfig, join(rawBuildLocation, outputRel(file)), 'babel transform (raw)', false);
|
|
122
|
+
writes.push(transformTo(file, sourceContent, rawConfig, join(rawBuildLocation, outputRel(file)), 'babel transform (raw)', false));
|
|
122
123
|
}
|
|
124
|
+
await Promise.all(writes);
|
|
123
125
|
failedFiles.delete(file);
|
|
124
126
|
} catch (e) {
|
|
125
127
|
failedFiles.add(file);
|
|
@@ -128,12 +130,17 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
128
130
|
throw e;
|
|
129
131
|
}
|
|
130
132
|
}
|
|
131
|
-
// One pipeline's transform and write.
|
|
132
|
-
// during it. Babel's work is cpu-bound on one thread either way, so the async
|
|
133
|
-
// concurrent calls bought no parallelism, only scheduling. The plugins defer their
|
|
134
|
-
// into opts.promises rather than awaiting in a visitor, which is what makes sync
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
// One pipeline's transform and write. The transform is sync, so it can be tallied exactly -
|
|
134
|
+
// nothing else runs during it. Babel's work is cpu-bound on one thread either way, so the async
|
|
135
|
+
// API's 291 concurrent calls bought no parallelism, only scheduling. The plugins defer their
|
|
136
|
+
// async work into opts.promises rather than awaiting in a visitor, which is what makes sync
|
|
137
|
+
// viable. Async so the client and raw writes of one file could overlap; see the write below.
|
|
138
|
+
async function transformTo(file, sourceContent, babelConfig, dest, tallyName, guardExportWipe) {
|
|
139
|
+
// the content already read above: transformFileSync would read the file a second time
|
|
140
|
+
const result = tallied(tallyName, () => babelTransformSync(sourceContent, {
|
|
141
|
+
...babelConfig,
|
|
142
|
+
filename: file
|
|
143
|
+
}));
|
|
137
144
|
if (result === null) throw new TungstenError(`Err: babel transform on file ${file} returned null`);
|
|
138
145
|
const {
|
|
139
146
|
code
|
|
@@ -180,10 +187,13 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
180
187
|
pendingExportWipes.delete(file);
|
|
181
188
|
}
|
|
182
189
|
}
|
|
190
|
+
// Sync on purpose (measured 2026-09, qtc-2, 202 files, phase time minus babel's): sync
|
|
191
|
+
// ~400ms, fsPromises mkdir + writeFile ~520ms, memoising the mkdir no better. Babel saturates
|
|
192
|
+
// the main thread so completions only queue, and the promise api's open/write/close costs
|
|
193
|
+
// more there than a 1.5ms blocking write. Long ago the promise version also misbehaved.
|
|
183
194
|
fs.mkdirSync(dirname(dest), {
|
|
184
195
|
recursive: true
|
|
185
196
|
});
|
|
186
|
-
//// Using the sync version here, because the promise version keeps bugging out - node bug?
|
|
187
197
|
fs.writeFileSync(dest, code);
|
|
188
198
|
}
|
|
189
199
|
async function deleteTransformedFile(file) {
|
|
@@ -238,13 +248,16 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
238
248
|
const ignoreDirs = typeof appConfig.ignoreDirs === 'string' ? [appConfig.ignoreDirs] : appConfig.ignoreDirs;
|
|
239
249
|
ignored.push(...ignoreDirs.map(folder => slash(`${codeLocation}/${folder}/**`)));
|
|
240
250
|
}
|
|
251
|
+
// patterns are relative to the code dir, like the dirs above and the selections below; raw they
|
|
252
|
+
// resolved against the cwd, so `client/testing/**` never matched <code>/client/testing/…
|
|
253
|
+
const fromCodeDir = pattern => isAbsolute(pattern) ? slash(pattern) : slash(`${codeLocation}/${pattern}`);
|
|
241
254
|
if (appConfig.ignorePatterns !== undefined && appConfig.ignorePatterns !== '') {
|
|
242
255
|
if (Array.isArray(appConfig.ignorePatterns)) {
|
|
243
256
|
for (const pattern of appConfig.ignorePatterns) {
|
|
244
|
-
ignored.push(pattern);
|
|
257
|
+
ignored.push(fromCodeDir(pattern));
|
|
245
258
|
}
|
|
246
259
|
} else {
|
|
247
|
-
ignored.push(appConfig.ignorePatterns);
|
|
260
|
+
ignored.push(fromCodeDir(appConfig.ignorePatterns));
|
|
248
261
|
}
|
|
249
262
|
}
|
|
250
263
|
// test files are a category, not noise: excluded here like ignoreDirs/ignorePatterns, but a
|
|
@@ -255,7 +268,8 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
255
268
|
ignored.push(...testDirs.map(folder => slash(`${codeLocation}/${folder}/**`)));
|
|
256
269
|
}
|
|
257
270
|
if (appConfig.testPatterns !== undefined && appConfig.testPatterns !== '') {
|
|
258
|
-
|
|
271
|
+
const testPatterns = Array.isArray(appConfig.testPatterns) ? appConfig.testPatterns : [appConfig.testPatterns];
|
|
272
|
+
ignored.push(...testPatterns.map(fromCodeDir));
|
|
259
273
|
}
|
|
260
274
|
}
|
|
261
275
|
if (appConfig.exclude !== undefined) ignored.push(slash(`${codeLocation}/${appConfig.exclude}`));
|
|
@@ -275,9 +289,8 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
275
289
|
let clientFiles = null;
|
|
276
290
|
let rawFiles = new Set();
|
|
277
291
|
async function selectedFiles(selection) {
|
|
278
|
-
const files = await
|
|
279
|
-
cwd: codeLocation
|
|
280
|
-
absolute: true
|
|
292
|
+
const files = await glob(selection, {
|
|
293
|
+
cwd: codeLocation
|
|
281
294
|
});
|
|
282
295
|
return new Set(files.map(file => slash(file)));
|
|
283
296
|
}
|
|
@@ -298,7 +311,7 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
298
311
|
// phases record into the profiler module's shared timeline, so this instance need not be the
|
|
299
312
|
// one the command created - it only has to be enabled when --profile is
|
|
300
313
|
const profiler = createTimeProfiler(isProfiling());
|
|
301
|
-
const paths = await profiler.timeProfileAsync('find source files', () =>
|
|
314
|
+
const paths = await profiler.timeProfileAsync('find source files', () => glob([watchGlob, ...ignored.map(x => `!${x}`)]));
|
|
302
315
|
// the transforms are started inside the phase, not just awaited there: a resource is charged to
|
|
303
316
|
// the phase that created it, so starting them outside credits all the work to the parent
|
|
304
317
|
const transformResults = await profiler.timeProfileAsync(`transform ${paths.length} files`, () => {
|
|
@@ -340,7 +353,7 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
340
353
|
await fsPromises.mkdir(dirname(pending.dest), {
|
|
341
354
|
recursive: true
|
|
342
355
|
});
|
|
343
|
-
|
|
356
|
+
await fsPromises.writeFile(pending.dest, pending.code);
|
|
344
357
|
failedFiles.delete(file);
|
|
345
358
|
const failures = await settleDeferredWork();
|
|
346
359
|
success = failures.length === 0 && failedFiles.size === 0;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import slash from 'slash';
|
|
1
|
+
import slash from '../slash.js';
|
|
2
2
|
import chokidar from 'chokidar';
|
|
3
3
|
import { join, dirname, resolve } from 'path';
|
|
4
4
|
import { pathToFileURL } from 'url';
|
|
5
5
|
import { promises as fsPromises, utimesSync } from 'fs';
|
|
6
6
|
import * as sass from 'sass';
|
|
7
|
-
import {
|
|
7
|
+
import { glob } from '../glob.js';
|
|
8
8
|
import { staticFolder } from '../settings.js';
|
|
9
9
|
import { cliError, cliOut } from '../cliOutput.js'; // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
10
10
|
import { throwError } from '../throwError.js';
|
|
@@ -59,7 +59,7 @@ function findSxssDependencies(data, file, regex, extension) {
|
|
|
59
59
|
// [...xxx] converts it to a plain array
|
|
60
60
|
let results = [...data.matchAll(regex)]
|
|
61
61
|
// the matches group is on position 1, so we map to get just the match group
|
|
62
|
-
.map(x => x[1]); // eslint-disable-line
|
|
62
|
+
.map(x => x[1]); // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
|
|
63
63
|
if (extension === '.sass') results = results.map(dep => {
|
|
64
64
|
if ((dep.startsWith(`'`) || dep.startsWith(`"`)) && dep.endsWith(dep[0])) {
|
|
65
65
|
return dep.slice(1, -1);
|
|
@@ -216,7 +216,7 @@ export async function compileStyles(projectDir, config, styleImportBase, buildLo
|
|
|
216
216
|
const ignoreGlob = buildLocation + '/**/*';
|
|
217
217
|
debug('Styles watchGlob', watchGlob);
|
|
218
218
|
if (!watch) {
|
|
219
|
-
const files = await
|
|
219
|
+
const files = await glob(slash(watchGlob));
|
|
220
220
|
await Promise.all(files.map(file => processAndCopyFile(sourceLocation, staticLocation, slash(file), styleImportBase, cssFiles, cssDependencies, cssdependers)));
|
|
221
221
|
return null;
|
|
222
222
|
}
|
package/dist/build/copyAssets.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import slash from 'slash';
|
|
1
|
+
import slash from '../slash.js';
|
|
2
2
|
import chokidar from 'chokidar';
|
|
3
3
|
import { join, dirname } from 'path';
|
|
4
4
|
import { promises as fsPromises } from 'fs';
|
|
5
|
-
import {
|
|
5
|
+
import { glob } from '../glob.js';
|
|
6
6
|
import { cliOut } from '../cliOutput.js';
|
|
7
7
|
async function copyFile(assetsLocation, targetLocation, filePathFull, event) {
|
|
8
8
|
const relFile = filePathFull.slice(assetsLocation.length + 1);
|
|
@@ -23,7 +23,7 @@ export async function copyAssets(projectDir, config, buildLocation, watch = true
|
|
|
23
23
|
const watchGlob = assetsLocation + '/**/*';
|
|
24
24
|
//const ignoreGlob = buildLocation + '/**/*'
|
|
25
25
|
if (!watch) {
|
|
26
|
-
const files = await
|
|
26
|
+
const files = await glob(slash(watchGlob));
|
|
27
27
|
await Promise.all(files.map(file => copyFile(assetsLocation, targetLocation, slash(file), 'add')));
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import slash from 'slash';
|
|
1
|
+
import slash from '../slash.js';
|
|
2
2
|
import chokidar from 'chokidar';
|
|
3
3
|
import { join, dirname } from 'path';
|
|
4
4
|
import { promises as fsPromises } from 'fs';
|
|
5
|
-
import {
|
|
5
|
+
import { glob } from '../glob.js';
|
|
6
6
|
import { cliOut } from '../cliOutput.js';
|
|
7
7
|
async function copyFile(assetsLocation, targetLocation, filePathFull, event) {
|
|
8
8
|
const relFile = filePathFull.slice(assetsLocation.length + 1);
|
|
@@ -24,7 +24,7 @@ export async function copyPublicFiles(projectDir, config, buildLocation, watch =
|
|
|
24
24
|
const watchGlob = publicLocation + '/**/*';
|
|
25
25
|
//const ignoreGlob = buildLocation + '/**/*'
|
|
26
26
|
if (!watch) {
|
|
27
|
-
const files = await
|
|
27
|
+
const files = await glob(slash(watchGlob));
|
|
28
28
|
await Promise.all(files.map(file => copyFile(publicLocation, targetLocation, slash(file), 'add')));
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createClientFiles.d.ts","sourceRoot":"","sources":["../../src/build/createClientFiles.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAOtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAG/D,wBAAsB,iBAAiB,CACnC,MAAM,EAAE,uBAAuB,EAC/B,IAAI,EAAE,IAAI,EACV,aAAa,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"createClientFiles.d.ts","sourceRoot":"","sources":["../../src/build/createClientFiles.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAOtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAG/D,wBAAsB,iBAAiB,CACnC,MAAM,EAAE,uBAAuB,EAC/B,IAAI,EAAE,IAAI,EACV,aAAa,CAAC,EAAE,MAAM,iBA6EzB"}
|
|
@@ -16,15 +16,11 @@ export async function createClientFiles(config, mode, buildLocation) {
|
|
|
16
16
|
await fsPromises.mkdir(join(specificBuildFolder, `${clientFolder}`), {
|
|
17
17
|
recursive: true
|
|
18
18
|
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
fsPromises.copyFile(join(frameworkDir, frameworkDistFolder, frameworkClientFolder,
|
|
19
|
+
// copied verbatim from the framework's dist, so they stay outside the traced module graph
|
|
20
|
+
const frameworkClientFiles = ['client.js', 'cjsHelpers.js', 'liveReloadSource.js', 'liveReload.js', 'hmr.js'];
|
|
21
|
+
const promises = [...frameworkClientFiles.map(file => fsPromises.copyFile(join(frameworkDir, frameworkDistFolder, frameworkClientFolder, file),
|
|
22
22
|
// from
|
|
23
|
-
join(specificBuildFolder,
|
|
24
|
-
// cjsHelpers.js file
|
|
25
|
-
fsPromises.copyFile(join(frameworkDir, frameworkDistFolder, frameworkClientFolder, 'cjsHelpers.js'),
|
|
26
|
-
// from
|
|
27
|
-
join(specificBuildFolder, `${clientFolder}/cjsHelpers.js`)),
|
|
23
|
+
join(specificBuildFolder, clientFolder, file))),
|
|
28
24
|
// app routes stuff
|
|
29
25
|
fsPromises.writeFile(join(specificBuildFolder, clientFolder, 'routes.js'), `export { ${routesExportName} as routes } from '../${codeSubPath}${fixExtension(routeFilePath)}'`)];
|
|
30
26
|
const clientRootComponentFileLocation = join(specificBuildFolder, clientFolder, 'RootComponent.js');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync, promises as fsPromises } from 'fs';
|
|
2
2
|
import { dirname, join } from 'path';
|
|
3
|
-
import slash from 'slash';
|
|
3
|
+
import slash from '../slash.js';
|
|
4
4
|
import { frameworkCssFile, frameworkCssFolder, frameworkDistFolder } from '../settings.js';
|
|
5
5
|
// Component stylesheets named by a `$stylesheet` static on a package component, collected while
|
|
6
6
|
// the package import tree is walked so only components the app actually imports contribute.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAllSxyClientModules.d.ts","sourceRoot":"","sources":["../../src/build/getAllSxyClientModules.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getAllSxyClientModules.d.ts","sourceRoot":"","sources":["../../src/build/getAllSxyClientModules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,MAAM,MAAM,qBAAqB,GAAG,MAAM,EAAE,CAAA;AAK5C,wBAAgB,2BAA2B,IAAI,qBAAqB,CAEnE"}
|
|
@@ -1,30 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { frameworkDistFolder } from '../settings.js';
|
|
1
|
+
// the module list this used to walk with sxy-dependency-tree has been empty for a long time; the
|
|
2
|
+
// walk went with it (typescript + typescript-estree, ~250 modules at dev start). The servers
|
|
3
|
+
// still guard on the field being defined.
|
|
5
4
|
export function getAllTungstenClientModules() {
|
|
6
|
-
|
|
7
|
-
const tungstenModules = [];
|
|
8
|
-
for (const module of []) {
|
|
9
|
-
const fullPath = join(frameworkLocation, frameworkDistFolder, module);
|
|
10
|
-
const nonExistent = [];
|
|
11
|
-
const dependencies = dependencyTree.toList({
|
|
12
|
-
filename: fullPath,
|
|
13
|
-
directory: frameworkLocation,
|
|
14
|
-
nonExistent
|
|
15
|
-
});
|
|
16
|
-
for (const dependency of dependencies) {
|
|
17
|
-
if (!tungstenModules.includes(dependency)) {
|
|
18
|
-
tungstenModules.push(dependency);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
//const distCodeLocation = frameworkLocation+'/'+frameworkDistFolder+'/'
|
|
23
|
-
const tungstenModulesDetailed = tungstenModules.map(module => {
|
|
24
|
-
return {
|
|
25
|
-
abs: module,
|
|
26
|
-
rel: module.slice((frameworkLocation + '/').length) // relative to base
|
|
27
|
-
};
|
|
28
|
-
});
|
|
29
|
-
return tungstenModulesDetailed;
|
|
5
|
+
return [];
|
|
30
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSxyClientPackageAliases.d.ts","sourceRoot":"","sources":["../../src/build/getSxyClientPackageAliases.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getSxyClientPackageAliases.d.ts","sourceRoot":"","sources":["../../src/build/getSxyClientPackageAliases.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAKvD,wBAAgB,+BAA+B,IAAI,aAAa,CAoC/D"}
|
|
@@ -12,7 +12,9 @@ export function getTungstenClientPackageAliases() {
|
|
|
12
12
|
'tungsten': `${frameworkDestLocation}/index.js`,
|
|
13
13
|
// what preset-react emits, in app code and the framework's own dist alike; the exports
|
|
14
14
|
// map answers it for node and rollup
|
|
15
|
-
'tungsten/jsx-runtime': `${frameworkDestLocation}/jsx-runtime.js
|
|
15
|
+
'tungsten/jsx-runtime': `${frameworkDestLocation}/jsx-runtime.js`,
|
|
16
|
+
// imported by _client/hmr.js, which is served verbatim rather than transformed
|
|
17
|
+
'tungsten/hmr/applyHmrModule.js': `${frameworkDestLocation}/hmr/applyHmrModule.js`
|
|
16
18
|
// The component library, mirroring the `./library` subpath in exports.
|
|
17
19
|
//'tungsten/library': `${frameworkDestLocation}/components/library/index.js`,
|
|
18
20
|
//'tungsten': `${frameworkDestLocation}/indexBundle.js`,
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"makeBabelUserDevConfig.d.ts","sourceRoot":"","sources":["../../src/build/makeBabelUserDevConfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAInD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,OAAO,EAAoC,eAAe,EAAE,MAAM,iDAAiD,CAAA;AAOnH,wBAAgB,sBAAsB,CAClC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,OAAO,EACnB,kBAAkB,EAAE,MAAM,EAC1B,aAAa,EAAE,MAAM,EACrB,iBAAiB,EAAE,MAAM,EACzB,qBAAqB,EAAE,MAAM,EAC7B,mBAAmB,EAAE,MAAM,GAAG,SAAS,EACvC,KAAK,EAAE,OAAO,EACd,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,EACxB,WAAW,UAAO,EAClB,GAAG,UAAQ,EACX,QAAQ,UAAO,GAChB,gBAAgB,CA4ClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeBabelUserProdConfig.d.ts","sourceRoot":"","sources":["../../src/build/makeBabelUserProdConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"makeBabelUserProdConfig.d.ts","sourceRoot":"","sources":["../../src/build/makeBabelUserProdConfig.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAMnD,wBAAgB,uBAAuB,CACnC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,OAAO,EACnB,kBAAkB,EAAE,MAAM,EAC1B,WAAW,UAAO,GACnB,gBAAgB,CAqBlB"}
|
|
@@ -22,7 +22,7 @@ export function rollupExtractComponentStylesheets() {
|
|
|
22
22
|
return found ? {
|
|
23
23
|
code: stripped,
|
|
24
24
|
map: null
|
|
25
|
-
} : null;
|
|
25
|
+
} : null; // eslint-disable-line @typescript-eslint/no-unnecessary-condition -- set inside the replace callback, which narrowing cannot see
|
|
26
26
|
},
|
|
27
27
|
// The bundle is written to <build>/.bundle/<file>, so the build root is two up.
|
|
28
28
|
async writeBundle(outputOptions) {
|
|
@@ -148,7 +148,7 @@ export function sassImportParser(code) {
|
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
switch (mode) {
|
|
151
|
-
// eslint-disable-line
|
|
151
|
+
// eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- TS incorrectly reduces type of mode
|
|
152
152
|
case 'search':
|
|
153
153
|
{
|
|
154
154
|
if (char === ' ') {
|
|
@@ -250,7 +250,7 @@ export function sassImportParser(code) {
|
|
|
250
250
|
}
|
|
251
251
|
// end of line
|
|
252
252
|
switch (mode) {
|
|
253
|
-
// eslint-disable-line
|
|
253
|
+
// eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- TS incorrectly reduces type of mode
|
|
254
254
|
case 'at-rule':
|
|
255
255
|
{
|
|
256
256
|
finishAtRule();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tallyBabel.d.ts","sourceRoot":"","sources":["../../src/build/tallyBabel.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAa,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAkB9D,wBAAgB,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAIzD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { tallied } from '../timeProfiler.js';
|
|
2
|
+
const coreTallies = {
|
|
3
|
+
name: 'tungsten-tally-core',
|
|
4
|
+
visitor: {},
|
|
5
|
+
parserOverride: (code, opts, parse) => tallied('babel: parse', () => parse(code, opts)),
|
|
6
|
+
generatorOverride: (ast, opts, code, generate) => tallied('babel: generate', () => generate(ast, opts, code))
|
|
7
|
+
};
|
|
8
|
+
export function tallyBabel(config) {
|
|
9
|
+
config.wrapPluginVisitorMethod = (alias, _type, visit) => (path, state) => tallied(`babel: ${alias}`, () => visit(path, state));
|
|
10
|
+
config.plugins = [...(config.plugins ?? []), coreTallies];
|
|
11
|
+
}
|
package/dist/clone.js
CHANGED
|
@@ -2,15 +2,15 @@ import { map as objectMap } from 'sxy-lib/objects.js';
|
|
|
2
2
|
export function clone(x) {
|
|
3
3
|
if (typeof x === 'object' && x !== null) {
|
|
4
4
|
if (Array.isArray(x)) {
|
|
5
|
-
// eslint-disable-next-line
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
6
6
|
return x.map(v => clone(v));
|
|
7
7
|
} else {
|
|
8
|
-
// eslint-disable-next-line
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
9
9
|
const newObj = objectMap(x, (k, v) => clone(v));
|
|
10
10
|
Object.getOwnPropertySymbols(x).forEach(
|
|
11
|
-
// eslint-disable-next-line
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
12
12
|
s => newObj[s] = x[s]);
|
|
13
|
-
// eslint-disable-next-line
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
14
14
|
return newObj;
|
|
15
15
|
}
|
|
16
16
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/compat/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,SAAS,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/compat/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,SAAS,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAwC7E,UAAU,OAAO,CAAC,CAAC;IACf,QAAQ,EAAE,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC7B,QAAQ,EAAE,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AAED,wBAAgB,aAAa,CAAC,CAAC,EAG3B,YAAY,EAAE,CAAC,GAChB,OAAO,CAAC,CAAC,CAAC,CAKZ;AAED,KAAK,aAAa,CAAC,CAAC,IAAI;IACpB,KAAK,EAAE,CAAC,CAAA;IACR,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACpC,CAAA;AAID,cAAM,QAAQ,CAAC,CAAC,CAAE,SAAQ,uBAAuB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAI/D,OAAO,kBAA4B;CACtC;AAGD,KAAK,aAAa,CAAC,CAAC,IAAI;IACpB,QAAQ,EAAE,CAAC,YAAY,EAAE,CAAC,KAAK,SAAS,CAAC;CAC5C,CAAA;AAID,cAAM,QAAQ,CAAC,CAAC,CAAE,SAAQ,uBAAuB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAC/D,YAAY,EAAE,CAAC,CAAA;gBACH,GAAG,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC;IAI9D,OAAO,kBAA+C;CACzD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.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