tungsten 0.4.10 → 0.4.12

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.
Files changed (294) hide show
  1. package/dist/.build-complete +1 -1
  2. package/dist/AnyComponent.js +1 -1
  3. package/dist/Components.d.ts.map +1 -1
  4. package/dist/Components.js +15 -16
  5. package/dist/ContentNode.js +2 -2
  6. package/dist/DomRegion.js +1 -1
  7. package/dist/Framework.d.ts +2 -1
  8. package/dist/Framework.d.ts.map +1 -1
  9. package/dist/Framework.js +43 -34
  10. package/dist/FrameworkConfig.d.ts +16 -0
  11. package/dist/FrameworkConfig.d.ts.map +1 -1
  12. package/dist/FunctionComponentStandIn.js +8 -8
  13. package/dist/Instance/Instance.js +11 -11
  14. package/dist/RenderedContentNode.js +2 -2
  15. package/dist/RenderingNode.js +2 -2
  16. package/dist/Script.js +1 -1
  17. package/dist/Servers/DevServer.d.ts.map +1 -1
  18. package/dist/Servers/DevServer.js +29 -29
  19. package/dist/Servers/ProdServer.js +14 -14
  20. package/dist/Servers/StaticSiteServer.js +3 -3
  21. package/dist/Servers/TungstenServer.js +5 -5
  22. package/dist/Servers/devErrorPageAutoRetry.js +1 -1
  23. package/dist/Servers/hono/TungstenServerHono.js +5 -5
  24. package/dist/Servers/initStores.js +3 -3
  25. package/dist/Servers/loadEnvsDev.js +6 -6
  26. package/dist/Servers/routing.js +3 -3
  27. package/dist/Store/createStores.js +2 -2
  28. package/dist/Store/makeStore.js +2 -2
  29. package/dist/Store/registerStore.js +2 -2
  30. package/dist/TungstenApp.js +3 -3
  31. package/dist/TungstenStyleObject.js +1 -1
  32. package/dist/__deproxy.js +2 -2
  33. package/dist/_client/client.js +3 -3
  34. package/dist/alive.js +1 -1
  35. package/dist/api/getApiRoutes.js +3 -3
  36. package/dist/api/getApiRoutesHono.js +3 -3
  37. package/dist/api/getExport.js +4 -4
  38. package/dist/api/getExportDev.js +1 -1
  39. package/dist/appOutput.js +1 -1
  40. package/dist/auth/index.js +2 -2
  41. package/dist/babelPlugins/BabelAddDevCacheBust.d.ts.map +1 -1
  42. package/dist/babelPlugins/BabelAddDevCacheBust.js +4 -2
  43. package/dist/babelPlugins/BabelTransformBindDirect.js +2 -2
  44. package/dist/babelPlugins/BabelTransformBindVar.js +3 -3
  45. package/dist/babelPlugins/BabelTransformCjsToEsm.js +1 -1
  46. package/dist/babelPlugins/BabelTransformComponentState.js +2 -2
  47. package/dist/babelPlugins/BabelTransformComponentStyles.d.ts +2 -0
  48. package/dist/babelPlugins/BabelTransformComponentStyles.d.ts.map +1 -1
  49. package/dist/babelPlugins/BabelTransformComponentStyles.js +27 -11
  50. package/dist/babelPlugins/BabelTransformCssImports.js +1 -1
  51. package/dist/babelPlugins/BabelTransformDeproxyState.js +1 -1
  52. package/dist/babelPlugins/BabelTransformJsxExtensionsToJs.d.ts.map +1 -1
  53. package/dist/babelPlugins/BabelTransformJsxExtensionsToJs.js +6 -2
  54. package/dist/babelPlugins/BabelTransformPackageImports.d.ts.map +1 -1
  55. package/dist/babelPlugins/BabelTransformPackageImports.js +71 -49
  56. package/dist/babelPlugins/BabelTransformReactive.js +1 -1
  57. package/dist/babelPlugins/BabelTransformReactiveSvelteStyle.js +1 -1
  58. package/dist/babelPlugins/BabelTransformSxyFrameworkImports.js +1 -1
  59. package/dist/babelPlugins/BabelTransformUniqueComponents.js +1 -1
  60. package/dist/babelPlugins/fixImportsInSassErrorMessage.js +1 -1
  61. package/dist/babelPlugins/test.js +1 -1
  62. package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsCjs.js +3 -3
  63. package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsEsm.js +1 -1
  64. package/dist/babelPlugins/transformPackageImports/getWebLocationOfPackageFile.js +2 -2
  65. package/dist/bin/args.js +1 -1
  66. package/dist/bin/commands/build.js +5 -5
  67. package/dist/bin/commands/buildHelp.js +1 -1
  68. package/dist/bin/commands/clean.js +4 -4
  69. package/dist/bin/commands/compile.d.ts.map +1 -1
  70. package/dist/bin/commands/compile.js +24 -17
  71. package/dist/bin/commands/compileSimplePackage.js +2 -2
  72. package/dist/bin/commands/dev.d.ts.map +1 -1
  73. package/dist/bin/commands/dev.js +16 -9
  74. package/dist/bin/commands/devmon.js +4 -4
  75. package/dist/bin/commands/help.js +2 -2
  76. package/dist/bin/commands/start.js +2 -2
  77. package/dist/bin/commands/static.js +3 -3
  78. package/dist/bin/index.js +13 -13
  79. package/dist/bin/moduleLoadAnalysis.js +2 -2
  80. package/dist/browserStorage.js +2 -2
  81. package/dist/build/babel.user.common.config.d.ts +7 -2
  82. package/dist/build/babel.user.common.config.d.ts.map +1 -1
  83. package/dist/build/babel.user.common.config.js +14 -15
  84. package/dist/build/bundle.d.ts +1 -1
  85. package/dist/build/bundle.d.ts.map +1 -1
  86. package/dist/build/bundle.js +15 -7
  87. package/dist/build/bundleBabelOptions.d.ts +6 -0
  88. package/dist/build/bundleBabelOptions.d.ts.map +1 -0
  89. package/dist/build/bundleBabelOptions.js +23 -0
  90. package/dist/build/combineComponentCss.js +2 -2
  91. package/dist/build/compileJavascript.d.ts +4 -0
  92. package/dist/build/compileJavascript.d.ts.map +1 -1
  93. package/dist/build/compileJavascript.js +148 -90
  94. package/dist/build/compileStyles.js +4 -4
  95. package/dist/build/compileUserApp.d.ts +1 -1
  96. package/dist/build/compileUserApp.d.ts.map +1 -1
  97. package/dist/build/compileUserApp.js +15 -12
  98. package/dist/build/componentStylesCache.d.ts +10 -0
  99. package/dist/build/componentStylesCache.d.ts.map +1 -0
  100. package/dist/build/componentStylesCache.js +54 -0
  101. package/dist/build/copyAssets.js +1 -1
  102. package/dist/build/copyPackageModulesToPackagesFolder.js +4 -4
  103. package/dist/build/copyPublicFiles.js +1 -1
  104. package/dist/build/createClientFiles.js +3 -3
  105. package/dist/build/createInstanceConfigFile.js +2 -2
  106. package/dist/build/createPackageVirtualFileSystems.js +1 -1
  107. package/dist/build/devBundle.js +5 -5
  108. package/dist/build/devBundle.rollup.config.d.ts.map +1 -1
  109. package/dist/build/devBundle.rollup.config.js +0 -1
  110. package/dist/build/frameworkDestLocation.d.ts +1 -0
  111. package/dist/build/frameworkDestLocation.d.ts.map +1 -1
  112. package/dist/build/frameworkDestLocation.js +8 -4
  113. package/dist/build/frameworkStylesheets.js +1 -1
  114. package/dist/build/getAllSxyClientModules.js +2 -2
  115. package/dist/build/getPackageDirForFile.js +1 -1
  116. package/dist/build/getSxyClientPackageAliases.d.ts.map +1 -1
  117. package/dist/build/getSxyClientPackageAliases.js +4 -2
  118. package/dist/build/getTempDirForAppCompilation.js +1 -1
  119. package/dist/build/makeBabelRawConfig.d.ts +3 -0
  120. package/dist/build/makeBabelRawConfig.d.ts.map +1 -0
  121. package/dist/build/makeBabelRawConfig.js +12 -0
  122. package/dist/build/makeBabelUserDevConfig.d.ts +1 -1
  123. package/dist/build/makeBabelUserDevConfig.d.ts.map +1 -1
  124. package/dist/build/makeBabelUserDevConfig.js +11 -8
  125. package/dist/build/makeBabelUserProdConfig.d.ts +1 -1
  126. package/dist/build/makeBabelUserProdConfig.d.ts.map +1 -1
  127. package/dist/build/makeBabelUserProdConfig.js +10 -5
  128. package/dist/build/processPackage.js +3 -3
  129. package/dist/build/rollup.user.prod.config.d.ts.map +1 -1
  130. package/dist/build/rollup.user.prod.config.js +13 -11
  131. package/dist/build/rollupExtractComponentStylesheets.js +2 -2
  132. package/dist/build/sassImportParser.js +2 -2
  133. package/dist/build/tallyBabelPlugins.d.ts.map +1 -1
  134. package/dist/build/tallyBabelPlugins.js +2 -7
  135. package/dist/calculateImportedStaticFileLocations.js +2 -2
  136. package/dist/calledFrom.js +2 -2
  137. package/dist/compat/forwardRef.js +1 -1
  138. package/dist/compat/index.js +1 -1
  139. package/dist/componentCss/tungsten.css +2 -2
  140. package/dist/componentProxyHandlers.js +3 -3
  141. package/dist/components/Link.js +2 -2
  142. package/dist/components/PopMessages.js +3 -3
  143. package/dist/components/RawHtml.js +2 -2
  144. package/dist/components/Stylesheet.js +3 -3
  145. package/dist/components/bindable/BindableCheckbox.js +1 -1
  146. package/dist/components/bindable/BindableInput.js +1 -1
  147. package/dist/components/bindable/BindableInputNonString.js +1 -1
  148. package/dist/components/bindable/BindableInputString.js +1 -1
  149. package/dist/components/bindable/BindableInputTyped.js +1 -1
  150. package/dist/components/bindable/BindableInputTypedLegacy.js +1 -1
  151. package/dist/components/bindable/BindableRadio.js +1 -1
  152. package/dist/components/bindable/BindableSelect.js +1 -1
  153. package/dist/components/bindable/BindableTextarea.js +1 -1
  154. package/dist/components/library/RichTextEditor/RichTextEditor.js +8 -8
  155. package/dist/components/library/RichTextEditor/contentTree.js +4 -4
  156. package/dist/components/library/RichTextEditor/sanitizeAuthoredHtml.js +2 -2
  157. package/dist/components/library/__StatefulMessage/StatefulMessage.js +2 -2
  158. package/dist/components/library/index.js +2 -2
  159. package/dist/createElement.js +1 -1
  160. package/dist/defaultConfig.d.ts +0 -1
  161. package/dist/defaultConfig.d.ts.map +1 -1
  162. package/dist/defaultConfig.js +2 -2
  163. package/dist/deleteDirs.js +1 -1
  164. package/dist/env/addToEnv.js +1 -1
  165. package/dist/env/funcs.js +4 -4
  166. package/dist/env/getEnvSchemas.d.ts.map +1 -1
  167. package/dist/env/getEnvSchemas.js +10 -6
  168. package/dist/env/privateEnv.js +2 -2
  169. package/dist/env/privateEnvOrThrow.js +1 -1
  170. package/dist/env/publicEnv.js +1 -1
  171. package/dist/env/publicEnvOrThrow.js +1 -1
  172. package/dist/filePathFromUrl.js +1 -1
  173. package/dist/findProjectDir.js +1 -1
  174. package/dist/findUserConfig.js +5 -5
  175. package/dist/fixExtension.d.ts.map +1 -1
  176. package/dist/fixExtension.js +5 -3
  177. package/dist/frameworkConfigSchema.d.ts +16 -0
  178. package/dist/frameworkConfigSchema.d.ts.map +1 -1
  179. package/dist/frameworkConfigSchema.js +12 -0
  180. package/dist/getComponent.js +5 -5
  181. package/dist/getComponentDev.js +1 -1
  182. package/dist/getFrameworkDir.js +1 -1
  183. package/dist/getRoutes.js +5 -5
  184. package/dist/getRoutesDevs.js +1 -1
  185. package/dist/getUserConfig.js +7 -7
  186. package/dist/hasValidKey.js +1 -1
  187. package/dist/helpers/index.js +2 -2
  188. package/dist/hmr/applyHmrModule.js +5 -5
  189. package/dist/hmr/componentIdentity.js +2 -2
  190. package/dist/hooks/clearCurrentComponent.js +1 -1
  191. package/dist/hooks/getCurrentComponent.js +3 -3
  192. package/dist/hooks/index.js +5 -5
  193. package/dist/hooks/setCurrentComponent.js +1 -1
  194. package/dist/hooks/useCallback.js +2 -2
  195. package/dist/hooks/useEffect.js +2 -2
  196. package/dist/hooks/useInstance.js +1 -1
  197. package/dist/hooks/useMemo.js +2 -2
  198. package/dist/hooks/useState.js +3 -3
  199. package/dist/hydrate/hydrate.js +31 -31
  200. package/dist/hydrate/reconcileHydratedAttributes.js +3 -3
  201. package/dist/index.js +2 -2
  202. package/dist/indexInner.d.ts +1 -1
  203. package/dist/indexInner.d.ts.map +1 -1
  204. package/dist/indexInner.js +45 -45
  205. package/dist/innerHtmlFromProps.js +1 -1
  206. package/dist/isBrowser.js +1 -1
  207. package/dist/isDev.js +1 -1
  208. package/dist/isProd.js +1 -1
  209. package/dist/isServer.js +1 -1
  210. package/dist/jsx-runtime.js +1 -1
  211. package/dist/jsxRuntime.d.ts.map +1 -1
  212. package/dist/jsxRuntime.js +12 -7
  213. package/dist/jsxRuntimeSignals.d.ts.map +1 -1
  214. package/dist/jsxRuntimeSignals.js +15 -8
  215. package/dist/makeFinalConfig.js +1 -1
  216. package/dist/makeInstanceConfigFromFrameworkConfig.js +1 -1
  217. package/dist/makeServerRpc.js +3 -3
  218. package/dist/markOptionSelected.js +1 -1
  219. package/dist/nbsp.js +1 -1
  220. package/dist/output.js +1 -1
  221. package/dist/pop.js +2 -2
  222. package/dist/postcssPlugins/TransformCssNames.js +6 -6
  223. package/dist/postcssPlugins/parseSelectors.js +1 -1
  224. package/dist/postcssPlugins/parseSelectorsRich.js +1 -1
  225. package/dist/postcssPlugins/scopeAnimationValue.js +2 -2
  226. package/dist/propsAreEqual.js +3 -3
  227. package/dist/rawHtml/filterContentNode.js +4 -4
  228. package/dist/rawHtml/parseHtml.js +4 -4
  229. package/dist/rawHtml/sanitizeHtml.js +3 -3
  230. package/dist/rawHtml/tokenizeHtml.js +2 -2
  231. package/dist/render/addImportMap.js +2 -2
  232. package/dist/render/classComponentNodeToRenderingTree.js +4 -4
  233. package/dist/render/componentNodeToRenderingTree.js +7 -7
  234. package/dist/render/contentNodeToHtml.js +11 -11
  235. package/dist/render/contentToHtml.js +4 -4
  236. package/dist/render/contentToHtmlDev.js +1 -1
  237. package/dist/render/contentTreeToRenderingTree.js +7 -7
  238. package/dist/render/functionComponentNodeToRenderingTree.js +4 -4
  239. package/dist/render/getFunctionBodyAsString.js +1 -1
  240. package/dist/render/instantiateClassComponent.js +2 -2
  241. package/dist/render/instantiateComponent.js +3 -3
  242. package/dist/render/instantiateFunctionComponent.js +2 -2
  243. package/dist/render/printComponentNameInSource.js +1 -1
  244. package/dist/render/processHead.js +5 -5
  245. package/dist/render/processHtmlNode.js +1 -1
  246. package/dist/render/processProps.js +2 -2
  247. package/dist/render/processRenderingNodeHtml.js +6 -6
  248. package/dist/render/renderingTreeToHtml.js +16 -16
  249. package/dist/render/rootToHtml.js +2 -2
  250. package/dist/render/rootToHtmlDev.js +1 -1
  251. package/dist/requests/fetch/delete.js +2 -2
  252. package/dist/requests/fetch/get.js +3 -3
  253. package/dist/requests/fetch/patch.js +2 -2
  254. package/dist/requests/fetch/post.js +2 -2
  255. package/dist/requests/fetch/put.js +2 -2
  256. package/dist/requests/index.js +5 -5
  257. package/dist/routing/MatchedRoute.js +2 -2
  258. package/dist/routing/getPathPriority.js +1 -1
  259. package/dist/routing/matchPath.js +3 -3
  260. package/dist/routing/patternToRegex.js +1 -1
  261. package/dist/server.js +3 -3
  262. package/dist/serverModuleLocation.d.ts +3 -0
  263. package/dist/serverModuleLocation.d.ts.map +1 -0
  264. package/dist/serverModuleLocation.js +12 -0
  265. package/dist/settings.d.ts +4 -0
  266. package/dist/settings.d.ts.map +1 -1
  267. package/dist/settings.js +9 -0
  268. package/dist/standardSchema.js +1 -1
  269. package/dist/staticGen/getAppRoutes.js +3 -3
  270. package/dist/staticGen/staticGen.js +7 -7
  271. package/dist/style/jssToCss.js +3 -3
  272. package/dist/style/styleContent.js +1 -1
  273. package/dist/style/styleContentSxy.js +8 -8
  274. package/dist/style/unusedStyles.js +1 -1
  275. package/dist/sync/index.js +1 -1
  276. package/dist/syncServer/preload.js +1 -1
  277. package/dist/testing/host.js +1 -1
  278. package/dist/testing/hydrateTestApp.js +9 -9
  279. package/dist/testing/index.js +11 -11
  280. package/dist/testing/installTestStyleProcessors.js +1 -1
  281. package/dist/testing/loadEnv.js +3 -3
  282. package/dist/testing/loadEnvSetup.js +1 -1
  283. package/dist/testing/temp/componentPackageMock.js +2 -2
  284. package/dist/testing/temp/contentHtmlElements.js +2 -2
  285. package/dist/throwError.js +2 -2
  286. package/dist/timeProfiler.d.ts +1 -1
  287. package/dist/timeProfiler.d.ts.map +1 -1
  288. package/dist/timeProfiler.js +62 -26
  289. package/dist/update/integrateUpdateVdom.js +28 -28
  290. package/dist/validChildren.js +2 -2
  291. package/dist/warnOnFrameworkChange.js +2 -2
  292. package/dist/zones/react.js +3 -3
  293. package/package.json +18 -11
  294. package/types/modules.d.ts +2 -0
@@ -11,7 +11,6 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
11
11
  import { join, dirname, relative } from 'path';
12
12
  import slash from 'slash';
13
13
  import precinct from 'precinct';
14
- //import sxyPrecinct from 'sxy-precinct'
15
14
  import { existsSync, mkdirSync, promises as fsPromises, readFileSync, writeFileSync } from 'fs';
16
15
  import { createRequire } from 'module';
17
16
  import { transformFileSync as babelTransformFileSync, transformSync as babelTransformSync } from '@babel/core';
@@ -20,24 +19,34 @@ import { arrays } from 'sxy-lib';
20
19
  const babelPluginSyntaxImportAssertions = babelPluginSyntaxImportAssertionsModule.default;
21
20
  import { init as lexerInit, parse as lexerParse } from 'cjs-module-lexer';
22
21
  lexerInit();
23
- import { MakeBabelTransformCjsToFunction } from "./BabelTransformCjsToFunction.js";
24
- import { MakeBabelExtractComponentStylesheet } from "./BabelExtractComponentStylesheet.js";
25
- import { recordFrameworkStylesheet } from "../build/frameworkStylesheets.js";
26
- import { MakeBabelTransformDependencyImportsEsm } from "./transformPackageImports/BabelTransformDependencyImportsEsm.js";
27
- import { MakeBabelTransformDependencyImportsCjs } from "./transformPackageImports/BabelTransformDependencyImportsCjs.js";
28
- import { frameworkDistFolder, packageName as frameworkPackageName, packageName, packagesFolder /*, packagesCacheInfoName*/ } from "../settings.js";
29
- import { findProjectDir } from "../findProjectDir.js";
30
- import { cliError, cliWarn, cliNote, cliInfo, cliNews } from "../cliOutput.js";
31
- import { isBareImport } from "./isBareImport.js";
32
- import { resolveBareImport } from "./transformPackageImports/resolveBareImport.js";
33
- import { TungstenError } from "../TungstenError.js";
34
- import { throwError } from "../throwError.js";
35
- import { isProfiling, tally } from "../timeProfiler.js";
22
+ import { MakeBabelTransformCjsToFunction } from './BabelTransformCjsToFunction.js';
23
+ import { MakeBabelExtractComponentStylesheet } from './BabelExtractComponentStylesheet.js';
24
+ import { recordFrameworkStylesheet } from '../build/frameworkStylesheets.js';
25
+ import { MakeBabelTransformDependencyImportsEsm } from './transformPackageImports/BabelTransformDependencyImportsEsm.js';
26
+ import { MakeBabelTransformDependencyImportsCjs } from './transformPackageImports/BabelTransformDependencyImportsCjs.js';
27
+ import { frameworkDistFolder, packageName as frameworkPackageName, packageName, packagesFolder /*, packagesCacheInfoName*/ } from '../settings.js';
28
+ import { findProjectDir } from '../findProjectDir.js';
29
+ import { cliError, cliWarn, cliNote, cliInfo, cliNews } from '../cliOutput.js';
30
+ import { isBareImport } from './isBareImport.js';
31
+ import { resolveBareImport } from './transformPackageImports/resolveBareImport.js';
32
+ import { TungstenError } from '../TungstenError.js';
33
+ import { throwError } from '../throwError.js';
34
+ import { isProfiling, tallied } from '../timeProfiler.js';
36
35
  //import { copyPackageModulesToPackagesFolder } from '../build/copyPackageModulesToPackagesFolder.js'
37
36
  const require = createRequire(import.meta.url);
38
37
  function debug(...texts) {
39
38
  //console.log(...texts)
40
39
  }
40
+ // '@scope/name@1.2.3/dist/index.js' -> its package identifier and the file's path within the package
41
+ function breakFileIdentifier(fileIdentifier) {
42
+ // a scoped name starts with @, so the version's @ is the next one
43
+ const atPos = fileIdentifier.indexOf('@', fileIdentifier.startsWith('@') ? 1 : 0);
44
+ const startOfInternal = fileIdentifier.indexOf('/', atPos);
45
+ return {
46
+ packageIdentifier: fileIdentifier.slice(0, startOfInternal),
47
+ relFile: fileIdentifier.slice(startOfInternal + 1)
48
+ };
49
+ }
41
50
  class UnsupportedCompiledDependencyError extends TungstenError {
42
51
  constructor(dependency, importedFrom, importHistory, options) {
43
52
  super(`Could not resolve ${dependency} from ${importedFrom}`);
@@ -210,11 +219,9 @@ export function MakeBabelTransformPackageImports(opts) {
210
219
  const {
211
220
  file
212
221
  } = fileInfo;
213
- const precinctStart = performance.now();
214
- const precinctResults = precinct.paperwork(file, {
222
+ const precinctResults = tallied('precinct.paperwork', () => precinct.paperwork(file, {
215
223
  includeCore: false
216
- });
217
- tally('precinct.paperwork', performance.now() - precinctStart);
224
+ }));
218
225
  const deps = precinctResults.map(d => {
219
226
  //console.log('getFileDependencies', 'd', d)
220
227
  return isBareImport(d) ? applyImportAliases(d, fileInfo.type) : d;
@@ -348,9 +355,7 @@ export function MakeBabelTransformPackageImports(opts) {
348
355
  async function babelFileEsm(file /*, packageInfo*/, nonEsmDeps, onStylesheet) {
349
356
  // Sync, so it can be tallied: these run concurrently in the deferred package work, where a
350
357
  // wall clock around an async call would count the same time once per file in flight.
351
- const esmStart = performance.now();
352
- const result = babelTransformFileSync(file, makeModifyImportsEsmBabelOptions(nonEsmDeps.map(d => d.webLocation), onStylesheet));
353
- tally('babel transform (packages)', performance.now() - esmStart);
358
+ const result = tallied('babel transform (packages)', () => babelTransformFileSync(file, makeModifyImportsEsmBabelOptions(nonEsmDeps.map(d => d.webLocation), onStylesheet)));
354
359
  if (result === null) {
355
360
  throw new TungstenError(`BabelTransformPackageImports error: sub file babel transform (1) returned null: ${file}`);
356
361
  }
@@ -384,9 +389,7 @@ export function MakeBabelTransformPackageImports(opts) {
384
389
  async function babelFileCjs(file, cacheDest, finalDest, packageInfo, nonEsmDeps) {
385
390
  //console.log(chalk.yellow`cjs file ${file}`)
386
391
  const nonEsmDepsWebPath = nonEsmDeps.map(fi => fi.webLocation);
387
- const cjsStart = performance.now();
388
- let result = babelTransformFileSync(file, makeCjsToEsmBabelOptions(nonEsmDepsWebPath));
389
- tally('babel transform (packages)', performance.now() - cjsStart);
392
+ let result = tallied('babel transform (packages)', () => babelTransformFileSync(file, makeCjsToEsmBabelOptions(nonEsmDepsWebPath)));
390
393
  if (result === null) {
391
394
  throw new TungstenError(`BabelTransformPackageImports error: sub file babel transform (2) returned null: ${file}`);
392
395
  }
@@ -399,12 +402,11 @@ export function MakeBabelTransformPackageImports(opts) {
399
402
  });
400
403
  //console.log('writing file', intermedCacheLocation)
401
404
  await fsPromises.writeFile(intermedCacheLocation, result.code); // rel contains the slash at start
402
- const cjsImportsStart = performance.now();
403
- result = babelTransformSync(result.code, {
405
+ const code = result.code;
406
+ result = tallied('babel transform (packages)', () => babelTransformSync(code, {
404
407
  filename: file,
405
408
  ...makeModifyImportsCjsBabelOptions(nonEsmDepsWebPath)
406
- });
407
- tally('babel transform (packages)', performance.now() - cjsImportsStart);
409
+ }));
408
410
  if (result === null) {
409
411
  throw new TungstenError(`BabelTransformPackageImports error: sub file babel transform (3) returned null: ${file}
410
412
  `);
@@ -538,6 +540,11 @@ export function MakeBabelTransformPackageImports(opts) {
538
540
  recursive: true
539
541
  });
540
542
  await fsPromises.copyFile(cacheNode.cacheLocation, cacheNode.finalLocation);
543
+ // the esm wrapper a cjs file gets when an esm package imports it is made while processing the
544
+ // importer (getExternalImportFinalImportLocation), which a hit skips, and it is never cached
545
+ if (cacheNode.type !== 'esm') {
546
+ makeCjsEntryFile(cacheNode.originalLocation, `/${slash(relative(buildLocation, cacheNode.finalLocation))}`);
547
+ }
541
548
  if (cacheNode.dependencies) {
542
549
  await processCacheDependencies(cacheNode.dependencies);
543
550
  }
@@ -562,6 +569,24 @@ export function MakeBabelTransformPackageImports(opts) {
562
569
  // A cached file is only reusable if its whole dependency closure is too: processCacheDependencies
563
570
  // walks that closure from identifiers alone and has no way to resolve one back to a source file
564
571
  // to compile instead, so the entire subtree is checked before any of it is used.
572
+ // Existence is checked per package directory, not per file. An installed package at a version
573
+ // has all its files, and the graph is written only once a run has completed, so a cache
574
+ // directory a node names is whole unless deleted by hand - `--fresh` covers that. Two stats per
575
+ // node were ~85ms of a full-hit start on 327 nodes; a recursive readdirSync of the cache was
576
+ // 68ms, so it was not taken either.
577
+ const dirsKnown = new Map();
578
+ function dirExists(dir) {
579
+ let known = dirsKnown.get(dir);
580
+ if (known === undefined) dirsKnown.set(dir, known = existsSync(dir));
581
+ return known;
582
+ }
583
+ function packageDirsExist(fileIdentifier, node) {
584
+ // both locations end in the file's path within its package; what precedes it is the package
585
+ const {
586
+ relFile
587
+ } = breakFileIdentifier(fileIdentifier);
588
+ return dirExists(node.originalLocation.slice(0, -relFile.length)) && dirExists(node.cacheLocation.slice(0, -relFile.length));
589
+ }
565
590
  const subtreeUsable = new Map();
566
591
  function cachedSubtreeIsUsable(fileIdentifier, visiting) {
567
592
  const settled = subtreeUsable.get(fileIdentifier);
@@ -574,7 +599,7 @@ export function MakeBabelTransformPackageImports(opts) {
574
599
  // pays rather than recompiling a linked framework's every file. The cache key is the
575
600
  // version, which a linked package changes underneath, so a profiled run can compile stale
576
601
  // code after that package is rebuilt until the packages cache is deleted - it warns.
577
- const usable = node !== undefined && (isProfiling() || cacheKeyIdentifiesContent(node.originalLocation)) && existsSync(node.originalLocation) && existsSync(node.cacheLocation) && (node.dependencies ?? []).every(dep => cachedSubtreeIsUsable(dep, visiting));
602
+ const usable = node !== undefined && (isProfiling() || cacheKeyIdentifiesContent(node.originalLocation)) && tallied('package dirs exist', () => packageDirsExist(fileIdentifier, node)) && (node.dependencies ?? []).every(dep => cachedSubtreeIsUsable(dep, visiting));
578
603
  visiting.delete(fileIdentifier);
579
604
  subtreeUsable.set(fileIdentifier, usable);
580
605
  return usable;
@@ -595,7 +620,7 @@ export function MakeBabelTransformPackageImports(opts) {
595
620
  } else {
596
621
  processedFilesCache[file] = fileInfo.packageInfo;
597
622
  const cacheNode = opts.oldDependencyGraph[fileInfo.fileIdentifier];
598
- if (cacheNode !== undefined && cachedSubtreeIsUsable(fileInfo.fileIdentifier, new Set())) {
623
+ if (cacheNode !== undefined && tallied('cached subtree check', () => cachedSubtreeIsUsable(fileInfo.fileIdentifier, new Set()))) {
599
624
  await copyFileFromCache(fileInfo.fileIdentifier, cacheNode);
600
625
  } else {
601
626
  await doProcessFile(fileInfo, sourceFilename, history);
@@ -655,8 +680,10 @@ export function MakeBabelTransformPackageImports(opts) {
655
680
  if (cachedFileInfo) {
656
681
  return cachedFileInfo;
657
682
  } else {
658
- const fileInfo = resolveFile(file);
659
- opts.promises.push(processFile(fileInfo, sourceFilename, [sourceFilename]).catch(error => {
683
+ const fileInfo = tallied('resolve file', () => resolveFile(file));
684
+ // async: the tally covers its synchronous prefix, up to the first await
685
+ const processing = tallied('start processing file', () => processFile(fileInfo, sourceFilename, [sourceFilename]));
686
+ opts.promises.push(processing.catch(error => {
660
687
  if (error instanceof UnsupportedCompiledDependencyError) {
661
688
  cliError(formatUnsupportedDependencyError(error));
662
689
  } else {
@@ -770,18 +797,18 @@ export function MakeBabelTransformPackageImports(opts) {
770
797
  // const location = source.value
771
798
  // }
772
799
  // }
773
- // Resolution is this visitor's whole cost - ~2ms of node_modules walking per bare import -
774
- // and the same specifier from the same directory resolves identically within a run
775
- // (tungsten/jsx-runtime, from every component). Keyed on the importer's directory because
776
- // both resolvers start their walk there. Lives as long as the plugin, like
777
- // importedPackageFiles, so a package changed in place mid-session is stale in both.
800
+ // Resolution is this visitor's whole cost - ~2ms of node_modules walking per bare import.
801
+ // Every importer is under the one code dir, so they all walk the same node_modules chain
802
+ // and a specifier resolves identically wherever it is imported from (tungsten/jsx-runtime,
803
+ // from every component): one resolution per specifier, not per importer directory. A
804
+ // node_modules nested inside the code dir would break that; none is expected. Lives as long
805
+ // as the plugin, like importedPackageFiles, so a package changed in place is stale in both.
778
806
  const resolvedImports = new Map();
779
807
  function resolveImportTarget(location, fromDir, requireFrom) {
780
- const key = `${fromDir}\0${location}`;
781
- const known = resolvedImports.get(key);
808
+ const known = resolvedImports.get(location);
782
809
  if (known !== undefined) return known;
783
810
  const target = resolveBareImport(location, [fromDir]) ?? requireFrom.resolve(location);
784
- resolvedImports.set(key, target);
811
+ resolvedImports.set(location, target);
785
812
  return target;
786
813
  }
787
814
  return {
@@ -805,7 +832,7 @@ export function MakeBabelTransformPackageImports(opts) {
805
832
  ImportDeclaration: function (path) {
806
833
  if (skipPackageCompilationForFile) return;
807
834
  try {
808
- let location = path.node.source.value;
835
+ const location = path.node.source.value;
809
836
  //console.log('BabelTransformPackageImports', 'ImportDeclaration', location)
810
837
  // see if it is a bare import
811
838
  if (isBareImport(location)) {
@@ -818,15 +845,10 @@ export function MakeBabelTransformPackageImports(opts) {
818
845
  // throwError('BabelTransformPackageImports', 'Found an import to a node package in user code.')
819
846
  // }
820
847
  //console.log('*', filename, 'processing bare import', location)
821
- // hacky alias
822
- if (location === 'tungsten/jsx-runtime') {
823
- //console.log(chalk.orange`We did the hacky jsx runtime alias in BabelTransformPackageImports`)
824
- location = 'tungsten/jsxRuntime.js';
825
- }
826
848
  // the real file location of the file being imported.
827
849
  // User code is served as ESM, so it resolves with the 'import'
828
850
  // condition - see resolvePrecinctDependencies()
829
- const importTarget = resolveImportTarget(location, dirname(filename), require);
851
+ const importTarget = tallied('resolve import target', () => resolveImportTarget(location, dirname(filename), require));
830
852
  // Should do some checking here to show helpful errors about bad imports
831
853
  if (importTarget === location) {
832
854
  //console.log()
@@ -842,7 +864,7 @@ export function MakeBabelTransformPackageImports(opts) {
842
864
  return;
843
865
  }
844
866
  //console.log('** importTarget', importTarget)
845
- const fileInfo = processPackageFile(importTarget, filename);
867
+ const fileInfo = tallied('process package file', () => processPackageFile(importTarget, filename));
846
868
  const {
847
869
  file: sourceFile,
848
870
  finalDest,
@@ -863,7 +885,7 @@ export function MakeBabelTransformPackageImports(opts) {
863
885
  addImportAlias(location, webLocation);
864
886
  //console.log('add alias for', location)
865
887
  } else {
866
- const entryFile = makeCjsEntryFile(sourceFile, webLocation);
888
+ const entryFile = tallied('make cjs entry file', () => makeCjsEntryFile(sourceFile, webLocation));
867
889
  addImportAlias(location, entryFile);
868
890
  //console.log('add alias for', location)
869
891
  }
@@ -2,7 +2,7 @@
2
2
  // exports MakeBabelTransformBind (function)
3
3
  //
4
4
  //
5
- import { throwError } from "../throwError.js";
5
+ import { throwError } from '../throwError.js';
6
6
  /////////////////////////////////////////////////
7
7
  // Is this WIP?
8
8
  /////////////////////////////////////////////////
@@ -2,7 +2,7 @@
2
2
  // exports MakeBabelTransformBind (function)
3
3
  //
4
4
  //
5
- import { throwError } from "../throwError.js";
5
+ import { throwError } from '../throwError.js';
6
6
  const reactiveFunctionName = 'reactive';
7
7
  // type VariablePart = {
8
8
  // property: any, // something in babel
@@ -4,7 +4,7 @@
4
4
  // Seems to convert imports of 'tungsten' to import from the
5
5
  // compiled tungsten packages in <buildLocation>/<packagesFolder>
6
6
  // but not sure this is working/in use
7
- import { packagesFolder } from "../settings.js";
7
+ import { packagesFolder } from '../settings.js';
8
8
  // type Opts = {
9
9
  // }
10
10
  export function MakeBabelTransformTungstenFrameworkImports(/*opts: Opts*/
@@ -1,4 +1,4 @@
1
- import { TungstenError } from "../TungstenError.js";
1
+ import { TungstenError } from '../TungstenError.js';
2
2
  const uidKey = '__u';
3
3
  function AttributeIsJSXAttribute(attribute) {
4
4
  return attribute.type === 'JSXAttribute';
@@ -1,4 +1,4 @@
1
- import { throwError } from "../throwError.js";
1
+ import { throwError } from '../throwError.js';
2
2
  // RegEx: @use or @import, 0 or spaces or tabs, followed by an import target in single or double quotes
3
3
  const useOrImportRegex = /@(?:use|import)[ \t]*(?:'([^']+)'|"([^']+)")/g;
4
4
  // the line optionally starts with digits, spaces then pipe |, and after has 1 or more ^, and to the left and the right is only spaces or more carets
@@ -1,4 +1,4 @@
1
- import { fixImportsInSassErrorMessage } from "./fixImportsInSassErrorMessage.js";
1
+ import { fixImportsInSassErrorMessage } from './fixImportsInSassErrorMessage.js';
2
2
  const input = `
3
3
  @import '../foo'
4
4
  ^^^^^^^^^^^^^^^^
@@ -9,9 +9,9 @@
9
9
  // }
10
10
  import { dirname, relative } from 'path';
11
11
  import slash from 'slash';
12
- import { isBareImport } from "../isBareImport.js";
13
- import { cliWarn } from "../../cliOutput.js";
14
- import { warn } from "../../output.js";
12
+ import { isBareImport } from '../isBareImport.js';
13
+ import { cliWarn } from '../../cliOutput.js';
14
+ import { warn } from '../../output.js';
15
15
  import { TungstenError } from 'tungsten/TungstenError.js';
16
16
  export function MakeBabelTransformDependencyImportsCjs(opts, funcs) {
17
17
  return function BabelTransformDependencyImportsCjs(babel) {
@@ -9,7 +9,7 @@
9
9
  // }
10
10
  import { dirname, relative } from 'path';
11
11
  import slash from 'slash';
12
- import { isBareImport } from "../isBareImport.js";
12
+ import { isBareImport } from '../isBareImport.js';
13
13
  import { throwError } from 'tungsten/throwError.js';
14
14
  import { cliError, cliOut } from 'tungsten/cliOutput.js';
15
15
  export function MakeBabelTransformDependencyImportsEsm(opts, funcs) {
@@ -1,6 +1,6 @@
1
1
  import { dirname } from 'path';
2
- import { TungstenError } from "../../TungstenError.js";
3
- import { findProjectDir } from "../../findProjectDir.js";
2
+ import { TungstenError } from '../../TungstenError.js';
3
+ import { findProjectDir } from '../../findProjectDir.js';
4
4
  const getPackageDirForDirCache = {};
5
5
  function getPackageDirForDir(dir) {
6
6
  if (dir in getPackageDirForDirCache) {
package/dist/bin/args.js CHANGED
@@ -1,4 +1,4 @@
1
- import { cliError, cliOut } from "../cliOutput.js";
1
+ import { cliError, cliOut } from '../cliOutput.js';
2
2
  export function cliArgs(specs, options = {}) {
3
3
  // after node and the script come the command word and its arguments
4
4
  const [command = '', ...given] = process.argv.slice(2);
@@ -1,10 +1,10 @@
1
1
  // build
2
2
  import chalk from 'chalk-extensions';
3
- import { Framework } from "../../Framework.js";
4
- import { cliOut, cliNews, cliWarn } from "../../cliOutput.js";
5
- import { staticSiteFolder } from "../../settings.js";
6
- import { createTimeProfiler, reportRunTotal, reportStartupPhase } from "../../timeProfiler.js";
7
- import { cliArgs } from "../args.js";
3
+ import { Framework } from '../../Framework.js';
4
+ import { cliOut, cliNews, cliWarn } from '../../cliOutput.js';
5
+ import { staticSiteFolder } from '../../settings.js';
6
+ import { createTimeProfiler, reportRunTotal, reportStartupPhase } from '../../timeProfiler.js';
7
+ import { cliArgs } from '../args.js';
8
8
  // first statement in the body, so it closes off the import evaluation above
9
9
  reportStartupPhase('load build modules');
10
10
  // --help never reaches here - bin/index.ts routes it to buildHelp.ts before this module loads
@@ -1,5 +1,5 @@
1
1
  // kept out of build.ts so --help does not pay for resolving the build's import tree
2
- import { cliOut } from "../../cliOutput.js";
2
+ import { cliOut } from '../../cliOutput.js';
3
3
  cliOut(`Usage: tungsten build [--profile] [--profile-modules] [--quiet]
4
4
 
5
5
  Options:
@@ -1,9 +1,9 @@
1
1
  // build
2
2
  import chalk from 'chalk-extensions';
3
- import { Framework } from "../../Framework.js";
4
- import { cliOut } from "../../cliOutput.js";
5
- import { packageNameCapitalized } from "../../settings.js";
6
- import { cliArgs } from "../args.js";
3
+ import { Framework } from '../../Framework.js';
4
+ import { cliOut } from '../../cliOutput.js';
5
+ import { packageNameCapitalized } from '../../settings.js';
6
+ import { cliArgs } from '../args.js';
7
7
  cliArgs({}); // accepts nothing but --help
8
8
  //// prep the app
9
9
  const sxyFramework = new Framework();
@@ -1 +1 @@
1
- {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/bin/commands/compile.ts"],"names":[],"mappings":"AAoRA,OAAO,EAAE,CAAA"}
1
+ {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/bin/commands/compile.ts"],"names":[],"mappings":"AAoSA,OAAO,EAAE,CAAA"}
@@ -1,18 +1,18 @@
1
1
  import { dirname, join, resolve } from 'path';
2
2
  import { promises as fsPromises } from 'fs';
3
- import { removeRecursive } from "../../removeRecursive.js";
4
- import { compileJavascript } from "../../build/compileJavascript.js";
5
- import { compileStyles } from "../../build/compileStyles.js";
6
- import { writeFrameworkCss } from "../../build/frameworkStylesheets.js";
7
- import { copyAssets } from "../../build/copyAssets.js";
8
- import { copyPublicFiles } from "../../build/copyPublicFiles.js";
9
- import { createClientFiles } from "../../build/createClientFiles.js";
10
- import { createInstanceConfigFile } from "../../build/createInstanceConfigFile.js";
11
- import { getUserConfig } from "../../getUserConfig.js";
12
- import { buildCodeSubPath, assetsFolder, clientFolder, componentCssFolder, devBuildOuterFolder, frameworkCssFolder, packagesCacheFolder, packagesFolder, publicFolder, staticFolder } from "../../settings.js";
13
- import { cliError, cliNews, cliOut } from "../../cliOutput.js";
14
- import { createTimeProfiler, reportRunTotal, reportStartupPhase } from "../../timeProfiler.js";
15
- import { cliArgs } from "../args.js";
3
+ import { removeRecursive } from '../../removeRecursive.js';
4
+ import { compileJavascript } from '../../build/compileJavascript.js';
5
+ import { compileStyles } from '../../build/compileStyles.js';
6
+ import { writeFrameworkCss } from '../../build/frameworkStylesheets.js';
7
+ import { copyAssets } from '../../build/copyAssets.js';
8
+ import { copyPublicFiles } from '../../build/copyPublicFiles.js';
9
+ import { createClientFiles } from '../../build/createClientFiles.js';
10
+ import { createInstanceConfigFile } from '../../build/createInstanceConfigFile.js';
11
+ import { getUserConfig } from '../../getUserConfig.js';
12
+ import { buildCodeSubPath, assetsFolder, clientFolder, componentCssFolder, devBuildOuterFolder, devRawBuildFolder, frameworkCssFolder, packagesCacheFolder, stylesCacheFolder, packagesFolder, publicFolder, staticFolder } from '../../settings.js';
13
+ import { cliError, cliNews, cliOut } from '../../cliOutput.js';
14
+ import { createTimeProfiler, reportRunTotal, reportStartupPhase } from '../../timeProfiler.js';
15
+ import { cliArgs } from '../args.js';
16
16
  // first statement in the body, so it closes off the import evaluation above
17
17
  reportStartupPhase('load compile modules');
18
18
  const {
@@ -31,7 +31,8 @@ const {
31
31
  readyFile: readyFileOption,
32
32
  ignoreDirs,
33
33
  ignorePatterns,
34
- tests
34
+ tests,
35
+ fresh
35
36
  } = cliArgs({
36
37
  js: '--js',
37
38
  css: '--css',
@@ -48,10 +49,11 @@ const {
48
49
  readyFile: '--ready-file <file>',
49
50
  ignoreDirs: '--ignore-dirs <dir>...',
50
51
  ignorePatterns: '--ignore-patterns <pattern>...',
51
- tests: '--tests'
52
+ tests: '--tests',
53
+ fresh: '--fresh'
52
54
  }, {
53
55
  handledElsewhere: ['--profile-modules'],
54
- help: ['With no target option (--js, --css, --client, --assets, --public), all targets are compiled.', ' --profile reports the time taken by each compile phase', ' --profile-modules[=<path substring>] reports where module load time goes,', ' splitting each import into what only it needs and what it shares', ' --packages compiles imported packages into the build\'s .packages tree', ' for the dev server to serve. Off by default: compiled code left to', ' node\'s own resolution, as tests use, needs none of it.', ' --ignore-dirs and --ignore-patterns override the config entries of the same name.', ' Repeat either to give several values, or pass an empty value to ignore nothing.', ' --tests also compiles the files the config\'s testPatterns match, which every', ' other compile leaves out.']
56
+ help: ['With no target option (--js, --css, --client, --assets, --public), all targets are compiled.', ' --profile reports the time taken by each compile phase', ' --profile-modules[=<path substring>] reports where module load time goes,', ' splitting each import into what only it needs and what it shares', ' --packages compiles imported packages into the build\'s .packages tree', ' for the dev server to serve. Off by default: compiled code left to', ' node\'s own resolution, as tests use, needs none of it.', ' --ignore-dirs and --ignore-patterns override the config entries of the same name.', ' Repeat either to give several values, or pass an empty value to ignore nothing.', ' --tests also compiles the files the config\'s testPatterns match, which every', ' other compile leaves out.', ' --fresh compiles everything from source, ignoring the packages and styles caches.', ' Both are rewritten, so the next compile starts from a cache this one made.']
55
57
  });
56
58
  const allTargets = ['js', 'css', 'client', 'assets', 'public'];
57
59
  const targetGiven = {
@@ -92,6 +94,8 @@ const styleImportBase = config.styleImportBase !== undefined ? join(sourceLocati
92
94
  const buildLocation = outputOption !== undefined ? resolve(projectDir, outputOption) : join(projectDir, devBuildOuterFolder);
93
95
  const buildCodeLocation = join(buildLocation, buildCodeSubPath);
94
96
  const packagesCacheLocation = outputOption !== undefined ? join(buildLocation, '.packagesCache') : join(projectDir, packagesCacheFolder);
97
+ const stylesCacheLocation = outputOption !== undefined ? join(buildLocation, '.stylesCache') : join(projectDir, stylesCacheFolder);
98
+ const rawBuildLocation = outputOption !== undefined ? `${buildLocation}-raw` : join(projectDir, devRawBuildFolder);
95
99
  const readyFileLocation = readyFileOption !== undefined ? resolve(projectDir, readyFileOption) : undefined;
96
100
  if (buildLocation.toLowerCase() === resolve(projectDir).toLowerCase()) {
97
101
  cliError('Compile output cannot be the project root');
@@ -120,7 +124,7 @@ const cleanTasks = [];
120
124
  if (clean && targets.has('js')) {
121
125
  cleanTasks.push(removeRecursive(buildCodeLocation), removeRecursive(join(buildLocation, componentCssFolder)),
122
126
  // else a component the app no longer imports keeps its stale stylesheet linked
123
- removeRecursive(join(buildLocation, frameworkCssFolder)), removeRecursive(join(buildLocation, packagesFolder)), removeRecursive(packagesCacheLocation));
127
+ removeRecursive(join(buildLocation, frameworkCssFolder)), removeRecursive(join(buildLocation, packagesFolder)), removeRecursive(packagesCacheLocation), removeRecursive(stylesCacheLocation), removeRecursive(rawBuildLocation));
124
128
  }
125
129
  if (clean && targets.has('css')) {
126
130
  cleanTasks.push(removeRecursive(join(buildLocation, staticFolder)));
@@ -141,7 +145,10 @@ if (targets.has('js')) {
141
145
  quiet,
142
146
  packages,
143
147
  tests,
148
+ fresh,
144
149
  packagesCacheLocation,
150
+ stylesCacheLocation,
151
+ rawBuildLocation,
145
152
  onCycleComplete: watch ? async cycle => {
146
153
  if (cycle.success) {
147
154
  await markReady();
@@ -1,5 +1,5 @@
1
- import { findProjectDir } from "../../findProjectDir.js";
2
- import { cliInfo, cliLog } from "../../cliOutput.js";
1
+ import { findProjectDir } from '../../findProjectDir.js';
2
+ import { cliInfo, cliLog } from '../../cliOutput.js';
3
3
  cliInfo('tungsten compile-simple-package is not ready yet');
4
4
  process.exit(2);
5
5
  const projectDir = process.cwd();
@@ -1 +1 @@
1
- {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/bin/commands/dev.ts"],"names":[],"mappings":"AAuEA,OAAO,EAAE,CAAA"}
1
+ {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/bin/commands/dev.ts"],"names":[],"mappings":"AA4EA,OAAO,EAAE,CAAA"}
@@ -1,9 +1,9 @@
1
1
  import open from 'open';
2
- import { cliOut } from "../../cliOutput.js";
3
- import { Framework } from "../../Framework.js";
4
- import { warnOnFrameworkChange } from "../../warnOnFrameworkChange.js";
5
- import { createTimeProfiler, reportRunTotal, reportStartupPhase } from "../../timeProfiler.js";
6
- import { cliArgs } from "../args.js";
2
+ import { cliOut } from '../../cliOutput.js';
3
+ import { Framework } from '../../Framework.js';
4
+ import { warnOnFrameworkChange } from '../../warnOnFrameworkChange.js';
5
+ import { createTimeProfiler, reportRunTotal, reportStartupPhase } from '../../timeProfiler.js';
6
+ import { cliArgs } from '../args.js';
7
7
  //import dotenv from 'dotenv'
8
8
  //dotenv.config({ path: '.private.env' })
9
9
  // first statement in the body, so it closes off the import evaluation above
@@ -11,12 +11,18 @@ reportStartupPhase('load dev modules');
11
11
  const {
12
12
  boot,
13
13
  profile,
14
- tests
14
+ tests,
15
+ fresh,
16
+ clean
15
17
  } = cliArgs({
16
18
  boot: '--no-boot',
17
19
  profile: '--profile',
20
+ // also delete the packages and styles caches, not only the dev build
21
+ clean: '--clean',
18
22
  // also compile the files config.testDirs/testPatterns match - normally only a test compile does
19
- tests: '--tests'
23
+ tests: '--tests',
24
+ // compile everything from source, ignoring the packages and styles caches (they are rewritten)
25
+ fresh: '--fresh'
20
26
  }, {
21
27
  handledElsewhere: ['--profile-modules']
22
28
  });
@@ -24,11 +30,12 @@ const {
24
30
  const sxyFramework = new Framework();
25
31
  sxyFramework.profiler = createTimeProfiler(profile);
26
32
  sxyFramework.tests = tests;
33
+ sxyFramework.fresh = fresh;
27
34
  const config = await sxyFramework.init();
28
35
  //console.log('framework ready')
29
36
  // build for dev
30
- cliOut('Removing old builds');
31
- await sxyFramework.clean('dev');
37
+ cliOut(clean ? 'Removing the dev build and its caches' : 'Removing old builds');
38
+ await sxyFramework.clean(clean ? 'dev-full' : 'dev');
32
39
  //cliOut('cleaned')
33
40
  cliOut('Building');
34
41
  await sxyFramework.build('dev');
@@ -5,12 +5,12 @@ import { spawn } from 'node:child_process';
5
5
  import { join } from 'node:path';
6
6
  import { fileURLToPath } from 'node:url';
7
7
  import chokidar from 'chokidar';
8
- import { cliError } from "../../cliOutput.js";
9
- import { getFrameworkDir } from "../../getFrameworkDir.js";
10
- import { cliArgs } from "../args.js";
8
+ import { cliError } from '../../cliOutput.js';
9
+ import { getFrameworkDir } from '../../getFrameworkDir.js';
10
+ import { cliArgs } from '../args.js';
11
11
  // devmon reads none of its arguments itself - it passes them straight through to the dev child
12
12
  cliArgs({}, {
13
- handledElsewhere: ['--no-boot', '--profile', '--profile-modules']
13
+ handledElsewhere: ['--no-boot', '--clean', '--fresh', '--tests', '--profile', '--profile-modules']
14
14
  });
15
15
  const initialArgs = process.argv.slice(3);
16
16
  // a restart must not reopen the browser tab, so it always carries --no-boot
@@ -1,9 +1,9 @@
1
- import { cliOut } from "../../cliOutput.js";
1
+ import { cliOut } from '../../cliOutput.js';
2
2
  const command = process.argv[2];
3
3
  cliOut(`Usage: tungsten <command> [options]
4
4
 
5
5
  Commands:
6
- dev Start dev mode [--no-boot] [--profile] [--profile-modules]
6
+ dev Start dev mode [--no-boot] [--clean] [--fresh] [--tests] [--profile] [--profile-modules]
7
7
  devmon Dev mode, auto-restarts on framework rebuilds (same options as dev)
8
8
  build Production build [--profile] [--profile-modules] [--quiet]
9
9
  start Start production server
@@ -1,5 +1,5 @@
1
- import { Framework } from "../../Framework.js";
2
- import { cliArgs } from "../args.js";
1
+ import { Framework } from '../../Framework.js';
2
+ import { cliArgs } from '../args.js';
3
3
  //import dotenv from 'dotenv'
4
4
  //dotenv.config({ path: '.private.env' })
5
5
  cliArgs({}); // accepts nothing but --help
@@ -1,7 +1,7 @@
1
1
  import open from 'open';
2
- import { getUserConfig } from "../../getUserConfig.js";
3
- import { StaticSiteServer } from "../../Servers/StaticSiteServer.js";
4
- import { cliArgs } from "../args.js";
2
+ import { getUserConfig } from '../../getUserConfig.js';
3
+ import { StaticSiteServer } from '../../Servers/StaticSiteServer.js';
4
+ import { cliArgs } from '../args.js';
5
5
  cliArgs({}); // accepts nothing but --help
6
6
  const staticServer = new StaticSiteServer(await getUserConfig());
7
7
  const staticServerLocation = await staticServer.start();