tungsten 0.4.11 → 0.4.13
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 -0
- package/dist/AnyComponent.d.ts.map +1 -1
- package/dist/AnyComponent.js +1 -1
- package/dist/Components.d.ts.map +1 -1
- package/dist/Components.js +25 -23
- package/dist/ContentNode.js +2 -2
- package/dist/DomPointer.js +1 -1
- package/dist/DomRegion.js +3 -3
- package/dist/Framework.d.ts +2 -1
- package/dist/Framework.d.ts.map +1 -1
- package/dist/Framework.js +44 -35
- package/dist/FrameworkConfig.d.ts +16 -0
- package/dist/FrameworkConfig.d.ts.map +1 -1
- package/dist/FunctionComponentStandIn.js +8 -8
- package/dist/Instance/Instance.js +12 -12
- package/dist/RenderedContentNode.d.ts.map +1 -1
- package/dist/RenderedContentNode.js +4 -3
- package/dist/RenderingNode.js +2 -2
- package/dist/Sass.d.ts.map +1 -1
- package/dist/Sass.js +1 -0
- package/dist/Script.js +1 -1
- package/dist/Servers/DevServer.d.ts.map +1 -1
- package/dist/Servers/DevServer.js +33 -32
- package/dist/Servers/ProdServer.js +15 -15
- package/dist/Servers/StaticSiteServer.js +4 -4
- package/dist/Servers/TungstenServer.js +5 -5
- package/dist/Servers/devErrorPageAutoRetry.js +1 -1
- package/dist/Servers/initStores.js +3 -3
- package/dist/Servers/loadEnvsDev.d.ts +1 -1
- package/dist/Servers/loadEnvsDev.d.ts.map +1 -1
- package/dist/Servers/loadEnvsDev.js +10 -8
- package/dist/Servers/routing.d.ts.map +1 -1
- package/dist/Servers/routing.js +4 -4
- package/dist/Store/Store.js +1 -1
- package/dist/Store/TypeSafeStore.js +1 -1
- package/dist/Store/createStores.js +2 -2
- package/dist/Store/makeStore.js +3 -3
- package/dist/Store/registerStore.js +3 -3
- package/dist/TElement.js +1 -1
- package/dist/TungstenApp.js +9 -5
- package/dist/TungstenStyleObject.js +1 -1
- package/dist/__deproxy.js +2 -2
- package/dist/_client/client.js +3 -3
- package/dist/alive.js +1 -1
- package/dist/api/getApiRoutes.js +3 -3
- package/dist/api/getExport.d.ts.map +1 -1
- package/dist/api/getExport.js +5 -4
- package/dist/api/getExportDev.js +1 -1
- package/dist/appOutput.js +1 -1
- package/dist/auth/index.js +2 -2
- package/dist/babelPlugins/BabelAddDevCacheBust.d.ts.map +1 -1
- package/dist/babelPlugins/BabelAddDevCacheBust.js +4 -2
- package/dist/babelPlugins/BabelTransformBindDirect.js +4 -2
- package/dist/babelPlugins/BabelTransformBindVar.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformBindVar.js +3 -3
- package/dist/babelPlugins/BabelTransformCjsToEsm.js +1 -1
- package/dist/babelPlugins/BabelTransformComponentState.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformComponentState.js +2 -2
- package/dist/babelPlugins/BabelTransformComponentStyles.d.ts +2 -0
- package/dist/babelPlugins/BabelTransformComponentStyles.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformComponentStyles.js +32 -15
- package/dist/babelPlugins/BabelTransformCssImports.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformCssImports.js +3 -3
- package/dist/babelPlugins/BabelTransformDependencyImportsOld.js +1 -1
- package/dist/babelPlugins/BabelTransformDeproxyState.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformDeproxyState.js +1 -1
- package/dist/babelPlugins/BabelTransformJsxExtensionsToJs.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformJsxExtensionsToJs.js +6 -2
- package/dist/babelPlugins/BabelTransformPackageImports.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformPackageImports.js +75 -53
- package/dist/babelPlugins/BabelTransformReactive.js +1 -1
- package/dist/babelPlugins/BabelTransformReactiveSvelteStyle.js +1 -1
- package/dist/babelPlugins/BabelTransformRemoveBlocks.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformSxyFrameworkImports.js +1 -1
- package/dist/babelPlugins/BabelTransformUniqueComponents.js +1 -1
- package/dist/babelPlugins/fixImportsInSassErrorMessage.js +1 -1
- package/dist/babelPlugins/test.js +1 -1
- package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsCjs.d.ts.map +1 -1
- package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsCjs.js +5 -4
- package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsEsm.d.ts.map +1 -1
- package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsEsm.js +3 -2
- package/dist/babelPlugins/transformPackageImports/getWebLocationOfPackageFile.js +2 -2
- package/dist/bin/args.js +2 -2
- package/dist/bin/commands/build.js +6 -6
- package/dist/bin/commands/buildHelp.js +1 -1
- package/dist/bin/commands/clean.js +4 -4
- package/dist/bin/commands/compile.d.ts.map +1 -1
- package/dist/bin/commands/compile.js +24 -17
- package/dist/bin/commands/compileSimplePackage.js +3 -2
- package/dist/bin/commands/dev.d.ts.map +1 -1
- package/dist/bin/commands/dev.js +16 -9
- package/dist/bin/commands/devmon.js +4 -4
- package/dist/bin/commands/help.js +2 -2
- package/dist/bin/commands/start.js +2 -2
- package/dist/bin/commands/static.js +3 -3
- package/dist/bin/index.d.ts.map +1 -1
- package/dist/bin/index.js +24 -16
- package/dist/bin/moduleLoadAnalysis.js +2 -2
- 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 +6 -4
- package/dist/build/babel.user.common.config.d.ts +9 -2
- package/dist/build/babel.user.common.config.d.ts.map +1 -1
- package/dist/build/babel.user.common.config.js +21 -16
- package/dist/build/bundle.d.ts +1 -1
- package/dist/build/bundle.d.ts.map +1 -1
- package/dist/build/bundle.js +15 -7
- package/dist/build/bundleBabelOptions.d.ts +6 -0
- package/dist/build/bundleBabelOptions.d.ts.map +1 -0
- package/dist/build/bundleBabelOptions.js +23 -0
- package/dist/build/combineComponentCss.js +2 -2
- package/dist/build/compileJavascript.d.ts +4 -0
- package/dist/build/compileJavascript.d.ts.map +1 -1
- package/dist/build/compileJavascript.js +174 -103
- package/dist/build/compileStyles.js +8 -8
- package/dist/build/compileUserApp.d.ts +1 -1
- package/dist/build/compileUserApp.d.ts.map +1 -1
- package/dist/build/compileUserApp.js +15 -12
- package/dist/build/componentStylesCache.d.ts +10 -0
- package/dist/build/componentStylesCache.d.ts.map +1 -0
- package/dist/build/componentStylesCache.js +54 -0
- package/dist/build/copyAssets.js +4 -4
- package/dist/build/copyPackageModulesToPackagesFolder.js +4 -4
- package/dist/build/copyPublicFiles.js +4 -4
- package/dist/build/createClientFiles.js +3 -3
- package/dist/build/createInstanceConfigFile.js +2 -2
- package/dist/build/createPackageVirtualFileSystems.js +1 -1
- package/dist/build/devBundle.js +5 -5
- package/dist/build/devBundle.rollup.config.d.ts.map +1 -1
- package/dist/build/devBundle.rollup.config.js +0 -1
- package/dist/build/frameworkDestLocation.d.ts +1 -0
- package/dist/build/frameworkDestLocation.d.ts.map +1 -1
- package/dist/build/frameworkDestLocation.js +8 -4
- package/dist/build/frameworkStylesheets.js +2 -2
- package/dist/build/getAllSxyClientModules.d.ts.map +1 -1
- package/dist/build/getAllSxyClientModules.js +4 -28
- package/dist/build/getPackageDirForFile.js +1 -1
- package/dist/build/getSxyClientPackageAliases.d.ts.map +1 -1
- package/dist/build/getSxyClientPackageAliases.js +4 -2
- package/dist/build/getTempDirForAppCompilation.js +1 -1
- package/dist/build/makeBabelRawConfig.d.ts +3 -0
- package/dist/build/makeBabelRawConfig.d.ts.map +1 -0
- package/dist/build/makeBabelRawConfig.js +12 -0
- package/dist/build/makeBabelUserDevConfig.d.ts +1 -1
- package/dist/build/makeBabelUserDevConfig.d.ts.map +1 -1
- package/dist/build/makeBabelUserDevConfig.js +11 -8
- package/dist/build/makeBabelUserProdConfig.d.ts +1 -1
- package/dist/build/makeBabelUserProdConfig.d.ts.map +1 -1
- package/dist/build/makeBabelUserProdConfig.js +10 -5
- package/dist/build/rollup.user.prod.config.d.ts.map +1 -1
- package/dist/build/rollup.user.prod.config.js +13 -11
- package/dist/build/rollupExtractComponentStylesheets.js +3 -3
- package/dist/build/sassImportParser.js +4 -4
- 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/calculateImportedStaticFileLocations.js +2 -2
- package/dist/calledFrom.js +2 -2
- package/dist/clone.js +4 -4
- package/dist/compat/context.d.ts.map +1 -1
- package/dist/compat/forwardRef.js +1 -1
- package/dist/compat/index.js +1 -1
- package/dist/compat/types.d.ts.map +1 -1
- package/dist/componentProxyHandlers.d.ts.map +1 -1
- package/dist/componentProxyHandlers.js +8 -12
- package/dist/components/Link.js +2 -2
- package/dist/components/PopMessages.js +3 -3
- package/dist/components/RawHtml.js +2 -2
- package/dist/components/Stylesheet.d.ts +1 -2
- package/dist/components/Stylesheet.d.ts.map +1 -1
- package/dist/components/Stylesheet.js +4 -4
- package/dist/components/bindable/BindableCheckbox.d.ts.map +1 -1
- package/dist/components/bindable/BindableCheckbox.js +1 -1
- package/dist/components/bindable/BindableInput.d.ts.map +1 -1
- package/dist/components/bindable/BindableInput.js +1 -1
- package/dist/components/bindable/BindableInputNonString.js +1 -1
- package/dist/components/bindable/BindableInputString.js +1 -1
- package/dist/components/bindable/BindableInputTyped.js +1 -1
- package/dist/components/bindable/BindableInputTypedLegacy.d.ts.map +1 -1
- package/dist/components/bindable/BindableInputTypedLegacy.js +1 -1
- package/dist/components/bindable/BindableRadio.d.ts.map +1 -1
- package/dist/components/bindable/BindableRadio.js +1 -1
- package/dist/components/bindable/BindableSelect.js +1 -1
- package/dist/components/bindable/BindableTextarea.d.ts.map +1 -1
- package/dist/components/bindable/BindableTextarea.js +1 -1
- package/dist/components/library/RichTextEditor/RichTextEditor.js +10 -10
- package/dist/components/library/RichTextEditor/contentTree.js +5 -5
- package/dist/components/library/RichTextEditor/sanitizeAuthoredHtml.js +2 -2
- package/dist/components/library/__StatefulMessage/StatefulMessage.js +2 -2
- package/dist/components/library/index.js +2 -2
- package/dist/concat.d.ts.map +1 -1
- package/dist/concat.js +2 -2
- package/dist/copy.d.ts.map +1 -1
- package/dist/createElement.js +1 -1
- package/dist/createRoutes.d.ts +1 -1
- package/dist/createRoutes.d.ts.map +1 -1
- package/dist/defaultConfig.d.ts +0 -1
- package/dist/defaultConfig.d.ts.map +1 -1
- package/dist/defaultConfig.js +2 -2
- package/dist/deleteDirs.js +1 -1
- package/dist/env/Env.js +2 -2
- package/dist/env/addToEnv.js +1 -1
- package/dist/env/funcs.js +4 -4
- package/dist/env/getEnvSchemas.d.ts +2 -2
- package/dist/env/getEnvSchemas.d.ts.map +1 -1
- package/dist/env/getEnvSchemas.js +16 -10
- package/dist/env/privateEnv.js +2 -2
- package/dist/env/privateEnvOrThrow.js +1 -1
- package/dist/env/publicEnv.js +1 -1
- package/dist/env/publicEnvOrThrow.js +1 -1
- package/dist/env/windowGlobalEnvStatement.d.ts.map +1 -1
- package/dist/filePathFromUrl.js +1 -1
- package/dist/findProjectDir.d.ts.map +1 -1
- package/dist/findProjectDir.js +19 -5
- package/dist/findUserConfig.js +7 -7
- package/dist/fixExtension.d.ts.map +1 -1
- package/dist/fixExtension.js +5 -3
- package/dist/foreach.js +1 -0
- package/dist/frameworkConfigSchema.d.ts +16 -0
- package/dist/frameworkConfigSchema.d.ts.map +1 -1
- package/dist/frameworkConfigSchema.js +14 -2
- package/dist/getComponent.d.ts.map +1 -1
- package/dist/getComponent.js +5 -5
- package/dist/getComponentDev.d.ts.map +1 -1
- package/dist/getComponentDev.js +1 -1
- package/dist/getFrameworkDir.js +1 -1
- package/dist/getRoutes.d.ts.map +1 -1
- package/dist/getRoutes.js +18 -27
- package/dist/getRoutesDevs.d.ts.map +1 -1
- package/dist/getRoutesDevs.js +1 -1
- package/dist/getStackTrace.js +1 -1
- package/dist/getUserConfig.js +7 -7
- package/dist/glob.d.ts +5 -0
- package/dist/glob.d.ts.map +1 -0
- package/dist/glob.js +103 -0
- package/dist/hasValidKey.js +1 -1
- package/dist/helpers/getFetchCompatibleHeaders.js +2 -2
- package/dist/helpers/index.js +2 -2
- package/dist/hmr/applyHmrModule.js +10 -10
- package/dist/hmr/componentIdentity.js +3 -3
- package/dist/hmr/instanceRegistry.js +2 -2
- package/dist/hooks/clearCurrentComponent.js +1 -1
- package/dist/hooks/getCurrentComponent.js +3 -3
- package/dist/hooks/index.js +5 -5
- package/dist/hooks/setCurrentComponent.js +1 -1
- package/dist/hooks/useCallback.js +2 -2
- package/dist/hooks/useEffect.js +2 -2
- package/dist/hooks/useInstance.js +1 -1
- package/dist/hooks/useMemo.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 +3 -9
- package/dist/hydrate/hydrate.d.ts +1 -1
- package/dist/hydrate/hydrate.d.ts.map +1 -1
- package/dist/hydrate/hydrate.js +56 -54
- package/dist/hydrate/reconcileHydratedAttributes.js +5 -5
- package/dist/index.js +2 -2
- package/dist/indexInner.d.ts +1 -1
- package/dist/indexInner.d.ts.map +1 -1
- package/dist/indexInner.js +45 -45
- package/dist/innerHtmlFromProps.js +1 -1
- package/dist/isBrowser.js +1 -1
- package/dist/isDev.js +1 -1
- package/dist/isProd.js +1 -1
- package/dist/isServer.js +1 -1
- package/dist/jsx-runtime.js +1 -1
- package/dist/jsxRuntime.d.ts.map +1 -1
- package/dist/jsxRuntime.js +12 -7
- package/dist/jsxRuntimeSignals.d.ts.map +1 -1
- package/dist/jsxRuntimeSignals.js +15 -8
- package/dist/makeFinalConfig.d.ts.map +1 -1
- package/dist/makeFinalConfig.js +3 -3
- package/dist/makeInstanceConfigFromFrameworkConfig.js +1 -1
- package/dist/makeServerRpc.js +3 -3
- package/dist/markOptionSelected.js +2 -2
- package/dist/mergeConfigs.d.ts.map +1 -1
- package/dist/mergeConfigs.js +11 -2
- package/dist/mutatingFunctions.js +3 -3
- package/dist/nbsp.js +1 -1
- package/dist/output.js +1 -1
- package/dist/pop.js +2 -2
- package/dist/postcssPlugins/TransformCssNames.js +8 -8
- package/dist/postcssPlugins/parseSelectors.js +1 -1
- package/dist/postcssPlugins/parseSelectorsRich.js +1 -1
- package/dist/postcssPlugins/scopeAnimationValue.js +2 -2
- package/dist/propsAreEqual.js +3 -3
- package/dist/rawHtml/filterContentNode.js +4 -4
- package/dist/rawHtml/parseHtml.js +5 -5
- package/dist/rawHtml/sanitizeHtml.js +3 -3
- package/dist/rawHtml/tokenizeHtml.js +2 -2
- package/dist/render/addImportMap.js +2 -2
- package/dist/render/classComponentNodeToRenderingTree.js +4 -4
- package/dist/render/componentNodeToRenderingTree.d.ts.map +1 -1
- package/dist/render/componentNodeToRenderingTree.js +13 -24
- package/dist/render/contentNodeToHtml.js +11 -11
- package/dist/render/contentToHtml.d.ts.map +1 -1
- package/dist/render/contentToHtml.js +5 -5
- package/dist/render/contentToHtmlDev.js +1 -1
- package/dist/render/contentTreeToRenderingTree.js +7 -7
- package/dist/render/functionComponentNodeToRenderingTree.js +4 -4
- package/dist/render/getFunctionBodyAsString.d.ts.map +1 -1
- package/dist/render/getFunctionBodyAsString.js +3 -6
- package/dist/render/instantiateClassComponent.js +2 -2
- package/dist/render/instantiateComponent.js +3 -3
- package/dist/render/instantiateFunctionComponent.js +2 -2
- package/dist/render/printComponentNameInSource.js +1 -1
- package/dist/render/processHead.js +5 -5
- package/dist/render/processHtmlNode.js +1 -1
- package/dist/render/processProps.js +4 -4
- package/dist/render/processRenderingNodeHtml.js +6 -6
- package/dist/render/renderingTreeToHtml.d.ts.map +1 -1
- package/dist/render/renderingTreeToHtml.js +16 -16
- package/dist/render/rootToHtml.d.ts.map +1 -1
- package/dist/render/rootToHtml.js +2 -2
- package/dist/render/rootToHtmlDev.js +1 -1
- package/dist/requests/fetch/delete.js +2 -2
- package/dist/requests/fetch/get.js +3 -3
- package/dist/requests/fetch/patch.js +2 -2
- package/dist/requests/fetch/post.js +2 -2
- package/dist/requests/fetch/put.js +2 -2
- package/dist/requests/index.js +5 -5
- package/dist/routing/MatchedRoute.js +2 -2
- 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 +2 -2
- package/dist/routing/matchPath.js +3 -3
- package/dist/routing/patternToRegex.js +1 -1
- package/dist/server.js +3 -3
- package/dist/serverModuleLocation.d.ts +3 -0
- package/dist/serverModuleLocation.d.ts.map +1 -0
- package/dist/serverModuleLocation.js +12 -0
- package/dist/serverRpc.d.ts.map +1 -1
- package/dist/settings.d.ts +4 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +9 -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/standardSchema.js +1 -1
- package/dist/staticGen/getAppRoutes.js +3 -3
- package/dist/staticGen/staticGen.d.ts.map +1 -1
- package/dist/staticGen/staticGen.js +16 -14
- package/dist/staticGen/staticGenFunctions.js +1 -1
- package/dist/style/jssToCss.d.ts.map +1 -1
- package/dist/style/jssToCss.js +13 -11
- package/dist/style/styleContent.js +1 -1
- package/dist/style/styleContentSxy.js +8 -8
- package/dist/style/unusedStyles.d.ts.map +1 -1
- package/dist/style/unusedStyles.js +1 -1
- package/dist/sync/index.js +1 -1
- package/dist/syncServer/preload.js +1 -1
- package/dist/testing/host.js +12 -12
- package/dist/testing/hydrateTestApp.d.ts.map +1 -1
- package/dist/testing/hydrateTestApp.js +18 -18
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +11 -11
- package/dist/testing/installTestStyleProcessors.js +2 -2
- package/dist/testing/loadEnv.d.ts +4 -1
- package/dist/testing/loadEnv.d.ts.map +1 -1
- package/dist/testing/loadEnv.js +5 -5
- package/dist/testing/temp/componentPackageMock.js +5 -5
- package/dist/testing/temp/contentHtmlElements.js +2 -2
- package/dist/throwError.js +2 -2
- package/dist/timeProfiler.d.ts +5 -1
- package/dist/timeProfiler.d.ts.map +1 -1
- package/dist/timeProfiler.js +76 -24
- package/dist/todo.js +2 -1
- package/dist/update/integrateUpdateVdom.d.ts.map +1 -1
- package/dist/update/integrateUpdateVdom.js +44 -41
- package/dist/update/integrateUpdateVdomPrebuild.js +5 -5
- package/dist/validChildren.js +2 -2
- package/dist/warnOnFrameworkChange.js +2 -2
- package/dist/watch.js +2 -2
- package/dist/zones/react.js +3 -3
- package/package.json +27 -39
- package/types/modules.d.ts +2 -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 -68
- 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
|
@@ -1,15 +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
5
|
const babelPresetReact = babelPresetReactModule.default;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const require = createRequire(import.meta.url);
|
|
7
|
+
// config `typescript: true`: appended after preset-react so babel runs it first (presets run last
|
|
8
|
+
// to first). allowDeclareFields matches tsc's useDefineForClassFields: `x: T` stays a field,
|
|
9
|
+
// `declare x: T` is erased - without it babel erases both.
|
|
10
|
+
// required on demand: ~95 modules that only this flag needs
|
|
11
|
+
export function typescriptPreset() {
|
|
12
|
+
const babelPresetTypescript = require("@babel/preset-typescript").default;
|
|
13
|
+
return [babelPresetTypescript, {
|
|
14
|
+
allowDeclareFields: true
|
|
15
|
+
}];
|
|
16
|
+
}
|
|
9
17
|
const regexEscape = r => r.replaceAll(".", "\\.");
|
|
10
18
|
const ignoreRegex = new RegExp(`(node_modules|${regexEscape(buildFolder)})`);
|
|
11
19
|
const userCommonConfig = {
|
|
12
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,
|
|
13
24
|
presets: [[babelPresetReact, {
|
|
14
25
|
"runtime": "automatic",
|
|
15
26
|
"importSource": "tungsten"
|
|
@@ -19,17 +30,11 @@ const userCommonConfig = {
|
|
|
19
30
|
// "importSource": "tungsten",
|
|
20
31
|
// }],
|
|
21
32
|
],
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}], MakeBabelTransformJsxExtensionsToJs(), [babelPluginCssToJs], [babelPluginProposalClassProperties]],
|
|
29
|
-
"env": {
|
|
30
|
-
"production": {
|
|
31
|
-
"plugins": ["transform-react-remove-prop-types"]
|
|
32
|
-
}
|
|
33
|
-
}
|
|
33
|
+
// widen to allow pushing
|
|
34
|
+
// no alias plugin: preset-react's `tungsten/jsx-runtime` import resolves through the package's
|
|
35
|
+
// exports map (node, rollup, the packages plugin) and the dev import map has the same key
|
|
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
|
|
34
39
|
};
|
|
35
40
|
export default userCommonConfig;
|
package/dist/build/bundle.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function bundle(projectDir: string, quiet?: boolean): Promise<unknown>;
|
|
1
|
+
export declare function bundle(projectDir: string, quiet?: boolean, targets?: string | string[]): Promise<unknown>;
|
|
2
2
|
//# sourceMappingURL=bundle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/build/bundle.ts"],"names":[],"mappings":"
|
|
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,oBA8C1F"}
|
package/dist/build/bundle.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { join } from 'path';
|
|
2
2
|
//import type { FrameworkConfigComplete } from '../FrameworkConfig.js'
|
|
3
|
-
import { findProjectDir } from
|
|
4
|
-
import { spawnShellCommand } from
|
|
5
|
-
import { prodBuildFolder, bundleFolder, frameworkDistFolder, clientFolder } from
|
|
6
|
-
import { errorOut } from
|
|
7
|
-
import { cliLog, cliOut } from
|
|
8
|
-
|
|
3
|
+
import { findProjectDir } from '../findProjectDir.js';
|
|
4
|
+
import { spawnShellCommand } from '../spawnShellCommand.js';
|
|
5
|
+
import { prodBuildFolder, bundleFolder, frameworkDistFolder, clientFolder } from '../settings.js';
|
|
6
|
+
import { errorOut } from '../output.js';
|
|
7
|
+
import { cliLog, cliOut } from '../cliOutput.js';
|
|
8
|
+
// targets: the config's browser floor for rollup's babel step, undefined for the framework default
|
|
9
|
+
export async function bundle(projectDir, quiet = false, targets) {
|
|
9
10
|
return new Promise((resolve, reject) => {
|
|
10
11
|
if (!quiet) cliOut('Bundling application');
|
|
11
12
|
const frameworkDir = findProjectDir(import.meta.url);
|
|
@@ -18,8 +19,15 @@ export async function bundle(projectDir, quiet = false /*, appConfig: FrameworkC
|
|
|
18
19
|
];
|
|
19
20
|
const command = `cd ${frameworkDir} && npx rollup` + ` --input "${join(projectDir, prodBuildFolder, clientFolder, 'client.js')}"` + ` --file "${join(projectDir, bundleFolder, 'client.js')}"` + ` --config "${join(frameworkDir, frameworkDistFolder, 'build/rollup.user.prod.config.js')}"` + (externalModules.length > 0 ? ` --external ${externalModules.join(',')}` : ``) + ` --inlineDynamicImports --format iife`;
|
|
20
21
|
if (!quiet) cliLog('bundle command:', command);
|
|
22
|
+
// the rollup config reads this back; a browserslist query can hold commas, which rollup's own
|
|
23
|
+
// --environment flag would split on
|
|
24
|
+
const env = targets === undefined ? process.env : {
|
|
25
|
+
...process.env,
|
|
26
|
+
TUNGSTEN_TARGETS: JSON.stringify(targets)
|
|
27
|
+
};
|
|
21
28
|
const subProcess = spawnShellCommand(command, {
|
|
22
|
-
cwd: frameworkDir
|
|
29
|
+
cwd: frameworkDir,
|
|
30
|
+
env
|
|
23
31
|
});
|
|
24
32
|
subProcess.on('data', data => {
|
|
25
33
|
if (!quiet) cliLog(data);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundleBabelOptions.d.ts","sourceRoot":"","sources":["../../src/build/bundleBabelOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAa7C,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,MAAM,GAAG,MAAM,EAA0B;;;EAMpF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import presetEnvModule from '@babel/preset-env';
|
|
2
|
+
import { MakeBabelTransformRemoveServerBlocks } from '../babelPlugins/BabelTransformRemoveServerBlocks.js';
|
|
3
|
+
import { MakeBabelTransformRemoveDevBlocks } from '../babelPlugins/BabelTransformRemoveDevBlocks.js';
|
|
4
|
+
import { defaultBrowserTargets } from '../settings.js';
|
|
5
|
+
// babel 7 presets are cjs and arrive as { default }, babel 8's are esm and arrive as the function
|
|
6
|
+
const presetEnv = typeof presetEnvModule === 'function' ? presetEnvModule : presetEnvModule.default;
|
|
7
|
+
// The production bundle's babel pass: strips server and dev blocks and lowers syntax to the browser
|
|
8
|
+
// floor. Back-compat lives here and nowhere else - dev serves what tsc emits. Only the rollup
|
|
9
|
+
// config (a build-time subprocess) imports this, so preset-env never loads under dev.
|
|
10
|
+
export function bundleBabelOptions(targets = defaultBrowserTargets) {
|
|
11
|
+
// bugfixes: where a target has a feature with a known bug, apply the small fix instead of the
|
|
12
|
+
// full lowering (opt-in on babel 7, always on in 8)
|
|
13
|
+
const presets = [[presetEnv, {
|
|
14
|
+
targets,
|
|
15
|
+
bugfixes: true,
|
|
16
|
+
modules: false
|
|
17
|
+
}]];
|
|
18
|
+
const plugins = [MakeBabelTransformRemoveServerBlocks(), MakeBabelTransformRemoveDevBlocks()];
|
|
19
|
+
return {
|
|
20
|
+
presets,
|
|
21
|
+
plugins
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { promises as fsPromises } from 'fs';
|
|
2
2
|
import { isAbsolute, join, relative, resolve } from 'path';
|
|
3
|
-
import { componentCssFile, componentCssFolder } from
|
|
4
|
-
import { TungstenError } from
|
|
3
|
+
import { componentCssFile, componentCssFolder } from '../settings.js';
|
|
4
|
+
import { TungstenError } from '../TungstenError.js';
|
|
5
5
|
const componentImportPattern = /@import\s+["'](i\/[^"']+\.css)["']\s*;/g;
|
|
6
6
|
const charsetPattern = /@charset\s+["']([^"']+)["']\s*;?/gi;
|
|
7
7
|
function validateCharset(css, file) {
|
|
@@ -11,14 +11,18 @@ type CompileJavascriptResult = {
|
|
|
11
11
|
export type JavascriptCompilationCycle = {
|
|
12
12
|
success: boolean;
|
|
13
13
|
file?: string;
|
|
14
|
+
client?: boolean;
|
|
14
15
|
};
|
|
15
16
|
export type CompileJavascriptOptions = {
|
|
16
17
|
quiet?: boolean;
|
|
17
18
|
packagesCacheLocation?: string;
|
|
19
|
+
stylesCacheLocation?: string;
|
|
20
|
+
rawBuildLocation?: string;
|
|
18
21
|
packages?: boolean;
|
|
19
22
|
hmr?: boolean;
|
|
20
23
|
onCycleComplete?: ((cycle: JavascriptCompilationCycle) => void | Promise<void>) | undefined;
|
|
21
24
|
tests?: boolean;
|
|
25
|
+
fresh?: boolean;
|
|
22
26
|
};
|
|
23
27
|
export declare function compileJavascript(projectDir: string, appConfig: FrameworkConfigComplete, codeLocation: string, sourceLocation: string, styleImportBase: string, buildLocation: string, buildCodeLocation: string, mode: Mode, watch?: boolean, options?: CompileJavascriptOptions): Promise<CompileJavascriptResult>;
|
|
24
28
|
export {};
|
|
@@ -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;
|
|
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,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;IAEb,MAAM,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACnC,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAE5B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IAEzB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,eAAe,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,0BAA0B,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CAAA;IAE3F,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf,KAAK,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAuBD,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,CA4gBlC"}
|
|
@@ -1,26 +1,31 @@
|
|
|
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 {
|
|
9
|
-
import { packagesCacheFolder } from
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
8
|
+
import { glob } from '../glob.js';
|
|
9
|
+
import { devRawBuildFolder, packagesCacheFolder, prodRawBuildFolder, stylesCacheFolder } from '../settings.js';
|
|
10
|
+
import { frameworkVersion } from './frameworkDestLocation.js';
|
|
11
|
+
import { makeBabelUserDevConfig } from './makeBabelUserDevConfig.js';
|
|
12
|
+
import { makeBabelUserProdConfig } from './makeBabelUserProdConfig.js';
|
|
13
|
+
import { makeBabelRawConfig } from './makeBabelRawConfig.js';
|
|
14
|
+
import { cliOut, cliLog, cliError, cliWarn } from '../cliOutput.js'; // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
15
|
+
import { createTimeProfiler, isProfiling, tallied } from '../timeProfiler.js';
|
|
16
|
+
import { tallyBabel } from './tallyBabel.js';
|
|
17
|
+
import { TungstenError } from '../TungstenError.js';
|
|
18
|
+
import { getFrameworkDir } from '../getFrameworkDir.js';
|
|
17
19
|
// The graph writeDependencyGraph() left behind on the previous run, naming a compiled copy of every
|
|
18
20
|
// package file in the packages cache. Missing or unreadable just means everything is compiled from
|
|
19
21
|
// source, which is what happened on every run before this was read back.
|
|
22
|
+
// Nodes are keyed by package version only, so a graph another tungsten version wrote is discarded:
|
|
23
|
+
// the transform may have changed. frameworkVersion here is a free option - any stamp works.
|
|
20
24
|
async function loadDependencyGraph(location) {
|
|
21
25
|
if (!fs.existsSync(location)) return {};
|
|
22
26
|
try {
|
|
23
27
|
const graphModule = await import(pathToFileURL(location).href);
|
|
28
|
+
if (graphModule.version !== frameworkVersion) return {};
|
|
24
29
|
return graphModule.graph ?? {};
|
|
25
30
|
} catch (error) {
|
|
26
31
|
cliWarn(`Could not read the package cache at ${location}, compiling packages from source`);
|
|
@@ -33,6 +38,9 @@ async function loadDependencyGraph(location) {
|
|
|
33
38
|
export async function compileJavascript(projectDir, appConfig, codeLocation, sourceLocation, styleImportBase, buildLocation, buildCodeLocation, mode, watch = true, options = {}) {
|
|
34
39
|
if (options.quiet !== true) cliOut(`Compiling app code`);
|
|
35
40
|
const compilePackages = options.packages !== false;
|
|
41
|
+
// codeLocation's .ts/.tsx are sources too, compiled to .js by babel; .d.ts is never one
|
|
42
|
+
const typescript = appConfig.typescript === true;
|
|
43
|
+
const rawBuildLocation = options.rawBuildLocation ?? join(projectDir, mode === 'dev' ? devRawBuildFolder : prodRawBuildFolder);
|
|
36
44
|
let dependencyGraphDir = '';
|
|
37
45
|
let dependencyGraphLocation = '';
|
|
38
46
|
let oldDependencyGraph = {};
|
|
@@ -44,9 +52,8 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
44
52
|
const skipPackageCompilationFiles = new Set();
|
|
45
53
|
async function refreshSkipPackageCompilationFiles() {
|
|
46
54
|
skipPackageCompilationFiles.clear();
|
|
47
|
-
const matchingFiles = await
|
|
48
|
-
cwd: codeLocation
|
|
49
|
-
absolute: true
|
|
55
|
+
const matchingFiles = await glob(skipPackageCompilationPatterns, {
|
|
56
|
+
cwd: codeLocation
|
|
50
57
|
});
|
|
51
58
|
for (const file of matchingFiles) skipPackageCompilationFiles.add(slash(file));
|
|
52
59
|
}
|
|
@@ -54,35 +61,48 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
54
61
|
if (mode === 'dev') {
|
|
55
62
|
dependencyGraphDir = options.packagesCacheLocation ?? join(projectDir, packagesCacheFolder);
|
|
56
63
|
dependencyGraphLocation = join(dependencyGraphDir, '.dependency-graph.js');
|
|
57
|
-
oldDependencyGraph = await loadDependencyGraph(dependencyGraphLocation);
|
|
64
|
+
oldDependencyGraph = options.fresh === true ? {} : await loadDependencyGraph(dependencyGraphLocation);
|
|
58
65
|
dependencyGraph = {};
|
|
59
66
|
importAliases = {};
|
|
60
67
|
promises = [];
|
|
61
|
-
config = makeBabelUserDevConfig(projectDir, codeLocation, sourceLocation, styleImportBase, buildLocation, buildCodeLocation, dependencyGraphDir, skipPackageCompilationFiles, oldDependencyGraph, dependencyGraph, importAliases, promises, watch, options.hmr === true, compilePackages);
|
|
68
|
+
config = makeBabelUserDevConfig(projectDir, codeLocation, sourceLocation, typescript, styleImportBase, buildLocation, buildCodeLocation, dependencyGraphDir, options.stylesCacheLocation ?? join(projectDir, stylesCacheFolder), options.fresh === true, skipPackageCompilationFiles, oldDependencyGraph, dependencyGraph, importAliases, promises, watch, options.hmr === true, compilePackages);
|
|
62
69
|
} else {
|
|
63
|
-
config = makeBabelUserProdConfig(projectDir, codeLocation, sourceLocation, styleImportBase, watch);
|
|
70
|
+
config = makeBabelUserProdConfig(projectDir, codeLocation, sourceLocation, typescript, styleImportBase, watch);
|
|
64
71
|
}
|
|
65
72
|
config.root = getFrameworkDir();
|
|
73
|
+
const rawConfig = makeBabelRawConfig(typescript);
|
|
74
|
+
rawConfig.root = config.root;
|
|
66
75
|
// per-plugin attribution of the transform's time, only when someone is looking: the wrappers
|
|
67
76
|
// run per AST node
|
|
68
77
|
if (isProfiling()) {
|
|
69
|
-
|
|
78
|
+
tallyBabel(config);
|
|
79
|
+
tallyBabel(rawConfig);
|
|
70
80
|
if (mode === 'dev' && compilePackages) {
|
|
71
|
-
cliWarn(`profiling serves linked packages from the packages cache -` + `
|
|
81
|
+
cliWarn(`profiling serves linked packages from the packages cache -` + ` pass --fresh after rebuilding one, or this run compiles stale code`);
|
|
72
82
|
}
|
|
73
83
|
}
|
|
74
84
|
// compile with the API
|
|
75
85
|
const codeLocationLength = codeLocation.length + 1;
|
|
86
|
+
// a source's path within the build: every compiled extension becomes .js
|
|
87
|
+
function outputRel(file) {
|
|
88
|
+
const rel = file.slice(codeLocationLength);
|
|
89
|
+
if (rel.endsWith('.jsx')) return rel.slice(0, -1);
|
|
90
|
+
if (typescript && rel.endsWith('.tsx')) return `${rel.slice(0, -3)}js`;
|
|
91
|
+
if (typescript && rel.endsWith('.ts')) return `${rel.slice(0, -2)}js`;
|
|
92
|
+
return rel;
|
|
93
|
+
}
|
|
76
94
|
const transformPromises = [];
|
|
77
95
|
const failedFiles = new Set();
|
|
78
96
|
const pendingExportWipes = new Map();
|
|
79
97
|
const exportWipeGraceMs = 5000;
|
|
98
|
+
// A source goes through the client pipeline, the raw one, both, or neither - see
|
|
99
|
+
// refreshSelections() below for what decides that
|
|
80
100
|
async function transformFile(file) {
|
|
81
101
|
//if (options.quiet !== true) console.log('transforming file', file)
|
|
102
|
+
const client = isClient(file);
|
|
103
|
+
const raw = isRaw(file);
|
|
104
|
+
if (!client && !raw) return;
|
|
82
105
|
try {
|
|
83
|
-
let rel = file.slice(codeLocationLength);
|
|
84
|
-
if (rel.endsWith('.jsx')) rel = rel.slice(0, -1);
|
|
85
|
-
const dest = join(buildCodeLocation, rel);
|
|
86
106
|
// tsc's own watch/incremental emit can leave this file genuinely blank for a
|
|
87
107
|
// stretch while it recomputes - not a write-in-progress chokidar's
|
|
88
108
|
// awaitWriteFinish can wait out, but a real (if temporary) empty file on disk.
|
|
@@ -93,64 +113,15 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
93
113
|
failedFiles.delete(file);
|
|
94
114
|
return;
|
|
95
115
|
}
|
|
96
|
-
//
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const babelStart = performance.now();
|
|
101
|
-
const result = babelTransformFileSync(file, config);
|
|
102
|
-
tally('babel transform', performance.now() - babelStart);
|
|
103
|
-
if (result === null) throw new TungstenError(`Err: babel transform on file ${file} returned null`);
|
|
104
|
-
const {
|
|
105
|
-
code
|
|
106
|
-
} = result;
|
|
107
|
-
if (code === null || code === undefined) {
|
|
108
|
-
throw new TungstenError(`Err: code from babel transform on file ${file} was null or undefined: ${typeof code}`);
|
|
109
|
-
}
|
|
110
|
-
// tsc's incremental watch can, for one transient pass right after a save, emit
|
|
111
|
-
// `export {};` for a file that previously had real exports - its own convention
|
|
112
|
-
// for "this module has nothing to export", produced here as a self-correcting
|
|
113
|
-
// glitch rather than a real edit (confirmed via tsc's own transient
|
|
114
|
-
// "has no exported member" watch error). Quarantine it behind a timer rather than
|
|
115
|
-
// overwrite the last-good compiled output immediately: tsc's follow-up pass moments
|
|
116
|
-
// later normally retriggers this watcher with the real content, cancelling the
|
|
117
|
-
// quarantine below. But if nothing ever corrects it (a genuine edit really does
|
|
118
|
-
// remove every export), accept the quarantined content once the grace period lapses
|
|
119
|
-
// instead of hiding it forever.
|
|
120
|
-
if (code.trim() === 'export {};' && fs.existsSync(dest)) {
|
|
121
|
-
const previousCode = fs.readFileSync(dest, 'utf8');
|
|
122
|
-
if (previousCode.trim() !== 'export {};' && previousCode.trim() !== '') {
|
|
123
|
-
if (!pendingExportWipes.has(file)) {
|
|
124
|
-
const timer = setTimeout(() => {
|
|
125
|
-
void acceptQuarantinedExportWipe(file);
|
|
126
|
-
}, exportWipeGraceMs);
|
|
127
|
-
pendingExportWipes.set(file, {
|
|
128
|
-
dest,
|
|
129
|
-
code,
|
|
130
|
-
timer
|
|
131
|
-
});
|
|
132
|
-
} else {
|
|
133
|
-
// keep the original timer (grace period counts from the first sighting),
|
|
134
|
-
// just refresh the content that'll be written if it elapses
|
|
135
|
-
const pending = pendingExportWipes.get(file);
|
|
136
|
-
if (pending !== undefined) pending.code = code;
|
|
137
|
-
}
|
|
138
|
-
failedFiles.delete(file);
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
116
|
+
// each transform runs synchronously up to its write, so both are in flight together
|
|
117
|
+
const writes = [];
|
|
118
|
+
if (client) {
|
|
119
|
+
writes.push(transformTo(file, sourceContent, config, join(buildCodeLocation, outputRel(file)), 'babel transform', true));
|
|
141
120
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
if (pendingWipe !== undefined) {
|
|
145
|
-
clearTimeout(pendingWipe.timer);
|
|
146
|
-
pendingExportWipes.delete(file);
|
|
121
|
+
if (raw) {
|
|
122
|
+
writes.push(transformTo(file, sourceContent, rawConfig, join(rawBuildLocation, outputRel(file)), 'babel transform (raw)', false));
|
|
147
123
|
}
|
|
148
|
-
await
|
|
149
|
-
recursive: true
|
|
150
|
-
});
|
|
151
|
-
//// Using the sync version here, because the promise version keeps bugging out - node bug?
|
|
152
|
-
//await fsPromises.writeFile(dest, code)
|
|
153
|
-
fs.writeFileSync(dest, code);
|
|
124
|
+
await Promise.all(writes);
|
|
154
125
|
failedFiles.delete(file);
|
|
155
126
|
} catch (e) {
|
|
156
127
|
failedFiles.add(file);
|
|
@@ -159,28 +130,92 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
159
130
|
throw e;
|
|
160
131
|
}
|
|
161
132
|
}
|
|
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
|
+
}));
|
|
144
|
+
if (result === null) throw new TungstenError(`Err: babel transform on file ${file} returned null`);
|
|
145
|
+
const {
|
|
146
|
+
code
|
|
147
|
+
} = result;
|
|
148
|
+
if (code === null || code === undefined) {
|
|
149
|
+
throw new TungstenError(`Err: code from babel transform on file ${file} was null or undefined: ${typeof code}`);
|
|
150
|
+
}
|
|
151
|
+
// tsc's incremental watch can, for one transient pass right after a save, emit
|
|
152
|
+
// `export {};` for a file that previously had real exports - its own convention
|
|
153
|
+
// for "this module has nothing to export", produced here as a self-correcting
|
|
154
|
+
// glitch rather than a real edit (confirmed via tsc's own transient
|
|
155
|
+
// "has no exported member" watch error). Quarantine it behind a timer rather than
|
|
156
|
+
// overwrite the last-good compiled output immediately: tsc's follow-up pass moments
|
|
157
|
+
// later normally retriggers this watcher with the real content, cancelling the
|
|
158
|
+
// quarantine below. But if nothing ever corrects it (a genuine edit really does
|
|
159
|
+
// remove every export), accept the quarantined content once the grace period lapses
|
|
160
|
+
// instead of hiding it forever. The client tree's guard only - the raw tree is not served.
|
|
161
|
+
if (guardExportWipe && code.trim() === 'export {};' && fs.existsSync(dest)) {
|
|
162
|
+
const previousCode = fs.readFileSync(dest, 'utf8');
|
|
163
|
+
if (previousCode.trim() !== 'export {};' && previousCode.trim() !== '') {
|
|
164
|
+
if (!pendingExportWipes.has(file)) {
|
|
165
|
+
const timer = setTimeout(() => {
|
|
166
|
+
void acceptQuarantinedExportWipe(file);
|
|
167
|
+
}, exportWipeGraceMs);
|
|
168
|
+
pendingExportWipes.set(file, {
|
|
169
|
+
dest,
|
|
170
|
+
code,
|
|
171
|
+
timer
|
|
172
|
+
});
|
|
173
|
+
} else {
|
|
174
|
+
// keep the original timer (grace period counts from the first sighting),
|
|
175
|
+
// just refresh the content that'll be written if it elapses
|
|
176
|
+
const pending = pendingExportWipes.get(file);
|
|
177
|
+
if (pending !== undefined) pending.code = code;
|
|
178
|
+
}
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
// real content arrived - cancel any quarantine still pending for this file
|
|
183
|
+
if (guardExportWipe) {
|
|
184
|
+
const pendingWipe = pendingExportWipes.get(file);
|
|
185
|
+
if (pendingWipe !== undefined) {
|
|
186
|
+
clearTimeout(pendingWipe.timer);
|
|
187
|
+
pendingExportWipes.delete(file);
|
|
188
|
+
}
|
|
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.
|
|
194
|
+
fs.mkdirSync(dirname(dest), {
|
|
195
|
+
recursive: true
|
|
196
|
+
});
|
|
197
|
+
fs.writeFileSync(dest, code);
|
|
198
|
+
}
|
|
162
199
|
async function deleteTransformedFile(file) {
|
|
163
|
-
let rel = file.slice(codeLocationLength);
|
|
164
|
-
if (rel.endsWith('.jsx')) rel = rel.slice(0, -1);
|
|
165
|
-
const dest = join(buildCodeLocation, rel);
|
|
166
200
|
const pendingWipe = pendingExportWipes.get(file);
|
|
167
201
|
if (pendingWipe !== undefined) {
|
|
168
202
|
clearTimeout(pendingWipe.timer);
|
|
169
203
|
pendingExportWipes.delete(file);
|
|
170
204
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
205
|
+
// whichever trees hold it
|
|
206
|
+
for (const dest of [join(buildCodeLocation, outputRel(file)), join(rawBuildLocation, outputRel(file))]) {
|
|
207
|
+
try {
|
|
208
|
+
await fsPromises.unlink(dest);
|
|
209
|
+
} catch (error) {
|
|
210
|
+
const fileError = error;
|
|
211
|
+
if (fileError.code !== 'ENOENT') throw error;
|
|
212
|
+
}
|
|
176
213
|
}
|
|
177
214
|
failedFiles.delete(file);
|
|
178
215
|
}
|
|
179
216
|
async function copyFile(file) {
|
|
180
217
|
try {
|
|
181
|
-
|
|
182
|
-
if (rel.endsWith('.jsx')) rel = rel.slice(0, -1);
|
|
183
|
-
const dest = join(buildCodeLocation, rel);
|
|
218
|
+
const dest = join(buildCodeLocation, outputRel(file));
|
|
184
219
|
await fsPromises.mkdir(dirname(dest), {
|
|
185
220
|
recursive: true
|
|
186
221
|
});
|
|
@@ -194,9 +229,7 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
194
229
|
}
|
|
195
230
|
async function deleteFile(file) {
|
|
196
231
|
try {
|
|
197
|
-
|
|
198
|
-
if (rel.endsWith('.jsx')) rel = rel.slice(0, -1);
|
|
199
|
-
const dest = join(buildCodeLocation, rel);
|
|
232
|
+
const dest = join(buildCodeLocation, outputRel(file));
|
|
200
233
|
await fsPromises.unlink(dest);
|
|
201
234
|
} catch (e) {
|
|
202
235
|
cliError(`Tungsten: Error deleting file ${file}`);
|
|
@@ -205,22 +238,26 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
205
238
|
}
|
|
206
239
|
}
|
|
207
240
|
// get a list of files
|
|
208
|
-
const watchGlob = slash(`${codeLocation}/**/*.js{,
|
|
241
|
+
const watchGlob = slash(`${codeLocation}/**/*.{js,jsx${typescript ? ',ts,tsx' : ''}}`);
|
|
209
242
|
// typed rather than inferred from the pushes: it is captured by a closure below, which stops
|
|
210
243
|
// typescript widening it from the pushes
|
|
211
244
|
const ignored = [];
|
|
212
245
|
ignored.push(slash(`${buildLocation}/**`));
|
|
246
|
+
if (typescript) ignored.push(slash(`${codeLocation}/**/*.d.ts`));
|
|
213
247
|
if (appConfig.ignoreDirs !== undefined && appConfig.ignoreDirs !== '') {
|
|
214
248
|
const ignoreDirs = typeof appConfig.ignoreDirs === 'string' ? [appConfig.ignoreDirs] : appConfig.ignoreDirs;
|
|
215
249
|
ignored.push(...ignoreDirs.map(folder => slash(`${codeLocation}/${folder}/**`)));
|
|
216
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}`);
|
|
217
254
|
if (appConfig.ignorePatterns !== undefined && appConfig.ignorePatterns !== '') {
|
|
218
255
|
if (Array.isArray(appConfig.ignorePatterns)) {
|
|
219
256
|
for (const pattern of appConfig.ignorePatterns) {
|
|
220
|
-
ignored.push(pattern);
|
|
257
|
+
ignored.push(fromCodeDir(pattern));
|
|
221
258
|
}
|
|
222
259
|
} else {
|
|
223
|
-
ignored.push(appConfig.ignorePatterns);
|
|
260
|
+
ignored.push(fromCodeDir(appConfig.ignorePatterns));
|
|
224
261
|
}
|
|
225
262
|
}
|
|
226
263
|
// test files are a category, not noise: excluded here like ignoreDirs/ignorePatterns, but a
|
|
@@ -231,10 +268,39 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
231
268
|
ignored.push(...testDirs.map(folder => slash(`${codeLocation}/${folder}/**`)));
|
|
232
269
|
}
|
|
233
270
|
if (appConfig.testPatterns !== undefined && appConfig.testPatterns !== '') {
|
|
234
|
-
|
|
271
|
+
const testPatterns = Array.isArray(appConfig.testPatterns) ? appConfig.testPatterns : [appConfig.testPatterns];
|
|
272
|
+
ignored.push(...testPatterns.map(fromCodeDir));
|
|
235
273
|
}
|
|
236
274
|
}
|
|
237
275
|
if (appConfig.exclude !== undefined) ignored.push(slash(`${codeLocation}/${appConfig.exclude}`));
|
|
276
|
+
// Which sources each pipeline compiles. Unset, client is everything and raw is nothing; a file
|
|
277
|
+
// may be in both. Dirs and patterns are relative to codeDir. The ignores are not applied
|
|
278
|
+
// here - every file that reaches isClient/isRaw has already passed them, in the initial glob
|
|
279
|
+
// or in the watcher - so "client minus ignores" holds. Sets rather than matchers, refreshed on
|
|
280
|
+
// the watcher's `add`, like skipPackageCompilationFiles.
|
|
281
|
+
const sourceExtensions = `*.{js,jsx${typescript ? ',ts,tsx' : ''}}`;
|
|
282
|
+
function selectionGlobs(dirs, patterns) {
|
|
283
|
+
if (dirs === undefined && patterns === undefined) return null;
|
|
284
|
+
const list = value => value === undefined || value === '' ? [] : typeof value === 'string' ? [value] : value;
|
|
285
|
+
return [...list(dirs).map(dir => `${dir}/**/${sourceExtensions}`), ...list(patterns)];
|
|
286
|
+
}
|
|
287
|
+
const clientSelection = selectionGlobs(appConfig.clientDirs, appConfig.clientPatterns);
|
|
288
|
+
const rawSelection = selectionGlobs(appConfig.rawDirs, appConfig.rawPatterns);
|
|
289
|
+
let clientFiles = null;
|
|
290
|
+
let rawFiles = new Set();
|
|
291
|
+
async function selectedFiles(selection) {
|
|
292
|
+
const files = await glob(selection, {
|
|
293
|
+
cwd: codeLocation
|
|
294
|
+
});
|
|
295
|
+
return new Set(files.map(file => slash(file)));
|
|
296
|
+
}
|
|
297
|
+
async function refreshSelections() {
|
|
298
|
+
clientFiles = clientSelection === null ? null : await selectedFiles(clientSelection);
|
|
299
|
+
rawFiles = rawSelection === null ? new Set() : await selectedFiles(rawSelection);
|
|
300
|
+
}
|
|
301
|
+
const isClient = file => clientFiles === null || clientFiles.has(file);
|
|
302
|
+
const isRaw = file => rawFiles.has(file);
|
|
303
|
+
await refreshSelections();
|
|
238
304
|
//console.log('appConfig', appConfig)
|
|
239
305
|
//console.log('ignored', ignored)
|
|
240
306
|
//cliWarn(watchGlob)
|
|
@@ -245,7 +311,7 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
245
311
|
// phases record into the profiler module's shared timeline, so this instance need not be the
|
|
246
312
|
// one the command created - it only has to be enabled when --profile is
|
|
247
313
|
const profiler = createTimeProfiler(isProfiling());
|
|
248
|
-
const paths = await profiler.timeProfileAsync('find source files', () =>
|
|
314
|
+
const paths = await profiler.timeProfileAsync('find source files', () => glob([watchGlob, ...ignored.map(x => `!${x}`)]));
|
|
249
315
|
// the transforms are started inside the phase, not just awaited there: a resource is charged to
|
|
250
316
|
// the phase that created it, so starting them outside credits all the work to the parent
|
|
251
317
|
const transformResults = await profiler.timeProfileAsync(`transform ${paths.length} files`, () => {
|
|
@@ -276,7 +342,7 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
276
342
|
recursive: true
|
|
277
343
|
});
|
|
278
344
|
}
|
|
279
|
-
fs.writeFileSync(dependencyGraphLocation, `export const graph = ${serializeJavascript(dependencyGraph)}`);
|
|
345
|
+
fs.writeFileSync(dependencyGraphLocation, `export const version = ${serializeJavascript(frameworkVersion)}\n` + `export const graph = ${serializeJavascript(dependencyGraph)}`);
|
|
280
346
|
}
|
|
281
347
|
async function acceptQuarantinedExportWipe(file) {
|
|
282
348
|
const pending = pendingExportWipes.get(file);
|
|
@@ -287,7 +353,7 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
287
353
|
await fsPromises.mkdir(dirname(pending.dest), {
|
|
288
354
|
recursive: true
|
|
289
355
|
});
|
|
290
|
-
|
|
356
|
+
await fsPromises.writeFile(pending.dest, pending.code);
|
|
291
357
|
failedFiles.delete(file);
|
|
292
358
|
const failures = await settleDeferredWork();
|
|
293
359
|
success = failures.length === 0 && failedFiles.size === 0;
|
|
@@ -299,7 +365,8 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
299
365
|
}
|
|
300
366
|
await options.onCycleComplete?.({
|
|
301
367
|
success,
|
|
302
|
-
file
|
|
368
|
+
file,
|
|
369
|
+
client: true
|
|
303
370
|
});
|
|
304
371
|
}
|
|
305
372
|
if (!watch) {
|
|
@@ -337,7 +404,10 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
337
404
|
if (event === 'unlink') {
|
|
338
405
|
await deleteTransformedFile(file);
|
|
339
406
|
} else {
|
|
340
|
-
if (event === 'add')
|
|
407
|
+
if (event === 'add') {
|
|
408
|
+
await refreshSkipPackageCompilationFiles();
|
|
409
|
+
await refreshSelections();
|
|
410
|
+
}
|
|
341
411
|
await transformFile(file);
|
|
342
412
|
}
|
|
343
413
|
const failures = await settleDeferredWork();
|
|
@@ -348,7 +418,8 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
348
418
|
}
|
|
349
419
|
await options.onCycleComplete?.({
|
|
350
420
|
success,
|
|
351
|
-
file
|
|
421
|
+
file,
|
|
422
|
+
client: isClient(file)
|
|
352
423
|
});
|
|
353
424
|
}).catch(error => {
|
|
354
425
|
cliError('Tungsten: Error completing JavaScript watch cycle');
|