tungsten 0.4.14 → 0.5.0

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 (159) hide show
  1. package/dist/.build-complete +1 -1
  2. package/dist/.tsbuildinfo +1 -0
  3. package/dist/Components.d.ts +1 -0
  4. package/dist/Components.d.ts.map +1 -1
  5. package/dist/Components.js +2 -0
  6. package/dist/ContentNode.d.ts +8 -2
  7. package/dist/ContentNode.d.ts.map +1 -1
  8. package/dist/ContentNode.js +4 -1
  9. package/dist/Framework.js +4 -4
  10. package/dist/FrameworkConfig.d.ts +0 -2
  11. package/dist/FrameworkConfig.d.ts.map +1 -1
  12. package/dist/FunctionComponentStandIn.d.ts +1 -1
  13. package/dist/FunctionComponentStandIn.d.ts.map +1 -1
  14. package/dist/FunctionComponentStandIn.js +1 -0
  15. package/dist/Instance/Instance.js +2 -2
  16. package/dist/RenderingNode.d.ts +2 -2
  17. package/dist/RenderingNode.d.ts.map +1 -1
  18. package/dist/Script.d.ts +1 -1
  19. package/dist/Script.d.ts.map +1 -1
  20. package/dist/Servers/DevServer.d.ts.map +1 -1
  21. package/dist/Servers/DevServer.js +10 -0
  22. package/dist/Servers/loadEnvsDev.js +10 -10
  23. package/dist/Servers/routing.d.ts.map +1 -1
  24. package/dist/Servers/routing.js +8 -9
  25. package/dist/Store/makeStore.d.ts +4 -4
  26. package/dist/Store/makeStore.d.ts.map +1 -1
  27. package/dist/Store/makeStore.js +23 -57
  28. package/dist/babelPlugins/BabelTransformDocInit.d.ts +9 -0
  29. package/dist/babelPlugins/BabelTransformDocInit.d.ts.map +1 -0
  30. package/dist/babelPlugins/BabelTransformDocInit.js +201 -0
  31. package/dist/babelPlugins/BabelTransformPackageImports.d.ts.map +1 -1
  32. package/dist/babelPlugins/BabelTransformPackageImports.js +1 -10
  33. package/dist/bin/index.d.ts.map +1 -1
  34. package/dist/bin/index.js +82 -75
  35. package/dist/browserStorage.d.ts +56 -18
  36. package/dist/browserStorage.d.ts.map +1 -1
  37. package/dist/browserStorage.js +172 -102
  38. package/dist/build/bundle.d.ts +1 -1
  39. package/dist/build/bundle.d.ts.map +1 -1
  40. package/dist/build/bundle.js +45 -40
  41. package/dist/build/compileJavascript.d.ts.map +1 -1
  42. package/dist/build/compileJavascript.js +0 -1
  43. package/dist/build/makeBabelUserDevConfig.d.ts.map +1 -1
  44. package/dist/build/makeBabelUserDevConfig.js +5 -1
  45. package/dist/build/makeBabelUserProdConfig.d.ts.map +1 -1
  46. package/dist/build/makeBabelUserProdConfig.js +5 -1
  47. package/dist/cliOutput.d.ts +5 -0
  48. package/dist/cliOutput.d.ts.map +1 -1
  49. package/dist/cliOutput.js +22 -0
  50. package/dist/components/Link.d.ts +1 -1
  51. package/dist/components/Link.d.ts.map +1 -1
  52. package/dist/components/NativeHtml.d.ts +10 -0
  53. package/dist/components/NativeHtml.d.ts.map +1 -0
  54. package/dist/components/NativeHtml.js +12 -0
  55. package/dist/components/PopMessages.d.ts +1 -1
  56. package/dist/components/PopMessages.d.ts.map +1 -1
  57. package/dist/components/Protected.d.ts +10 -0
  58. package/dist/components/Protected.d.ts.map +1 -0
  59. package/dist/components/Protected.js +12 -0
  60. package/dist/components/Stylesheet.d.ts +1 -1
  61. package/dist/components/Stylesheet.d.ts.map +1 -1
  62. package/dist/components/bindable/BindableCheckbox.d.ts +1 -1
  63. package/dist/components/bindable/BindableCheckbox.d.ts.map +1 -1
  64. package/dist/components/bindable/BindableInput.d.ts +1 -1
  65. package/dist/components/bindable/BindableInput.d.ts.map +1 -1
  66. package/dist/components/bindable/BindableInputNonString.d.ts +1 -1
  67. package/dist/components/bindable/BindableInputNonString.d.ts.map +1 -1
  68. package/dist/components/bindable/BindableInputString.d.ts +1 -1
  69. package/dist/components/bindable/BindableInputString.d.ts.map +1 -1
  70. package/dist/components/bindable/BindableInputTyped.d.ts +1 -1
  71. package/dist/components/bindable/BindableInputTyped.d.ts.map +1 -1
  72. package/dist/components/bindable/BindableInputTypedLegacy.d.ts +1 -1
  73. package/dist/components/bindable/BindableInputTypedLegacy.d.ts.map +1 -1
  74. package/dist/components/bindable/BindableRadio.d.ts +1 -1
  75. package/dist/components/bindable/BindableRadio.d.ts.map +1 -1
  76. package/dist/components/bindable/BindableSelect.d.ts +1 -1
  77. package/dist/components/bindable/BindableSelect.d.ts.map +1 -1
  78. package/dist/components/bindable/BindableTextarea.d.ts +1 -1
  79. package/dist/components/bindable/BindableTextarea.d.ts.map +1 -1
  80. package/dist/components/library/RichTextEditor/RichTextEditor.d.ts +1 -1
  81. package/dist/components/library/RichTextEditor/RichTextEditor.d.ts.map +1 -1
  82. package/dist/components/library/RichTextEditor/contentTree.d.ts.map +1 -1
  83. package/dist/components/library/RichTextEditor/contentTree.js +2 -1
  84. package/dist/components/library/__StatefulMessage/StatefulMessage.d.ts +1 -1
  85. package/dist/components/library/__StatefulMessage/StatefulMessage.d.ts.map +1 -1
  86. package/dist/defaultConfig.d.ts.map +1 -1
  87. package/dist/defaultConfig.js +0 -1
  88. package/dist/devBanner.d.ts +4 -0
  89. package/dist/devBanner.d.ts.map +1 -0
  90. package/dist/devBanner.js +50 -0
  91. package/dist/docInit.d.ts +16 -0
  92. package/dist/docInit.d.ts.map +1 -0
  93. package/dist/docInit.js +54 -0
  94. package/dist/env/getEnvSchemas.d.ts +1 -1
  95. package/dist/env/getEnvSchemas.d.ts.map +1 -1
  96. package/dist/env/getEnvSchemas.js +21 -22
  97. package/dist/env/registerEnvSchemas.d.ts +13 -0
  98. package/dist/env/registerEnvSchemas.d.ts.map +1 -0
  99. package/dist/env/registerEnvSchemas.js +23 -0
  100. package/dist/frameworkConfigSchema.d.ts +0 -2
  101. package/dist/frameworkConfigSchema.d.ts.map +1 -1
  102. package/dist/frameworkConfigSchema.js +0 -1
  103. package/dist/hydrate/hydrate.d.ts.map +1 -1
  104. package/dist/hydrate/hydrate.js +11 -2
  105. package/dist/hydrate/renderHydrationMismatchBanner.d.ts +1 -0
  106. package/dist/hydrate/renderHydrationMismatchBanner.d.ts.map +1 -1
  107. package/dist/hydrate/renderHydrationMismatchBanner.js +11 -63
  108. package/dist/indexInner.d.ts +5 -1
  109. package/dist/indexInner.d.ts.map +1 -1
  110. package/dist/indexInner.js +5 -1
  111. package/dist/jsxRuntime.d.ts +1 -1
  112. package/dist/jsxRuntime.d.ts.map +1 -1
  113. package/dist/jsxRuntime.js +9 -7
  114. package/dist/jsxRuntimeSignals.d.ts +8 -4
  115. package/dist/jsxRuntimeSignals.d.ts.map +1 -1
  116. package/dist/jsxRuntimeSignals.js +8 -6
  117. package/dist/nbsp.d.ts +2 -2
  118. package/dist/nbsp.d.ts.map +1 -1
  119. package/dist/rawHtml/filterContentNode.d.ts.map +1 -1
  120. package/dist/rawHtml/filterContentNode.js +3 -1
  121. package/dist/render/HeadData.d.ts +1 -0
  122. package/dist/render/HeadData.d.ts.map +1 -1
  123. package/dist/render/contentNodeToHtml.d.ts.map +1 -1
  124. package/dist/render/contentNodeToHtml.js +2 -1
  125. package/dist/render/contentToHtml.d.ts.map +1 -1
  126. package/dist/render/contentToHtml.js +3 -1
  127. package/dist/render/contentTreeToRenderingTree.d.ts.map +1 -1
  128. package/dist/render/contentTreeToRenderingTree.js +5 -1
  129. package/dist/render/processHead.d.ts.map +1 -1
  130. package/dist/render/processHead.js +10 -0
  131. package/dist/render/readDocInitScript.d.ts +3 -0
  132. package/dist/render/readDocInitScript.d.ts.map +1 -0
  133. package/dist/render/readDocInitScript.js +15 -0
  134. package/dist/render/rootToHtmlDev.d.ts.map +1 -1
  135. package/dist/routing/Group.d.ts +1 -1
  136. package/dist/routing/Group.d.ts.map +1 -1
  137. package/dist/routing/MatchedRoute.d.ts +1 -1
  138. package/dist/routing/MatchedRoute.d.ts.map +1 -1
  139. package/dist/settings.d.ts +3 -0
  140. package/dist/settings.d.ts.map +1 -1
  141. package/dist/settings.js +4 -0
  142. package/dist/style/styleContentSxy.d.ts.map +1 -1
  143. package/dist/style/styleContentSxy.js +6 -1
  144. package/dist/testing/installTestDocInit.d.ts +2 -0
  145. package/dist/testing/installTestDocInit.d.ts.map +1 -0
  146. package/dist/testing/installTestDocInit.js +6 -0
  147. package/dist/throwError.d.ts.map +1 -1
  148. package/dist/throwError.js +4 -1
  149. package/dist/update/integrateUpdateVdom.d.ts.map +1 -1
  150. package/dist/update/integrateUpdateVdom.js +39 -3
  151. package/package.json +2 -1
  152. package/readme.md +2 -135
  153. package/types/assets.d.ts +21 -0
  154. package/types/index.d.ts +24 -29
  155. package/types/jsx/html.d.ts +0 -1
  156. package/types/jsx/html.global.d.ts +0 -1
  157. package/types/jsx/html.values.d.ts +0 -1
  158. package/types/jsx/jsx.d.ts +8 -8
  159. package/vendor/manifest.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"hydrate.d.ts","sourceRoot":"","sources":["../../src/hydrate/hydrate.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAQnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAmBxD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAM7C,OAAO,EACH,yBAAyB,EAC5B,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAmBlD,OAAO,EAC4B,KAAK,uBAAuB,EAC9D,MAAM,oCAAoC,CAAA;AAQ3C,OAAO,0BAA0B,CAAA;AASjC,MAAM,MAAM,WAAW,GAAG;IACtB,UAAU,EAAE,OAAO,CAAA;IACnB,UAAU,EAAE,uBAAuB,EAAE,CAAA;IAGrC,WAAW,EAAE,OAAO,CAAA;CACvB,CAAA;AACD,wBAAgB,sBAAsB,IAAI,WAAW,CAEpD;AAID,wBAAsB,OAAO,CACzB,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,yBAAyB,GAAG,IAAI,EAC/C,cAAc,EAAE,cAAc,iBA2DjC;AAyBD,wBAAsB,oBAAoB,CACt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,EAClB,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,WAAW,EAIjB,KAAK,GAAE,YAAY,CAAC,aAAa,CAAC,CAAC,OAAO,CAAM,EAAE,sJAAsJ;AACxM,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,SAAS,CAAC,EAAE,OAAO,GACpB,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,CA6DtC"}
@@ -1,7 +1,7 @@
1
1
  import { applyUpdate, integrateElementUpdateVdom } from '../update/integrateUpdateVdom.js';
2
2
  //import type { RouteType } from '../routing/RouteType.js'
3
3
  import { $number, $string, makeRenderedContentNodeNonRendered, makeRenderedContentNodeClassComponent, makeRenderedContentNodeFunctionComponent } from '../RenderedContentNode.js';
4
- import { ContentNodeElementIsHtml, ContentNodeIsHtml, ContentNodeIsComponent, ContentNodeComponentIsClassComponent, ContentNodeIsElement } from '../ContentNode.js';
4
+ import { ContentNodeElementIsHtml, ContentNodeIsHtml, ContentNodeIsComponent, ContentNodeComponentIsClassComponent, ContentNodeIsFragment, ContentNodeIsElement } from '../ContentNode.js';
5
5
  import { IsHTMLElement } from '../DomNodes.js';
6
6
  import { DomPointer } from '../DomPointer.js';
7
7
  import { DomRegion } from '../DomRegion.js';
@@ -31,6 +31,7 @@ import { reconcileHydratedAttributes } from './reconcileHydratedAttributes.js';
31
31
  import { markOptionSelected } from '../markOptionSelected.js';
32
32
  import { renderHydrationMismatchBanner } from './renderHydrationMismatchBanner.js';
33
33
  import { setCurrentInstance } from '../hmr/instanceRegistry.js';
34
+ import { renderDocInitErrorBanner } from '../docInit.js';
34
35
  // side-effect only: pulls applyHmrModule.js (and its clean, non-dynamic-import dependencies)
35
36
  // into the framework's traced dependency graph so it gets copied to .packages/ and is servable
36
37
  // to the browser. It is invoked from a raw, untraced inline script (processHead.ts) instead of
@@ -52,6 +53,9 @@ export function makeDefaultHydrateMeta() {
52
53
  }
53
54
  export async function hydrate(appRoutes, RootComponent, instanceConfig) {
54
55
  debug('hydrate start');
56
+ // first, before any component is built: a DocInit that threw in the head is on screen whatever
57
+ // happens next (a read of its value throws below). Rendered again at the end, for the count.
58
+ if (isDev) renderDocInitErrorBanner();
55
59
  //console.log('hydration global data ', __tungsten_global_data__)
56
60
  const location = window.location.pathname;
57
61
  const routes = typeof appRoutes === 'function' ? appRoutes(null) : appRoutes;
@@ -93,6 +97,7 @@ export async function hydrate(appRoutes, RootComponent, instanceConfig) {
93
97
  }
94
98
  instance.hydrationComplete = true;
95
99
  if (isDev) renderHydrationMismatchBanner(meta.mismatches);
100
+ if (isDev) renderDocInitErrorBanner();
96
101
  //// Can components update while hydrating is still taking place
97
102
  //// -- probably yes
98
103
  //// Can we pause any further update until hydration completes, to retain coherency?
@@ -371,6 +376,8 @@ async function hydrateFunctionComponent(node, parentElement, domPointer, instanc
371
376
  //// why don't we have html, nodes in here?
372
377
  async function hydrateNode(node, parentElement, domPointer, instance, meta) {
373
378
  debug('hydrateNode');
379
+ // a fragment hydrates as its children; the rendered side never holds one
380
+ if (ContentNodeIsFragment(node)) return hydrateNode(node[$props].children, parentElement, domPointer, instance, meta);
374
381
  if (Array.isArray(node)) {
375
382
  const renderedChildren = [];
376
383
  for (const arrayNode of node) {
@@ -384,7 +391,9 @@ async function hydrateNode(node, parentElement, domPointer, instance, meta) {
384
391
  }
385
392
  }
386
393
  //// why don't we have html, nodes in here?
387
- async function hydrateNodeSingle(node, parentElement, domPointer, instance, meta) {
394
+ async function hydrateNodeSingle(node,
395
+ // hydrateNode unwrapped any fragment
396
+ parentElement, domPointer, instance, meta) {
388
397
  debug('----hydrateNodeSingle');
389
398
  debug('node', `(${typeof node})`, typeof node === 'string' ? `"${node}"` : node);
390
399
  if (ContentNodeIsElement(node)) {
@@ -3,5 +3,6 @@ export type TaggedAttributeMismatch = AttributeMismatch & {
3
3
  tagName: string;
4
4
  };
5
5
  export declare const hydrationMismatchAttribute = "data-tungsten-hydration-mismatches";
6
+ export declare const hydrationMismatchBannerId = "tungsten-hydration-mismatches";
6
7
  export declare function renderHydrationMismatchBanner(mismatches: readonly TaggedAttributeMismatch[], doc?: Document): void;
7
8
  //# sourceMappingURL=renderHydrationMismatchBanner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderHydrationMismatchBanner.d.ts","sourceRoot":"","sources":["../../src/hydrate/renderHydrationMismatchBanner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AAEzE,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAA;AAI7E,eAAO,MAAM,0BAA0B,uCAAuC,CAAA;AA2C9E,wBAAgB,6BAA6B,CACzC,UAAU,EAAE,SAAS,uBAAuB,EAAE,EAC9C,GAAG,GAAE,QAAmB,GACzB,IAAI,CA4BN"}
1
+ {"version":3,"file":"renderHydrationMismatchBanner.d.ts","sourceRoot":"","sources":["../../src/hydrate/renderHydrationMismatchBanner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AAGzE,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAA;AAK7E,eAAO,MAAM,0BAA0B,uCAAuC,CAAA;AAE9E,eAAO,MAAM,yBAAyB,kCAAkC,CAAA;AAIxE,wBAAgB,6BAA6B,CACzC,UAAU,EAAE,SAAS,uBAAuB,EAAE,EAC9C,GAAG,GAAE,QAAmB,GACzB,IAAI,CAUN"}
@@ -1,69 +1,17 @@
1
- // Read by the CSS rule below via attr() - not by Tungsten. Exported so an
2
- // application that wants different styling can target the same selector.
1
+ import { renderDevBanner } from '../devBanner.js';
2
+ // The report as an attribute on <html>: a machine-readable hook (tests, tooling, app styling)
3
+ // that no Tungsten bookkeeping ever touches - updateAttributes diffs against its own record of
4
+ // what it last set, never the DOM's live attribute list, so this is never visited or removed.
3
5
  export const hydrationMismatchAttribute = 'data-tungsten-hydration-mismatches';
4
- const styleId = 'tungsten-hydration-mismatches-style';
5
- // Reports hydration mismatches in the page, not only the console, without
6
- // adding a real DOM node to the hydrated tree.
7
- //
8
- // A real element - even one appended after hydration finishes and never
9
- // touched again by this code - is not actually safe here. Every container
10
- // Tungsten re-renders gets a fresh `new DomRegion(containerDomNode)` built
11
- // from whatever is *actually* in its childNodes at that moment, and every
12
- // position Tungsten writes to next is a raw index into that same list
13
- // (DomPointer.get/next/prev, and several inline `childNodes[domPointer.index]`
14
- // reads in integrateUpdateVdom.ts/hydrate.tsx). An extra, untracked child
15
- // shifts every index after it, so the next update touching that container
16
- // - body, in a typical app - would compare and write to the wrong nodes.
17
- // There is no flag on an element that makes the walker skip it; it would
18
- // have to be built into DomPointer/DomRegion and every direct childNodes
19
- // access alongside them, which is a core-framework change, not a banner.
20
- //
21
- // Attributes are a different story: reconcileHydratedAttributes only runs
22
- // once, during hydration, before this ever runs, and every later update
23
- // (updateAttributes) diffs against domNode.__tungsten_oldAttributes - its
24
- // own private record of what it last set - never the DOM's live attribute
25
- // list. A plain setAttribute() here is in neither its old props nor its new
26
- // props, so it is never visited, and never removed.
27
- //
28
- // So: set an attribute on <html> (outside Tungsten's own bookkeeping, so
29
- // permanently untouched by it) and let a `content: attr(...)` pseudo-element
30
- // display it. A pseudo-element is not a real node - never in .childNodes,
31
- // never visited by DomPointer or DomRegion - so this carries zero index risk
32
- // for the app's own reconciliation, at the cost of one small, deliberately
33
- // hacky wrinkle: a single <style> tag inserted into <head> once.
34
- //
35
- // head is not structurally exempt from diffing in general - it currently
36
- // just never gets diffed node-by-node during hydration (hydrateNodeSingle's
37
- // 'head' case skips it outright, a known hack, not a guarantee), and nothing
38
- // in a typical app changes head's vdom children after mount, so the general
39
- // update path never exercises it either. That could change. What head does
40
- // already have is a marker for exactly this situation - data--t-persist,
41
- // used by processHead.ts for framework-injected head content (the entry
42
- // script, the component CSS link) that isn't part of the app's own vdom and
43
- // must survive hydration - so this style tag carries it too, rather than
44
- // riding on the blanket skip alone.
6
+ // The visible, selectable report. Exported so an application can restyle it.
7
+ export const hydrationMismatchBannerId = 'tungsten-hydration-mismatches';
8
+ // Reports hydration mismatches in the page, not only the console - see devBanner.ts for where
9
+ // and why the banner lives in <head>.
45
10
  export function renderHydrationMismatchBanner(mismatches, doc = document) {
46
11
  if (mismatches.length === 0) return;
47
- if (doc.getElementById(styleId) === null) {
48
- const style = doc.createElement('style');
49
- style.id = styleId;
50
- style.setAttribute('data--t-persist', 'true');
51
- style.textContent = `
52
- html[${hydrationMismatchAttribute}]::before {
53
- content: attr(${hydrationMismatchAttribute});
54
- display: block;
55
- background: #7a1f1f;
56
- color: #fff;
57
- font: 13px/1.5 monospace;
58
- padding: 8px 12px;
59
- max-height: 33vh;
60
- overflow: auto;
61
- white-space: pre-wrap;
62
- }
63
- `;
64
- doc.head.appendChild(style);
65
- }
66
12
  const heading = `Tungsten: ${mismatches.length} hydration mismatch${mismatches.length === 1 ? '' : 'es'} (dev only)`;
67
13
  const lines = mismatches.map(mismatch => `<${mismatch.tagName}> ${mismatch.name}: ` + `rendered ${JSON.stringify(mismatch.expected)}, server sent ${JSON.stringify(mismatch.actual)}`);
68
- doc.documentElement.setAttribute(hydrationMismatchAttribute, [heading, ...lines].join('\n'));
14
+ const report = [heading, ...lines].join('\n');
15
+ doc.documentElement.setAttribute(hydrationMismatchAttribute, report);
16
+ renderDevBanner(hydrationMismatchBannerId, report, doc);
69
17
  }
@@ -16,8 +16,10 @@ export * from './components/bindable/BindableTextarea.jsx';
16
16
  export * from './components/GoToComponent.jsx';
17
17
  export * from './components/Lazy.js';
18
18
  export * from './components/Link.jsx';
19
+ export * from './components/NativeHtml.jsx';
19
20
  export * from './components/PopMessages.jsx';
20
- export * from './components/RawHtml.jsx';
21
+ export * from './components/Protected.jsx';
22
+ export { RawHtml, type RawHtmlProps, RawHtml as ParseHtml, type RawHtmlProps as ParseHtmlProps } from './components/RawHtml.jsx';
21
23
  export * from './components/RouteRedirectComponent.jsx';
22
24
  export { parseHtml, type ParseHtmlOptions } from './rawHtml/parseHtml.js';
23
25
  export { safeHtmlAllowList } from './rawHtml/safeHtmlAllowList.js';
@@ -31,6 +33,7 @@ export { pop, dismissPop } from './pop.js';
31
33
  export * from './browserStorage.js';
32
34
  export { createElement } from './createElement.js';
33
35
  export * from './createRef.js';
36
+ export { docInit } from './docInit.js';
34
37
  export { foreach } from './foreach.js';
35
38
  export * from './helpers/index.js';
36
39
  export * from './hooks/index.js';
@@ -45,6 +48,7 @@ export { isProd } from './isProd.js';
45
48
  export { logAndReturn } from './logAndReturn.js';
46
49
  export * from './requests/index.js';
47
50
  export { registerGlobalData, type GlobalData, type GlobalDataFunction } from './routing/registerGlobalData.js';
51
+ export { registerPrivateEnvSchema, registerPublicEnvSchema, type PrivateEnvSchema, type PublicEnvSchema, } from './env/registerEnvSchemas.js';
48
52
  export * from './routing/MatchedRoute.js';
49
53
  export * from './routing/RedirectCode.js';
50
54
  export * from './routing/Route.jsx';
@@ -1 +1 @@
1
- {"version":3,"file":"indexInner.d.ts","sourceRoot":"","sources":["../src/indexInner.ts"],"names":[],"mappings":"AAEA,cAAc,qBAAqB,CAAA;AACnC,OAAO,EACH,uBAAuB,EAAE,uBAAuB,IAAI,eAAe,EAAE,mBAAmB;AACxF,yBAAyB,EAAE,yBAAyB,IAAI,iBAAiB,EAAE,qBAAqB;AAChG,wBAAwB,IAAI,0BAA0B,EAAE,wBAAwB,IAAI,kBAAkB,EAEtG,gCAAgC,EAAE,gCAAgC,IAAI,wBAAwB,EAC9F,kCAAkC,EAAE,kCAAkC,IAAI,0BAA0B,GACvG,MAAM,kBAAkB,CAAA;AAEzB,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAC1B,cAAc,uBAAuB,CAAA;AACrC,cAAc,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AE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AAC5E,YAAY,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAA;AAC3E,YAAY,EAAE,eAAe,EAAE,eAAe,IAAI,MAAM,EAAE,MAAM,sBAAsB,CAAA;AACtF,YAAY,EACR,0BAA0B,EAAE,0BAA0B,IAAI,SAAS,EACnE,gCAAgC,EAAE,gCAAgC,IAAI,eAAe,EACrF,cAAc,EACjB,MAAM,kBAAkB,CAAA;AACzB,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAG7C,mBAAmB,mBAAmB,CAAA"}
@@ -22,8 +22,10 @@ export * from "./components/bindable/BindableTextarea.js";
22
22
  export * from "./components/GoToComponent.js";
23
23
  export * from './components/Lazy.js';
24
24
  export * from "./components/Link.js";
25
+ export * from "./components/NativeHtml.js";
25
26
  export * from "./components/PopMessages.js";
26
- export * from "./components/RawHtml.js";
27
+ export * from "./components/Protected.js";
28
+ export { RawHtml, RawHtml as ParseHtml } from "./components/RawHtml.js";
27
29
  export * from "./components/RouteRedirectComponent.js";
28
30
  export { parseHtml } from './rawHtml/parseHtml.js';
29
31
  export { safeHtmlAllowList } from './rawHtml/safeHtmlAllowList.js';
@@ -36,6 +38,7 @@ export { pop, dismissPop } from './pop.js';
36
38
  export * from './browserStorage.js';
37
39
  export { createElement } from './createElement.js';
38
40
  export * from './createRef.js';
41
+ export { docInit } from './docInit.js'; // what BabelTransformDocInit rewrites DocInit() calls into; installs the DocInit global
39
42
  //export * from './env/funcs.js'
40
43
  //export * from './env/index.js'
41
44
  export { foreach } from './foreach.js';
@@ -56,6 +59,7 @@ export { logAndReturn } from './logAndReturn.js';
56
59
  export * from './requests/index.js';
57
60
  //export * from './zones/react.jsx'
58
61
  export { registerGlobalData } from './routing/registerGlobalData.js';
62
+ export { registerPrivateEnvSchema, registerPublicEnvSchema } from './env/registerEnvSchemas.js';
59
63
  export * from './routing/MatchedRoute.js';
60
64
  export * from './routing/RedirectCode.js';
61
65
  export * from "./routing/Route.js";
@@ -3,7 +3,7 @@ import type { KeyAttr } from './KeyAttr.js';
3
3
  import { type TungstenComponentGenericProps } from './Components.jsx';
4
4
  import { ContentNode } from './ContentNode.js';
5
5
  export * from './contentNodeSymbols.js';
6
- export declare const Fragment: 60107;
6
+ export declare const Fragment: symbol;
7
7
  export type JsxNodeType = string | AnyComponentType | typeof Fragment;
8
8
  export declare function jsx(type: JsxNodeType | string | number | boolean | null | undefined, props: TungstenComponentGenericProps, key: KeyAttr): ContentNode;
9
9
  export declare const jsxs: (...args: Parameters<typeof jsx>) => ContentNode;
@@ -1 +1 @@
1
- {"version":3,"file":"jsxRuntime.d.ts","sourceRoot":"","sources":["../src/jsxRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,KAAK,6BAA6B,EAAoD,MAAM,kBAAkB,CAAA;AACvH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAM9C,cAAc,yBAAyB,CAAA;AAGvC,eAAO,MAAM,QAAQ,EAAG,KAAe,CAAA;AAGvC,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,gBAAgB,GAAG,OAAO,QAAQ,CAAA;AAkBrE,wBAAgB,GAAG,CACf,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,EAChE,KAAK,EAAE,6BAA6B,EACpC,GAAG,EAAE,OAAO,GACb,WAAW,CAiFb;AAID,eAAO,MAAM,IAAI,GAAY,GAAG,MAAM,UAAU,CAAC,OAAO,GAAG,CAAC,gBAG3D,CAAA"}
1
+ {"version":3,"file":"jsxRuntime.d.ts","sourceRoot":"","sources":["../src/jsxRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,KAAK,6BAA6B,EAAoD,MAAM,kBAAkB,CAAA;AACvH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAM9C,cAAc,yBAAyB,CAAA;AAIvC,eAAO,MAAM,QAAQ,QAAY,CAAA;AAGjC,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,gBAAgB,GAAG,OAAO,QAAQ,CAAA;AAkBrE,wBAAgB,GAAG,CACf,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,EAChE,KAAK,EAAE,6BAA6B,EACpC,GAAG,EAAE,OAAO,GACb,WAAW,CAoFb;AAID,eAAO,MAAM,IAAI,GAAY,GAAG,MAAM,UAAU,CAAC,OAAO,GAAG,CAAC,gBAG3D,CAAA"}
@@ -1,11 +1,12 @@
1
1
  import { TungstenBaseComponent } from "./Components.js";
2
2
  import { TungstenError } from './TungstenError.js';
3
- import { $key, $props, $type } from './contentNodeSymbols.js';
3
+ import { $fragment, $key, $props, $type } from './contentNodeSymbols.js';
4
4
  import { packageNameCapitalized } from './settings.js';
5
5
  import { throwError } from './throwError.js';
6
6
  export * from './contentNodeSymbols.js';
7
7
  //import { inspect } from 'util'
8
- export const Fragment = 0xeacb; // code taken from react for fragments
8
+ // what the babel automatic runtime imports for `<>…</>`; the node it makes is unwrapped by the renderers
9
+ export const Fragment = $fragment;
9
10
  // (?outdated?) this doesn't seem to handle string/number/undefined correctly
10
11
  function classNameArrayToString(array) {
11
12
  let result = '';
@@ -47,10 +48,11 @@ export function jsx(type, props, key) {
47
48
  }
48
49
  //const { children, ...filteredProps } = props
49
50
  if (type === Fragment) {
50
- const {
51
- children
52
- } = props;
53
- return children;
51
+ return {
52
+ [$type]: $fragment,
53
+ [$props]: props,
54
+ [$key]: key
55
+ };
54
56
  }
55
57
  if (typeof type === 'function') {
56
58
  // element
@@ -88,7 +90,7 @@ export function jsx(type, props, key) {
88
90
  if (typeof type === 'number') {
89
91
  return String(type);
90
92
  }
91
- throw new TungstenError(`${packageNameCapitalized} JSX Runtime error: did not recognize element` + `, expected a string, function, class (type function), or fragment.` + ` Received type ${typeof type}: ${type}`);
93
+ throw new TungstenError(`${packageNameCapitalized} JSX Runtime error: did not recognize element` + `, expected a string, function, class (type function), or fragment.` + ` Received type ${typeof type}: ${String(type)}`);
92
94
  }
93
95
  // jsxs is used when children is an array instead of a single object
94
96
  // just use the same function for both
@@ -2,17 +2,21 @@ import type { AnyComponentType } from './AnyComponentType.js';
2
2
  import type { TungstenComponentGenericProps } from './Components.jsx';
3
3
  import type { KeyAttr } from './KeyAttr.js';
4
4
  export * from './contentNodeSymbols.js';
5
- export declare const Fragment: 60107;
5
+ export declare const Fragment: symbol;
6
6
  export type JsxNodeType = string | AnyComponentType | typeof Fragment;
7
7
  export declare const TypeSymbol: unique symbol;
8
- export declare function jsx(type: JsxNodeType | string | number | boolean | null | undefined, props: TungstenComponentGenericProps, key: KeyAttr): string | number | boolean | import("./ContentNode.js").ContentNodeHtml | import("./ContentNode.js").ContentNodeClassComponent | import("./ContentNode.js").ContentNodeFunctionComponent | import("./ContentNode.js").ContentNodeArray | {
9
- type: import("./Components.jsx").TungstenBaseComponentType<any, any> | import("./FunctionComponent.js").FunctionComponent<any, any>;
8
+ export declare function jsx(type: JsxNodeType | string | number | boolean | null | undefined, props: TungstenComponentGenericProps, key: KeyAttr): string | {
9
+ type: symbol;
10
+ props: TungstenComponentGenericProps;
11
+ key: KeyAttr;
12
+ } | {
13
+ type: AnyComponentType;
10
14
  props: TungstenComponentGenericProps;
11
15
  key: KeyAttr;
12
16
  } | {
13
17
  type: string;
14
18
  props: TungstenComponentGenericProps;
15
19
  key: KeyAttr;
16
- } | null | undefined;
20
+ } | null;
17
21
  export declare const jsxs: typeof jsx;
18
22
  //# sourceMappingURL=jsxRuntimeSignals.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsxRuntimeSignals.d.ts","sourceRoot":"","sources":["../src/jsxRuntimeSignals.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAI3C,cAAc,yBAAyB,CAAA;AAEvC,eAAO,MAAM,QAAQ,EAAG,KAAe,CAAA;AAEvC,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,gBAAgB,GAAG,OAAO,QAAQ,CAAA;AAGrE,eAAO,MAAM,UAAU,eAAiB,CAAA;AAcxC,wBAAgB,GAAG,CACf,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,EAChE,KAAK,EAAE,6BAA6B,EACpC,GAAG,EAAE,OAAO;;;;;;;;qBA+Df;AAID,eAAO,MAAM,IAAI,YAAM,CAAA"}
1
+ {"version":3,"file":"jsxRuntimeSignals.d.ts","sourceRoot":"","sources":["../src/jsxRuntimeSignals.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAK3C,cAAc,yBAAyB,CAAA;AAEvC,eAAO,MAAM,QAAQ,QAAY,CAAA;AAEjC,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,gBAAgB,GAAG,OAAO,QAAQ,CAAA;AAGrE,eAAO,MAAM,UAAU,eAAiB,CAAA;AAcxC,wBAAgB,GAAG,CACf,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,EAChE,KAAK,EAAE,6BAA6B,EACpC,GAAG,EAAE,OAAO;;;;;;;;;;;;SAkEf;AAID,eAAO,MAAM,IAAI,YAAM,CAAA"}
@@ -1,8 +1,9 @@
1
1
  import { TungstenError } from './TungstenError.js';
2
2
  import { packageNameCapitalized } from './settings.js';
3
3
  import { throwError } from './throwError.js';
4
+ import { $fragment } from './contentNodeSymbols.js';
4
5
  export * from './contentNodeSymbols.js';
5
- export const Fragment = 0xeacb; // code taken from react for fragments
6
+ export const Fragment = $fragment;
6
7
  //// TODO use this symbol for type
7
8
  export const TypeSymbol = Symbol('type');
8
9
  // (?outdated?) this doesn't seem to handle string/number/undefined correctly
@@ -35,10 +36,11 @@ export function jsx(type, props, key) {
35
36
  }
36
37
  //const { children, ...filteredProps } = props
37
38
  if (type === Fragment) {
38
- const {
39
- children
40
- } = props;
41
- return children;
39
+ return {
40
+ type,
41
+ props,
42
+ key
43
+ };
42
44
  }
43
45
  if (typeof type === 'function') {
44
46
  return {
@@ -65,7 +67,7 @@ export function jsx(type, props, key) {
65
67
  if (typeof type === 'number') {
66
68
  return String(type);
67
69
  }
68
- throw new TungstenError(`${packageNameCapitalized} JSX Runtime error: did not recognize element` + `, expected a string, function, class (type function), or fragment.` + ` Received type ${typeof type}: ${type}`);
70
+ throw new TungstenError(`${packageNameCapitalized} JSX Runtime error: did not recognize element` + `, expected a string, function, class (type function), or fragment.` + ` Received type ${typeof type}: ${String(type)}`);
69
71
  }
70
72
  // jsx func for static elements
71
73
  // not sure exactly what this is, just use the same func for now
package/dist/nbsp.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export declare const nbsp: import("./ContentNode.js").ContentNode;
2
- export declare const space: import("./ContentNode.js").ContentNode;
1
+ export declare const nbsp: import("./ContentNode.js").ContentNodeElement;
2
+ export declare const space: import("./ContentNode.js").ContentNodeElement;
3
3
  //# sourceMappingURL=nbsp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nbsp.d.ts","sourceRoot":"","sources":["../src/nbsp.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI,wCAAc,CAAA;AAC/B,eAAO,MAAM,KAAK,wCAAc,CAAA"}
1
+ {"version":3,"file":"nbsp.d.ts","sourceRoot":"","sources":["../src/nbsp.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI,+CAAc,CAAA;AAC/B,eAAO,MAAM,KAAK,+CAAc,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"filterContentNode.d.ts","sourceRoot":"","sources":["../../src/rawHtml/filterContentNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAa,MAAM,mBAAmB,CAAA;AAI/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAyFvD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,GAAG,WAAW,CAE1F"}
1
+ {"version":3,"file":"filterContentNode.d.ts","sourceRoot":"","sources":["../../src/rawHtml/filterContentNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAa,MAAM,mBAAmB,CAAA;AAI/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AA2FvD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,GAAG,WAAW,CAE1F"}
@@ -1,4 +1,4 @@
1
- import { ContentNodeIsComponent } from '../ContentNode.js';
1
+ import { ContentNodeIsComponent, ContentNodeIsFragment } from '../ContentNode.js';
2
2
  import { $props, $type } from '../contentNodeSymbols.js';
3
3
  import { StringIsHtmlEvent } from '../htmlEvents.js';
4
4
  import { blockedUrl, makeAllowCheck, removalFor, urlAttributes } from './parseHtml.js';
@@ -60,6 +60,8 @@ function filter(node, allow) {
60
60
  // rather than reachable: nothing that round-trips through storage (JSON)
61
61
  // can carry a class or function reference.
62
62
  if (ContentNodeIsComponent(node)) return node;
63
+ // parseHtml never produces a fragment either; one from JSX is just its children
64
+ if (ContentNodeIsFragment(node)) return filter(node[$props].children ?? null, allow);
63
65
  const tag = node[$type];
64
66
  const removal = removalFor(tag, true, allow);
65
67
  if (removal === 'drop') return null;
@@ -14,5 +14,6 @@ export type HeadData = {
14
14
  siteBasePath: SiteBasePath;
15
15
  hmr: boolean | 'reload';
16
16
  csr: boolean;
17
+ docInitScript?: string | undefined;
17
18
  };
18
19
  //# sourceMappingURL=HeadData.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HeadData.d.ts","sourceRoot":"","sources":["../../src/render/HeadData.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAE9D,MAAM,MAAM,YAAY,GAAG,EAAE,GAAG,IAAI,MAAM,EAAE,CAAA;AAE5C,MAAM,MAAM,QAAQ,GAAG;IACnB,KAAK,EAAE,OAAO,CAAA;IACd,QAAQ,EAAE,QAAQ,CAAC;IACnB,mBAAmB,EAAE,aAAa,CAAC;IACnC,aAAa,EAAE,aAAa,CAAC;IAC7B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,GAAG,EAAE,OAAO,CAAC;IACb,iBAAiB,EAAE,sBAAsB,CAAC;IAC1C,YAAY,EAAE,YAAY,CAAC;IAC3B,GAAG,EAAE,OAAO,GAAG,QAAQ,CAAA;IACvB,GAAG,EAAE,OAAO,CAAA;CACf,CAAA"}
1
+ {"version":3,"file":"HeadData.d.ts","sourceRoot":"","sources":["../../src/render/HeadData.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAE9D,MAAM,MAAM,YAAY,GAAG,EAAE,GAAG,IAAI,MAAM,EAAE,CAAA;AAE5C,MAAM,MAAM,QAAQ,GAAG;IACnB,KAAK,EAAE,OAAO,CAAA;IACd,QAAQ,EAAE,QAAQ,CAAC;IACnB,mBAAmB,EAAE,aAAa,CAAC;IACnC,aAAa,EAAE,aAAa,CAAC;IAC7B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,GAAG,EAAE,OAAO,CAAC;IACb,iBAAiB,EAAE,sBAAsB,CAAC;IAC1C,YAAY,EAAE,YAAY,CAAC;IAC3B,GAAG,EAAE,OAAO,GAAG,QAAQ,CAAA;IACvB,GAAG,EAAE,OAAO,CAAA;IAEZ,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACrC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"contentNodeToHtml.d.ts","sourceRoot":"","sources":["../../src/render/contentNodeToHtml.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAapD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CA+C3D"}
1
+ {"version":3,"file":"contentNodeToHtml.d.ts","sourceRoot":"","sources":["../../src/render/contentNodeToHtml.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAapD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAgD3D"}
@@ -1,4 +1,4 @@
1
- import { ContentNodeIsComponent } from '../ContentNode.js';
1
+ import { ContentNodeIsComponent, ContentNodeIsFragment } from '../ContentNode.js';
2
2
  import { booleanAttributeValue } from '../booleanAttributeValue.js';
3
3
  import { $props, $type } from '../contentNodeSymbols.js';
4
4
  import { htmlEntities } from '../htmlEntities.js';
@@ -28,6 +28,7 @@ export function contentNodeToHtml(node) {
28
28
  if (node === undefined || node === null || node === false || node === true) return '';
29
29
  if (Array.isArray(node)) return node.map(contentNodeToHtml).join('');
30
30
  if (typeof node === 'string' || typeof node === 'number') return htmlEntities(node.toString());
31
+ if (ContentNodeIsFragment(node)) return contentNodeToHtml(node[$props].children);
31
32
  if (ContentNodeIsComponent(node)) {
32
33
  throwError('contentNodeToHtml', `component nodes are not supported - encountered one of type ` + `${String(typeof node[$type] === 'string' ? node[$type] : node[$type].name)}.`);
33
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"contentToHtml.d.ts","sourceRoot":"","sources":["../../src/render/contentToHtml.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAK,EAAY,YAAY,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAIvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAG9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AAGrE,wBAAsB,aAAa,CAC/B,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,aAAa,EACpE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EACxC,MAAM,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,YAAY,EACnE,iBAAiB,GAAE,sBAAkC,EAAE,GAAG,UAAQ,GACnE,OAAO,CAAC,MAAM,CAAC,CAuDjB"}
1
+ {"version":3,"file":"contentToHtml.d.ts","sourceRoot":"","sources":["../../src/render/contentToHtml.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAK,EAAY,YAAY,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAIvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAI9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AAGrE,wBAAsB,aAAa,CAC/B,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,aAAa,EACpE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EACxC,MAAM,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,YAAY,EACnE,iBAAiB,GAAE,sBAAkC,EAAE,GAAG,UAAQ,GACnE,OAAO,CAAC,MAAM,CAAC,CAwDjB"}
@@ -2,6 +2,7 @@ import { renderingNodeToHtml } from './renderingTreeToHtml.js';
2
2
  import { TungstenError } from '../TungstenError.js';
3
3
  import { RenderingNodeIsElement } from '../RenderingNode.js';
4
4
  import { contentTreeToRenderingTree } from './contentTreeToRenderingTree.js';
5
+ import { readDocInitScript } from './readDocInitScript.js';
5
6
  import { cliWarn } from 'tungsten/cliOutput.js';
6
7
  export async function contentToHtml(compilationInfo, clientImportAliases, content, instance, config, siteBasePathOverride, tungstenPublicEnv = undefined, dev = false) {
7
8
  // const rootNode = { // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
@@ -25,7 +26,8 @@ export async function contentToHtml(compilationInfo, clientImportAliases, conten
25
26
  tungstenPublicEnv,
26
27
  siteBasePath: siteBasePathOverride,
27
28
  hmr: config.hmr,
28
- csr: config.csr
29
+ csr: config.csr,
30
+ docInitScript: readDocInitScript(compilationInfo.buildLocation)
29
31
  };
30
32
  //console.log('rendering tree', inspect(tree, { depth: 99 } ))
31
33
  let html = await renderingNodeToHtml(tree, false, headData, null);
@@ -1 +1 @@
1
- {"version":3,"file":"contentTreeToRenderingTree.d.ts","sourceRoot":"","sources":["../../src/render/contentTreeToRenderingTree.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EACH,KAAK,WAAW,EAEnB,MAAM,mBAAmB,CAAA;AAS1B,wBAAsB,0BAA0B,CAC5C,IAAI,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,GAAG,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,GAC9F,OAAO,CAAC,aAAa,CAAC,CA2EzB"}
1
+ {"version":3,"file":"contentTreeToRenderingTree.d.ts","sourceRoot":"","sources":["../../src/render/contentTreeToRenderingTree.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EACH,KAAK,WAAW,EAEnB,MAAM,mBAAmB,CAAA;AAS1B,wBAAsB,0BAA0B,CAC5C,IAAI,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,GAAG,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,GAC9F,OAAO,CAAC,aAAa,CAAC,CAgFzB"}
@@ -1,4 +1,4 @@
1
- import { ContentNodeIsLiteral, ContentNodeElementIsComponent, ContentNodeElementIsHtml } from '../ContentNode.js';
1
+ import { ContentNodeIsLiteral, ContentNodeElementIsComponent, ContentNodeElementIsHtml, ContentNodeIsFragment } from '../ContentNode.js';
2
2
  import { validChildren } from '../validChildren.js';
3
3
  import { debug } from './debug.js';
4
4
  import { throwError } from '../throwError.js';
@@ -25,6 +25,10 @@ export async function contentTreeToRenderingTree(node, parentComponent, instance
25
25
  if (ContentNodeIsLiteral(node)) {
26
26
  return node.toString();
27
27
  }
28
+ // a fragment renders as its children; the rendering tree never holds one
29
+ if (ContentNodeIsFragment(node)) {
30
+ return contentTreeToRenderingTree(node[$props].children, parentComponent, instance, noEscape);
31
+ }
28
32
  debug('typeof type', typeof node[$type]);
29
33
  if (ContentNodeElementIsHtml(node)) {
30
34
  processHtmlNode(node);
@@ -1 +1 @@
1
- {"version":3,"file":"processHead.d.ts","sourceRoot":"","sources":["../../src/render/processHead.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAK7C,OAAO,EAAE,oBAAoB,EAAqB,MAAM,qBAAqB,CAAA;AAQ7E,wBAAgB,WAAW,CACvB,QAAQ,EAAE,oBAAoB,EAC9B,QAAQ,EAAE,QAAQ,QA6IrB"}
1
+ {"version":3,"file":"processHead.d.ts","sourceRoot":"","sources":["../../src/render/processHead.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAK7C,OAAO,EAAE,oBAAoB,EAAqB,MAAM,qBAAqB,CAAA;AAQ7E,wBAAgB,WAAW,CACvB,QAAQ,EAAE,oBAAoB,EAC9B,QAAQ,EAAE,QAAQ,QAwJrB"}
@@ -50,6 +50,16 @@ export function processHead(headNode, headData) {
50
50
  };
51
51
  if (dev) scriptNode[$props].type = 'module';else scriptNode[$props].defer = true;
52
52
  headNode[$props].children.unshift(scriptNode);
53
+ // DocInit functions: a sync inline script, so they run before <body> and before the entry
54
+ if (headData.docInitScript !== undefined) {
55
+ headNode[$props].children.unshift({
56
+ [$type]: 'script',
57
+ [$props]: {
58
+ 'data--t-internal': undefined,
59
+ children: headData.docInitScript
60
+ }
61
+ });
62
+ }
53
63
  // public env
54
64
  if (dev) {
55
65
  if (headData.tungstenPublicEnv !== undefined) {
@@ -0,0 +1,3 @@
1
+ export declare function docInitFileLocation(buildLocation: string): string;
2
+ export declare function readDocInitScript(buildLocation: string): string | undefined;
3
+ //# sourceMappingURL=readDocInitScript.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readDocInitScript.d.ts","sourceRoot":"","sources":["../../src/render/readDocInitScript.ts"],"names":[],"mappings":"AAKA,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAEjE;AAID,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAM3E"}
@@ -0,0 +1,15 @@
1
+ import { existsSync, readFileSync } from 'fs';
2
+ import { join } from 'path';
3
+ import { clientFolder, docInitFile } from '../settings.js';
4
+ export function docInitFileLocation(buildLocation) {
5
+ return join(buildLocation, clientFolder, docInitFile);
6
+ }
7
+ // The generated head script, ready to inline; undefined when nothing uses DocInit. Read per render:
8
+ // the dev compile rewrites the file on every change, and it is a few lines.
9
+ export function readDocInitScript(buildLocation) {
10
+ const location = docInitFileLocation(buildLocation);
11
+ if (!existsSync(location)) return undefined;
12
+ const content = readFileSync(location, 'utf8').trim();
13
+ if (content === '') return undefined;
14
+ return content.replaceAll('</script', '<\\/script');
15
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"rootToHtmlDev.d.ts","sourceRoot":"","sources":["../../src/render/rootToHtmlDev.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAI,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,KAAI,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,KAAI,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,KAAI,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAGpE,wBAAsB,aAAa,CAC/B,eAAe,EAAE,eAAe,EAAG,mBAAmB,EAAE,aAAa,EACrE,kBAAkB,EAAE,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,uBAAuB,EACzF,kBAAkB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,YAAY,mBAMjF"}
1
+ {"version":3,"file":"rootToHtmlDev.d.ts","sourceRoot":"","sources":["../../src/render/rootToHtmlDev.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAI,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,KAAI,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,KAAI,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,KAAI,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAGpE,wBAAsB,aAAa,CAC/B,eAAe,EAAE,eAAe,EAAG,mBAAmB,EAAE,aAAa,EACrE,kBAAkB,EAAE,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,uBAAuB,EACzF,kBAAkB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,YAAY,mBAMjF"}
@@ -7,6 +7,6 @@ export type GroupProps = {
7
7
  data?: RouteDataFunction<any, any>;
8
8
  };
9
9
  export declare class Group extends TungstenSimpleComponent<GroupProps> {
10
- content: () => string | number | boolean | import("../ContentNode.js").ContentNodeHtml | import("../ContentNode.js").ContentNodeClassComponent | import("../ContentNode.js").ContentNodeFunctionComponent | import("../ContentNode.js").ContentNodeArray | null;
10
+ content: () => string | number | boolean | import("../ContentNode.js").ContentNodeHtml | import("../ContentNode.js").ContentNodeClassComponent | import("../ContentNode.js").ContentNodeFunctionComponent | import("../ContentNode.js").ContentNodeFragment | import("../ContentNode.js").ContentNodeArray | null;
11
11
  }
12
12
  //# sourceMappingURL=Group.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Group.d.ts","sourceRoot":"","sources":["../../src/routing/Group.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAE/D,MAAM,MAAM,UAAU,GAAG;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,WAAW,CAAA;IACtB,IAAI,CAAC,EAAE,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;CAErC,CAAA;AAED,qBAAa,KAAM,SAAQ,uBAAuB,CAAC,UAAU,CAAC;IAC1D,OAAO,yPAGN;CACJ"}
1
+ {"version":3,"file":"Group.d.ts","sourceRoot":"","sources":["../../src/routing/Group.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAE/D,MAAM,MAAM,UAAU,GAAG;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,WAAW,CAAA;IACtB,IAAI,CAAC,EAAE,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;CAErC,CAAA;AAED,qBAAa,KAAM,SAAQ,uBAAuB,CAAC,UAAU,CAAC;IAC1D,OAAO,2SAGN;CACJ"}
@@ -9,6 +9,6 @@ export type MatchedRouteProps = {
9
9
  };
10
10
  export declare class MatchedRoute extends TungstenSimpleInternalStoreComponent<MatchedRouteProps> {
11
11
  init: () => void;
12
- content: () => string | number | boolean | import("../ContentNode.js").ContentNodeHtml | import("../ContentNode.js").ContentNodeClassComponent | import("../ContentNode.js").ContentNodeFunctionComponent | import("../ContentNode.js").ContentNodeArray | null | undefined;
12
+ content: () => string | number | boolean | import("../ContentNode.js").ContentNodeHtml | import("../ContentNode.js").ContentNodeClassComponent | import("../ContentNode.js").ContentNodeFunctionComponent | import("../ContentNode.js").ContentNodeFragment | import("../ContentNode.js").ContentNodeArray | null | undefined;
13
13
  }
14
14
  //# sourceMappingURL=MatchedRoute.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MatchedRoute.d.ts","sourceRoot":"","sources":["../../src/routing/MatchedRoute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,oCAAoC,EAAE,MAAM,mBAAmB,CAAA;AACxE,OAAO,EAAE,WAAW,EAA0B,MAAM,mBAAmB,CAAA;AAIvE,MAAM,MAAM,iBAAiB,GAAG;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,WAAW,CAAA;IACtB,KAAK,CAAC,EAAE,aAAa,CAAA;CACxB,CAAA;AACD,qBAAa,YAAa,SAAQ,oCAAoC,CAAC,iBAAiB,CAAC;IACrF,IAAI,aAA4C;IAChD,OAAO,qQAaN;CACJ"}
1
+ {"version":3,"file":"MatchedRoute.d.ts","sourceRoot":"","sources":["../../src/routing/MatchedRoute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,oCAAoC,EAAE,MAAM,mBAAmB,CAAA;AACxE,OAAO,EAAE,WAAW,EAA0B,MAAM,mBAAmB,CAAA;AAIvE,MAAM,MAAM,iBAAiB,GAAG;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,WAAW,CAAA;IACtB,KAAK,CAAC,EAAE,aAAa,CAAA;CACxB,CAAA;AACD,qBAAa,YAAa,SAAQ,oCAAoC,CAAC,iBAAiB,CAAC;IACrF,IAAI,aAA4C;IAChD,OAAO,uTAaN;CACJ"}
@@ -21,6 +21,9 @@ export declare const componentCssFile = "ccss.css";
21
21
  export declare const frameworkCssFolder = ".tungstenCss";
22
22
  export declare const frameworkCssFile = "tungsten.css";
23
23
  export declare const packagesFolder = ".packages";
24
+ export declare const docInitFile = "docInit.js";
25
+ export declare const docInitWindowKey = "__t_docInit";
26
+ export declare const docInitErrorsWindowKey = "__t_docInitErrors";
24
27
  export declare const unusedStyleReporting: boolean;
25
28
  export declare const defaultBrowserTargets = "since 2020";
26
29
  export declare const packageName = "tungsten";
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,cAAc,CAAA;AACtC,eAAO,MAAM,gBAAgB,SAAS,CAAA;AACtC,eAAO,MAAM,mBAAmB,kBAAuB,CAAA;AACvD,eAAO,MAAM,cAAc,uBAA+C,CAAA;AAC1E,eAAO,MAAM,eAAe,mBAAwB,CAAA;AACpD,eAAO,MAAM,mBAAmB,wBAA2C,CAAA;AAG3E,eAAO,MAAM,iBAAiB,sBAA2B,CAAA;AACzD,eAAO,MAAM,kBAAkB,uBAA4B,CAAA;AAC3D,eAAO,MAAM,YAAY,2BAA+B,CAAA;AACxD,eAAO,MAAM,gBAAgB,yBAA8B,CAAA;AAC3D,eAAO,MAAM,mBAAmB,4BAAiC,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AAM,qBAAqB,cAAc,CAAA;AAEhD,eAAO,MAAM,iBAAiB,0BAA+B,CAAA;AAC7D,eAAO,MAAM,YAAY,WAAW,CAAA;AAEpC,eAAO,MAAM,YAAY,YAAY,CAAA;AACrC,eAAO,MAAM,YAAY,YAAY,CAAA;AACrC,eAAO,MAAM,YAAY,YAAY,CAAA;AACrC,eAAO,MAAM,YAAY,YAAY,CAAA;AACrC,eAAO,MAAM,kBAAkB,kBAAkB,CAAA;AACjD,eAAO,MAAM,gBAAgB,aAAa,CAAA;AAE1C,eAAO,MAAM,kBAAkB,iBAAiB,CAAA;AAChD,eAAO,MAAM,gBAAgB,iBAAiB,CAAA;AAC9C,eAAO,MAAM,cAAc,cAAc,CAAA;AAEzC,eAAO,MAAM,WAAW,eAAe,CAAA;AACvC,eAAO,MAAM,gBAAgB,gBAAgB,CAAA;AAC7C,eAAO,MAAM,sBAAsB,sBAAsB,CAAA;AAEzD,eAAO,MAAM,oBAAoB,EAAE,OAAe,CAAA;AAIlD,eAAO,MAAM,qBAAqB,eAAe,CAAA;AAEjD,eAAO,MAAM,WAAW,aAAa,CAAA;AACrC,eAAO,MAAM,sBAAsB,aAAa,CAAA;AAChD,eAAO,MAAM,qBAAqB,YAAY,CAAA;AAC9C,eAAO,MAAM,mBAAmB,SAAS,CAAA"}
package/dist/settings.js CHANGED
@@ -26,6 +26,10 @@ export const componentCssFile = 'ccss.css';
26
26
  export const frameworkCssFolder = '.tungstenCss';
27
27
  export const frameworkCssFile = 'tungsten.css';
28
28
  export const packagesFolder = '.packages';
29
+ // the head script BabelTransformDocInit generates, in clientFolder; the window key its entries live under
30
+ export const docInitFile = 'docInit.js';
31
+ export const docInitWindowKey = '__t_docInit';
32
+ export const docInitErrorsWindowKey = '__t_docInitErrors';
29
33
  export const unusedStyleReporting = false;
30
34
  // the production bundle's browser floor when the config sets no `targets`: a browserslist query
31
35
  // for every browser version released since 2020. Dev applies no floor at all.