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":"browserStorage.d.ts","sourceRoot":"","sources":["../src/browserStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAgBhD,qBAAa,oBAAoB,CAAC,YAAY,SAAS,MAAM;;IAEzD,GAAG,GAAI,CAAC,SAAS,MAAM,YAAY,GAAG,MAAM,EAAE,KAAK,CAAC,KAAG,YAAY,CAAC,CAAC,CAAC,GAAG,SAAS,CAIjF;IACD,GAAG,GAAI,CAAC,SAAS,MAAM,YAAY,GAAG,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,YAAY,CAAC,CAAC,CAAC,UAG3E;IACD,KAAK,aAKJ;IACD,GAAG,GAAI,OAAO,MAAM,mBAA4B;IAChD,IAAI,MAAM,WAAiC;IAC3C,MAAM,GAAI,CAAC,SAAS,MAAM,YAAY,GAAG,MAAM,EAAE,KAAK,CAAC,UAGtD;IACD,SAAS,GAAI,CAAC,SAAS,MAAM,YAAY,GAAG,MAAM,EAAE,SAAS,YAAY,EAAE,KAAK,CAAC,UAGhF;IACD,IAAI,GAAI,CAAC,SAAS,MAAM,YAAY,GAAG,MAAM,EAAE,SAAS,YAAY,EAAE,KAAK,CAAC,iCAI3E;CAeJ;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AAE,MAAM,CAAA;CAAE,CAAA;AAC/F,KAAK,eAAe,CAAC,MAAM,SAAS,MAAM,IAAI,qBAAqB,CAAC,MAAM,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,CAAA;AAEtG,wBAAgB,gBAAgB,CAAC,YAAY,SAAS,UAAU,CAAC,YAAY,CAAC,KAAK,oBAAoB,CAAC,YAAY,CAAC,CAAA;AACrH,wBAAgB,gBAAgB,CAAC,YAAY,SAAS,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,YAAY,CAAC,GAAG,oBAAoB,CAAC,YAAY,EAAE,KAAK,CAAC,CAAA;AAC7I,wBAAgB,gBAAgB,CAAC,YAAY,SAAS,MAAM,EAAE,OAAO,EAAE,eAAe,CAAC,YAAY,CAAC,GAAG,oBAAoB,CAAC,YAAY,CAAC,CAAA;AAMzI,wBAAgB,kBAAkB,CAAC,cAAc,SAAS,UAAU,CAAC,cAAc,CAAC,KAAK,sBAAsB,CAAC,cAAc,CAAC,CAAA;AAC/H,wBAAgB,kBAAkB,CAAC,cAAc,SAAS,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,cAAc,CAAC,GAAG,sBAAsB,CAAC,cAAc,EAAE,KAAK,CAAC,CAAA;AACvJ,wBAAgB,kBAAkB,CAAC,cAAc,SAAS,MAAM,EAAE,OAAO,EAAE,eAAe,CAAC,cAAc,CAAC,GAAG,sBAAsB,CAAC,cAAc,CAAC,CAAA"}
@@ -1,140 +1,210 @@
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1
4
  function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
2
5
  function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
3
6
  function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
7
+ function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
4
8
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
5
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
6
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
7
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
9
  import { isBrowser } from './isBrowser.js';
9
10
  import { throwError } from './throwError.js';
10
- class ServerStorage {
11
- constructor() {
12
- _defineProperty(this, "get", () => throwError('Browser Storage', 'Browser storage was accessed on the server'));
13
- _defineProperty(this, "set", () => throwError('Browser Storage', 'Browser storage was accessed on the server'));
14
- _defineProperty(this, "clear", () => throwError('Browser Storage', 'Browser storage was accessed on the server'));
15
- _defineProperty(this, "key", () => throwError('Browser Storage', 'Browser storage was accessed on the server'));
16
- _defineProperty(this, "delete", () => throwError('Browser Storage', 'Browser storage was accessed on the server'));
17
- _defineProperty(this, "subscribe", () => throwError('Browser Storage', 'Browser storage was accessed on the server'));
18
- _defineProperty(this, "sync", () => throwError('Browser Storage', 'Browser storage was accessed on the server'));
19
- }
20
- // @ts-expect-error -- TS wants the getter to return a value
21
- get length() {
22
- throwError('Browser Storage', 'Browser storage was accessed on the server');
23
- }
24
- }
11
+ export const rawTransformer = {
12
+ stringify: s => s,
13
+ parse: s => s
14
+ };
15
+ export const jsonTransformer = JSON;
16
+ // Missing: what get() adds for an absent key - `undefined`, or `never` once defaults are given
17
+ var _storage = /*#__PURE__*/new WeakMap();
25
18
  var _subscribers = /*#__PURE__*/new WeakMap();
19
+ var _keysByElement = /*#__PURE__*/new WeakMap();
20
+ var _transformer = /*#__PURE__*/new WeakMap();
21
+ var _defaults = /*#__PURE__*/new WeakMap();
22
+ var _host = /*#__PURE__*/new WeakMap();
23
+ var _relay = /*#__PURE__*/new WeakMap();
24
+ var _absent = /*#__PURE__*/new WeakMap();
26
25
  var _push = /*#__PURE__*/new WeakMap();
27
- export class TungstenLocalStorage {
28
- constructor() {
29
- _classPrivateFieldInitSpec(this, _subscribers, {});
26
+ export class TungstenBrowserStorage {
27
+ // host: the window whose `storage` events relay other windows' writes to this one's subscribers
28
+ constructor({
29
+ storage,
30
+ transformer,
31
+ defaults,
32
+ host = null
33
+ }) {
34
+ _classPrivateFieldInitSpec(this, _storage, void 0);
35
+ _classPrivateFieldInitSpec(this, _subscribers, new Map());
36
+ // the reverse index, so a deleted component can be dropped from every key it was on
37
+ _classPrivateFieldInitSpec(this, _keysByElement, new WeakMap());
38
+ _classPrivateFieldInitSpec(this, _transformer, void 0);
39
+ _classPrivateFieldInitSpec(this, _defaults, void 0);
40
+ _classPrivateFieldInitSpec(this, _host, void 0);
41
+ // the writing window gets no event; set()/delete()/clear() pushed there already
42
+ _classPrivateFieldInitSpec(this, _relay, event => {
43
+ if (event.storageArea !== _classPrivateFieldGet(_storage, this)) return;
44
+ if (event.key === null) {
45
+ // clear()
46
+ for (const key of _classPrivateFieldGet(_subscribers, this).keys()) _classPrivateFieldGet(_push, this).call(this, key, _classPrivateFieldGet(_absent, this).call(this, key));
47
+ return;
48
+ }
49
+ const key = event.key;
50
+ if (_classPrivateFieldGet(_subscribers, this).has(key)) {
51
+ // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
52
+ _classPrivateFieldGet(_push, this).call(this, key, event.newValue === null ? _classPrivateFieldGet(_absent, this).call(this, key) : _classPrivateFieldGet(_transformer, this).parse(event.newValue)); // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- the stored string, as get() parses it
53
+ }
54
+ });
55
+ // what an absent key reads as
56
+ _classPrivateFieldInitSpec(this, _absent, key => _classPrivateFieldGet(_defaults, this)?.[key]);
57
+ // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- Missing is never exactly when defaults were given
30
58
  _defineProperty(this, "get", key => {
31
- const v = localStorage.getItem(key);
32
- if (v === null) return undefined;else return JSON.parse(v);
59
+ const v = _classPrivateFieldGet(_storage, this).getItem(key);
60
+ if (v === null) return _classPrivateFieldGet(_absent, this).call(this, key);
61
+ return _classPrivateFieldGet(_transformer, this).parse(v); // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- what set() stored under the key
33
62
  });
34
63
  _defineProperty(this, "set", (key, value) => {
35
- localStorage.setItem(key, JSON.stringify(value));
64
+ _classPrivateFieldGet(_storage, this).setItem(key, _classPrivateFieldGet(_transformer, this).stringify(value));
36
65
  _classPrivateFieldGet(_push, this).call(this, key, value);
37
66
  });
38
67
  _defineProperty(this, "clear", () => {
39
- localStorage.clear();
40
- for (const key in _classPrivateFieldGet(_subscribers, this)) {
41
- _classPrivateFieldGet(_push, this).call(this, key, undefined); // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- TS is being a wanker about keys of object
42
- }
68
+ _classPrivateFieldGet(_storage, this).clear();
69
+ for (const key of _classPrivateFieldGet(_subscribers, this).keys()) _classPrivateFieldGet(_push, this).call(this, key, _classPrivateFieldGet(_absent, this).call(this, key));
43
70
  });
44
- _defineProperty(this, "key", index => localStorage.key(index));
71
+ _defineProperty(this, "key", index => _classPrivateFieldGet(_storage, this).key(index));
45
72
  _defineProperty(this, "delete", key => {
46
- localStorage.removeItem(key);
47
- _classPrivateFieldGet(_push, this).call(this, key, undefined);
73
+ _classPrivateFieldGet(_storage, this).removeItem(key);
74
+ _classPrivateFieldGet(_push, this).call(this, key, _classPrivateFieldGet(_absent, this).call(this, key));
48
75
  });
49
76
  _defineProperty(this, "subscribe", (element, key) => {
50
- const subs = _classPrivateFieldGet(_subscribers, this)[key] || (_classPrivateFieldGet(_subscribers, this)[key] = new Set());
77
+ let subs = _classPrivateFieldGet(_subscribers, this).get(key);
78
+ if (subs === undefined) _classPrivateFieldGet(_subscribers, this).set(key, subs = new Set());
51
79
  subs.add(element);
80
+ let keys = _classPrivateFieldGet(_keysByElement, this).get(element);
81
+ if (keys === undefined) {
82
+ _classPrivateFieldGet(_keysByElement, this).set(element, keys = new Set());
83
+ // first subscription: unsubscribe everything when the component is deleted. Function
84
+ // component stand-ins have no disposal (they are not persistent), so nothing to hook
85
+ if ('using' in element) element.using({
86
+ [Symbol.dispose]: () => this.unsubscribeAll(element)
87
+ });
88
+ }
89
+ keys.add(key);
90
+ });
91
+ _defineProperty(this, "unsubscribe", (element, key) => {
92
+ _classPrivateFieldGet(_subscribers, this).get(key)?.delete(element);
93
+ _classPrivateFieldGet(_keysByElement, this).get(element)?.delete(key);
94
+ });
95
+ _defineProperty(this, "unsubscribeAll", element => {
96
+ const keys = _classPrivateFieldGet(_keysByElement, this).get(element);
97
+ if (keys === undefined) return;
98
+ for (const key of keys) _classPrivateFieldGet(_subscribers, this).get(key)?.delete(element);
99
+ _classPrivateFieldGet(_keysByElement, this).delete(element);
52
100
  });
101
+ // get + subscribe: for use in content, so the component follows the key
53
102
  _defineProperty(this, "sync", (element, key) => {
54
- const subs = _classPrivateFieldGet(_subscribers, this)[key] || (_classPrivateFieldGet(_subscribers, this)[key] = new Set());
55
- subs.add(element);
103
+ this.subscribe(element, key);
56
104
  return this.get(key);
57
105
  });
58
106
  _classPrivateFieldInitSpec(this, _push, (key, value) => {
59
- const subs = _classPrivateFieldGet(_subscribers, this)[key];
60
- if (subs) {
61
- for (const element of subs) {
62
- if ('shouldStoreComponentUpdate' in element && element.shouldStoreComponentUpdate !== undefined) {
63
- // eslint-disable-line @typescript-eslint/no-unnecessary-condition -- the field can be declared yet unset
64
- if (!element.shouldStoreComponentUpdate(key, value)) {
65
- continue;
66
- }
67
- }
68
- //console.log('queueing storage update')
69
- element.__queueUpdate();
107
+ const subs = _classPrivateFieldGet(_subscribers, this).get(key);
108
+ if (subs === undefined) return;
109
+ for (const element of subs) {
110
+ if ('shouldStoreComponentUpdate' in element && element.shouldStoreComponentUpdate !== undefined) {
111
+ // eslint-disable-line @typescript-eslint/no-unnecessary-condition -- the field can be declared yet unset
112
+ if (!element.shouldStoreComponentUpdate(key, value)) continue;
70
113
  }
114
+ element.__queueUpdate();
71
115
  }
72
116
  });
117
+ _classPrivateFieldSet(_storage, this, storage);
118
+ _classPrivateFieldSet(_transformer, this, transformer);
119
+ _classPrivateFieldSet(_defaults, this, defaults);
120
+ _classPrivateFieldSet(_host, this, host);
121
+ host?.addEventListener('storage', _classPrivateFieldGet(_relay, this));
122
+ }
123
+ // drops the host listener and every subscriber; for tests that build storages per case
124
+ [Symbol.dispose]() {
125
+ _classPrivateFieldGet(_host, this)?.removeEventListener('storage', _classPrivateFieldGet(_relay, this));
126
+ _classPrivateFieldSet(_host, this, null);
127
+ _classPrivateFieldGet(_subscribers, this).clear();
73
128
  }
74
129
  get length() {
75
- return localStorage.length;
130
+ return _classPrivateFieldGet(_storage, this).length;
76
131
  }
77
132
  }
78
- export function makeLocalStorage() {
79
- // add messaging to explain if the storage is accessed on the server
80
- return isBrowser ? new TungstenLocalStorage() : new ServerStorage();
81
- }
82
- //export type TypedLocalStorage<L extends object> = ReturnType<typeof makeLocalStorage<L>>
83
- var _subscribers2 = /*#__PURE__*/new WeakMap();
84
- var _push2 = /*#__PURE__*/new WeakMap();
85
- export class TungstenSessionStorage {
86
- constructor() {
87
- _classPrivateFieldInitSpec(this, _subscribers2, {});
88
- _defineProperty(this, "get", key => {
89
- const v = sessionStorage.getItem(key);
90
- if (v === null) return undefined;else return JSON.parse(v);
91
- });
92
- _defineProperty(this, "set", (key, value) => {
93
- sessionStorage.setItem(key, JSON.stringify(value));
94
- _classPrivateFieldGet(_push2, this).call(this, key, value);
95
- });
96
- _defineProperty(this, "clear", () => {
97
- sessionStorage.clear();
98
- for (const key in _classPrivateFieldGet(_subscribers2, this)) {
99
- _classPrivateFieldGet(_push2, this).call(this, key, undefined); // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- TS is being a wanker about keys of object
100
- }
101
- });
102
- _defineProperty(this, "key", index => sessionStorage.key(index));
103
- _defineProperty(this, "delete", key => {
104
- sessionStorage.removeItem(key);
105
- _classPrivateFieldGet(_push2, this).call(this, key, undefined);
106
- });
107
- _defineProperty(this, "subscribe", (element, key) => {
108
- const subs = _classPrivateFieldGet(_subscribers2, this)[key] || (_classPrivateFieldGet(_subscribers2, this)[key] = new Set());
109
- subs.add(element);
133
+ export class TungstenLocalStorage extends TungstenBrowserStorage {
134
+ constructor(transformer, defaults) {
135
+ super({
136
+ storage: localStorage,
137
+ transformer,
138
+ defaults,
139
+ host: window
110
140
  });
111
- _defineProperty(this, "sync", (element, key) => {
112
- const subs = _classPrivateFieldGet(_subscribers2, this)[key] || (_classPrivateFieldGet(_subscribers2, this)[key] = new Set());
113
- subs.add(element);
114
- return this.get(key);
115
- });
116
- _classPrivateFieldInitSpec(this, _push2, (key, value) => {
117
- const subs = _classPrivateFieldGet(_subscribers2, this)[key];
118
- if (subs) {
119
- for (const element of subs) {
120
- if ('shouldStoreComponentUpdate' in element && element.shouldStoreComponentUpdate !== undefined) {
121
- // eslint-disable-line @typescript-eslint/no-unnecessary-condition -- the field can be declared yet unset
122
- if (!element.shouldStoreComponentUpdate(key, value)) {
123
- continue;
124
- }
125
- }
126
- //console.log('queueing storage update')
127
- element.__queueUpdate();
128
- }
129
- }
141
+ }
142
+ }
143
+ // sessionStorage is per tab, so its events only reach frames and windows opened from this tab
144
+ export class TungstenSessionStorage extends TungstenBrowserStorage {
145
+ constructor(transformer, defaults) {
146
+ super({
147
+ storage: sessionStorage,
148
+ transformer,
149
+ defaults,
150
+ host: window
130
151
  });
131
152
  }
153
+ }
154
+ const serverAccess = () => throwError('Browser Storage', 'Browser storage was accessed on the server');
155
+ // the server stand-in without defaults: every member throws, naming the cause
156
+ class ServerStorage {
157
+ constructor() {
158
+ _defineProperty(this, "get", serverAccess);
159
+ _defineProperty(this, "set", serverAccess);
160
+ _defineProperty(this, "clear", serverAccess);
161
+ _defineProperty(this, "key", serverAccess);
162
+ // nothing to release; disposing on the server is harmless
163
+ _defineProperty(this, "delete", serverAccess);
164
+ _defineProperty(this, "subscribe", serverAccess);
165
+ _defineProperty(this, "unsubscribe", serverAccess);
166
+ _defineProperty(this, "unsubscribeAll", serverAccess);
167
+ _defineProperty(this, "sync", serverAccess);
168
+ }
169
+ // @ts-expect-error -- TS wants the getter to return a value
170
+ get length() {
171
+ serverAccess();
172
+ }
173
+ [Symbol.dispose]() {}
174
+ }
175
+ // with defaults: reads answer from them and subscriptions are no-ops, so content that syncs a key
176
+ // renders the same way on both sides; writes still throw, since the server has nowhere to put them
177
+ var _defaults2 = /*#__PURE__*/new WeakMap();
178
+ class ServerDefaultsStorage {
179
+ constructor(defaults) {
180
+ _classPrivateFieldInitSpec(this, _defaults2, void 0);
181
+ _defineProperty(this, "get", key => _classPrivateFieldGet(_defaults2, this)[key]);
182
+ _defineProperty(this, "set", serverAccess);
183
+ _defineProperty(this, "clear", serverAccess);
184
+ _defineProperty(this, "key", () => null);
185
+ _defineProperty(this, "delete", serverAccess);
186
+ _defineProperty(this, "subscribe", () => {});
187
+ _defineProperty(this, "unsubscribe", () => {});
188
+ _defineProperty(this, "unsubscribeAll", () => {});
189
+ _defineProperty(this, "sync", (_element, key) => _classPrivateFieldGet(_defaults2, this)[key]);
190
+ _classPrivateFieldSet(_defaults2, this, defaults);
191
+ }
132
192
  get length() {
133
- return sessionStorage.length;
193
+ return 0;
134
194
  }
195
+ [Symbol.dispose]() {}
196
+ }
197
+ export function makeLocalStorage(options) {
198
+ const transformer = options?.transformer ?? rawTransformer; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- omittable only for an all-string schema
199
+ if (isBrowser) return new TungstenLocalStorage(transformer, options?.defaults);
200
+ return serverStorage(options); // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- the stand-in mirrors the members
135
201
  }
136
- export function makeSessionStorage() {
137
- // add messaging to explain if the storage is accessed on the server
138
- return isBrowser ? new TungstenSessionStorage() : new ServerStorage();
202
+ export function makeSessionStorage(options) {
203
+ const transformer = options?.transformer ?? rawTransformer; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- as above
204
+ if (isBrowser) return new TungstenSessionStorage(transformer, options?.defaults);
205
+ return serverStorage(options); // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- as above
139
206
  }
140
- //export type TypedSessionStorage<L extends object> = ReturnType<typeof makeSessionStorage<L>>
207
+ function serverStorage(options) {
208
+ const defaults = options?.serverDefaults ?? options?.defaults;
209
+ return defaults === undefined ? new ServerStorage() : new ServerDefaultsStorage(defaults);
210
+ }
@@ -1,2 +1,2 @@
1
- export declare function bundle(projectDir: string, quiet?: boolean, targets?: string | string[]): Promise<unknown>;
1
+ export declare function bundle(projectDir: string, quiet?: boolean, targets?: string | string[]): Promise<void>;
2
2
  //# sourceMappingURL=bundle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/build/bundle.ts"],"names":[],"mappings":"AAWA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,UAAQ,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,oBAyD1F"}
1
+ {"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/build/bundle.ts"],"names":[],"mappings":"AAeA,wBAAgB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,UAAQ,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAiDpG"}
@@ -1,52 +1,57 @@
1
+ import { spawn } from 'child_process';
2
+ import { createRequire } from 'module';
1
3
  import { join } from 'path';
2
- //import type { FrameworkConfigComplete } from '../FrameworkConfig.js'
3
4
  import { findProjectDir } from '../findProjectDir.js';
4
- import { spawnShellCommand } from '../spawnShellCommand.js';
5
5
  import { prodBuildFolder, bundleFolder, frameworkDistFolder, clientFolder } from '../settings.js';
6
- import { errorOut } from '../output.js';
7
6
  import { cliLog, cliOut } from '../cliOutput.js';
7
+ import { TungstenError } from '../TungstenError.js';
8
+ // rollup's cli entry from tungsten's own dependency, rather than whatever `npx rollup` would find
9
+ const rollupBin = createRequire(import.meta.url).resolve('rollup/dist/bin/rollup');
10
+ const quoteArg = arg => arg.includes(' ') ? `"${arg}"` : arg;
8
11
  // targets: the config's browser floor for rollup's babel step, undefined for the framework default
9
- export async function bundle(projectDir, quiet = false, targets) {
12
+ export function bundle(projectDir, quiet = false, targets) {
13
+ if (!quiet) cliOut('Bundling application');
14
+ const frameworkDir = findProjectDir(import.meta.url);
15
+ const entryFile = join(projectDir, prodBuildFolder, clientFolder, 'client.js');
16
+ const outFile = join(projectDir, bundleFolder, 'client.js');
17
+ const configFile = join(frameworkDir, frameworkDistFolder, 'build/rollup.user.prod.config.js');
18
+ const args = [rollupBin, '--input', entryFile, '--file', outFile, '--config', configFile, '--inlineDynamicImports', '--format', 'iife'];
19
+ // the rollup config reads this back; a browserslist query can hold commas, which rollup's own
20
+ // --environment flag would split on
21
+ const targetsJson = targets === undefined ? undefined : JSON.stringify(targets);
22
+ const env = targetsJson === undefined ? process.env : {
23
+ ...process.env,
24
+ TUNGSTEN_TARGETS: targetsJson
25
+ };
26
+ // runnable by hand from anywhere - every path is absolute - which is how a bundling failure gets
27
+ // debugged, so it goes in the failure message as well as the log
28
+ const commandLine = [process.execPath, ...args].map(quoteArg).join(' ') + (targetsJson === undefined ? '' : `\n with TUNGSTEN_TARGETS=${targetsJson} in the environment`);
29
+ if (!quiet) cliLog('bundle command:', commandLine);
10
30
  return new Promise((resolve, reject) => {
11
- if (!quiet) cliOut('Bundling application');
12
- const frameworkDir = findProjectDir(import.meta.url);
13
- // if (appConfig.useRootComponent) {
14
- // let rootComponent = appConfig.rootComponent as string
15
- // if (rootComponent.endsWith('.jsx')) rootComponent = rootComponent.slice(0, -1)
16
- // }
17
- const externalModules = [
18
- //'node-fetch'
19
- ];
20
- const includeCd = true; // the command runs in the framework dir so
21
- // does not need to cd to it - but keeping
22
- // the cd lets the command be run from the
23
- // consuming project folder, which is useful
24
- // for debugging, which is basically why we
25
- // print it to begin with.
26
- const entryFile = join(projectDir, prodBuildFolder, clientFolder, 'client.js');
27
- const outFile = join(projectDir, bundleFolder, 'client.js');
28
- const configFile = join(frameworkDir, frameworkDistFolder, 'build/rollup.user.prod.config.js');
29
- const command = (includeCd ? `cd "${frameworkDir}" && ` : '') + `npx rollup` + ` --input "${entryFile}"` + ` --file "${outFile}"` + ` --config "${configFile}"` + (externalModules.length > 0 ? ` --external ${externalModules.join(',')}` : ``) + ` --inlineDynamicImports --format iife`;
30
- if (!quiet) cliLog('bundle command:', command);
31
- // the rollup config reads this back; a browserslist query can hold commas, which rollup's own
32
- // --environment flag would split on
33
- const env = targets === undefined ? process.env : {
34
- ...process.env,
35
- TUNGSTEN_TARGETS: JSON.stringify(targets)
36
- };
37
- const subProcess = spawnShellCommand(command, {
38
- cwd: frameworkDir,
39
- env
31
+ // No cwd: the paths are absolute, and on Windows a cwd over 260 chars fails the spawn with
32
+ // ENOENT, which the framework dir reached under a deep project's pnpm store. No shell: node
33
+ // runs the bin directly, so there is no cmd.exe to find and no quoting to get wrong.
34
+ const child = spawn(process.execPath, args, {
35
+ env,
36
+ stdio: ['ignore', 'pipe', 'pipe']
40
37
  });
41
- subProcess.on('data', data => {
42
- if (!quiet) cliLog(data);
38
+ // rollup writes its progress and its errors to stderr; kept for the failure message
39
+ let stderr = '';
40
+ child.stdout.on('data', data => {
41
+ if (!quiet) process.stdout.write(data);
43
42
  });
44
- subProcess.on('close', (code, message) => {
45
- if (code === 0) resolve(null);else {
46
- // can we show teh error message? Only getting err code now I think
47
- errorOut(`bundle process failed with code ${code}, message "${message}"`);
48
- reject(code);
43
+ child.stderr.on('data', data => {
44
+ stderr += data.toString();
45
+ if (!quiet) process.stderr.write(data);
46
+ });
47
+ const fail = what => reject(new TungstenError(`Bundling failed - rollup ${what}\n${stderr.trim()}\nTo run it by hand: ${commandLine}`));
48
+ child.on('error', e => fail(`could not be started: ${e.message}`));
49
+ child.on('close', (code, signal) => {
50
+ if (code === 0) {
51
+ resolve();
52
+ return;
49
53
  }
54
+ fail(code === null ? `was ended by signal ${String(signal)}` : `exited with code ${code}`);
50
55
  });
51
56
  });
52
57
  }
@@ -1 +1 @@
1
- {"version":3,"file":"compileJavascript.d.ts","sourceRoot":"","sources":["../../src/build/compileJavascript.ts"],"names":[],"mappings":"AAGA,OAAO,QAAQ,MAAM,UAAU,CAAA;AAO/B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAmBtC,KAAK,uBAAuB,GAAG;IAC3B,OAAO,EAAE,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAA;IAClC,WAAW,EAAE,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAA;IACtC,aAAa,EAAE,aAAa,CAAA;IAC5B,cAAc,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACrC,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,MAAM,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;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AAA;CAC1B,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACrC,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,MAAM,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACnC,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAE5B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IAEzB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,eAAe,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,0BAA0B,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CAAA;IAE3F,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf,KAAK,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAuBD,wBAAsB,iBAAiB,CACnC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,uBAAuB,EACtD,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EACrE,aAAa,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,UAAO,EAC1E,OAAO,GAAE,wBAA6B,GACvC,OAAO,CAAC,uBAAuB,CAAC,CA2gBlC"}
@@ -272,7 +272,6 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
272
272
  ignored.push(...testPatterns.map(fromCodeDir));
273
273
  }
274
274
  }
275
- if (appConfig.exclude !== undefined) ignored.push(slash(`${codeLocation}/${appConfig.exclude}`));
276
275
  // Which sources each pipeline compiles. Unset, client is everything and raw is nothing; a file
277
276
  // may be in both. Dirs and patterns are relative to codeDir. The ignores are not applied
278
277
  // here - every file that reaches isClient/isRaw has already passed them, in the initial glob
@@ -1 +1 @@
1
- {"version":3,"file":"makeBabelUserDevConfig.d.ts","sourceRoot":"","sources":["../../src/build/makeBabelUserDevConfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAInD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,OAAO,EAAoC,eAAe,EAAE,MAAM,iDAAiD,CAAA;AAOnH,wBAAgB,sBAAsB,CAClC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,OAAO,EACnB,kBAAkB,EAAE,MAAM,EAC1B,aAAa,EAAE,MAAM,EACrB,iBAAiB,EAAE,MAAM,EACzB,qBAAqB,EAAE,MAAM,EAC7B,mBAAmB,EAAE,MAAM,GAAG,SAAS,EACvC,KAAK,EAAE,OAAO,EACd,2BAA2B,EAAE,WAAW,CAAC,MAAM,CAAC,EAChD,kBAAkB,EAAE,eAAe,EACnC,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,EACxB,WAAW,UAAO,EAClB,GAAG,UAAQ,EACX,QAAQ,UAAO,GAChB,gBAAgB,CA4ClB"}
1
+ {"version":3,"file":"makeBabelUserDevConfig.d.ts","sourceRoot":"","sources":["../../src/build/makeBabelUserDevConfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAInD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,OAAO,EAAoC,eAAe,EAAE,MAAM,iDAAiD,CAAA;AAQnH,wBAAgB,sBAAsB,CAClC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,OAAO,EACnB,kBAAkB,EAAE,MAAM,EAC1B,aAAa,EAAE,MAAM,EACrB,iBAAiB,EAAE,MAAM,EACzB,qBAAqB,EAAE,MAAM,EAC7B,mBAAmB,EAAE,MAAM,GAAG,SAAS,EACvC,KAAK,EAAE,OAAO,EACd,2BAA2B,EAAE,WAAW,CAAC,MAAM,CAAC,EAChD,kBAAkB,EAAE,eAAe,EACnC,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,EACxB,WAAW,UAAO,EAClB,GAAG,UAAQ,EACX,QAAQ,UAAO,GAChB,gBAAgB,CA6ClB"}
@@ -3,9 +3,10 @@ import { objectCopy } from 'sxy-lib-object-copy';
3
3
  import { join } from 'path';
4
4
  import { MakeBabelTransformComponentStyles } from '../babelPlugins/BabelTransformComponentStyles.js';
5
5
  import { MakeBabelTransformPackageImports } from '../babelPlugins/BabelTransformPackageImports.js';
6
- import { componentCssFolder, componentCssFile } from '../settings.js';
6
+ import { componentCssFolder, componentCssFile, clientFolder, docInitFile } from '../settings.js';
7
7
  import userCommonConfig, { typescriptPreset } from './babel.user.common.config.js';
8
8
  import { MakeBabelTransformCssImports } from '../babelPlugins/BabelTransformCssImports.js';
9
+ import { MakeBabelTransformDocInit } from '../babelPlugins/BabelTransformDocInit.js';
9
10
  import { MakeBabelAddDevCacheBust } from '../babelPlugins/BabelAddDevCacheBust.js';
10
11
  export function makeBabelUserDevConfig(projectDir, absCodeDir, absSourceDir, typescript, absStyleImportBase, buildLocation, buildCodeLocation, packagesCacheLocation, stylesCacheLocation, fresh, skipPackageCompilationFiles, oldDependencyGraph, dependencyGraph, importAliases, promises, watchStyles = true, hmr = false, packages = true) {
11
12
  const userDevConfig = objectCopy(userCommonConfig);
@@ -38,6 +39,9 @@ export function makeBabelUserDevConfig(projectDir, absCodeDir, absSourceDir, typ
38
39
  watch: watchStyles,
39
40
  cacheDir: stylesCacheLocation,
40
41
  freshCache: fresh
42
+ }), MakeBabelTransformDocInit({
43
+ outputFile: join(buildLocation, clientFolder, docInitFile),
44
+ projectDir
41
45
  }));
42
46
  if (hmr) userDevConfig.plugins.push(
43
47
  // Dev-only: keeps every relative import's browser-cached URL in sync with the
@@ -1 +1 @@
1
- {"version":3,"file":"makeBabelUserProdConfig.d.ts","sourceRoot":"","sources":["../../src/build/makeBabelUserProdConfig.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAMnD,wBAAgB,uBAAuB,CACnC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,OAAO,EACnB,kBAAkB,EAAE,MAAM,EAC1B,WAAW,UAAO,GACnB,gBAAgB,CAqBlB"}
1
+ {"version":3,"file":"makeBabelUserProdConfig.d.ts","sourceRoot":"","sources":["../../src/build/makeBabelUserProdConfig.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAOnD,wBAAgB,uBAAuB,CACnC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,OAAO,EACnB,kBAAkB,EAAE,MAAM,EAC1B,WAAW,UAAO,GACnB,gBAAgB,CAsBlB"}
@@ -2,9 +2,10 @@
2
2
  import { objectCopy } from 'sxy-lib-object-copy';
3
3
  import { join } from 'path';
4
4
  import { MakeBabelTransformComponentStyles } from '../babelPlugins/BabelTransformComponentStyles.js';
5
- import { prodBuildFolder, componentCssFolder, componentCssFile } from '../settings.js';
5
+ import { prodBuildFolder, componentCssFolder, componentCssFile, clientFolder, docInitFile } from '../settings.js';
6
6
  import userCommonConfig, { typescriptPreset } from './babel.user.common.config.js';
7
7
  import { MakeBabelTransformCssImports } from '../babelPlugins/BabelTransformCssImports.js';
8
+ import { MakeBabelTransformDocInit } from '../babelPlugins/BabelTransformDocInit.js';
8
9
  export function makeBabelUserProdConfig(projectDir, absCodeDir, absSourceDir, typescript, absStyleImportBase, watchStyles = true) {
9
10
  const userProdConfig = objectCopy(userCommonConfig);
10
11
  if (typescript) userProdConfig.presets.push(typescriptPreset()); // eslint-disable-line @typescript-eslint/no-non-null-assertion
@@ -26,6 +27,9 @@ export function makeBabelUserProdConfig(projectDir, absCodeDir, absSourceDir, ty
26
27
  cssOutputFile: join(projectDir, prodBuildFolder, componentCssFolder, componentCssFile),
27
28
  // should only need to pass one
28
29
  watch: watchStyles
30
+ }), MakeBabelTransformDocInit({
31
+ outputFile: join(projectDir, prodBuildFolder, clientFolder, docInitFile),
32
+ projectDir
29
33
  }));
30
34
  return userProdConfig;
31
35
  }
@@ -8,4 +8,9 @@ export declare function cliAlert(...texts: unknown[]): void;
8
8
  export declare function cliWarn(...texts: unknown[]): void;
9
9
  export declare function cliError(...texts: unknown[]): void;
10
10
  export declare function cliTodo(...texts: unknown[]): void;
11
+ export declare function fatalErrorParts(error: unknown): {
12
+ headline: string;
13
+ trace: string;
14
+ };
15
+ export declare function cliFatal(error: unknown): void;
11
16
  //# sourceMappingURL=cliOutput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cliOutput.d.ts","sourceRoot":"","sources":["../src/cliOutput.ts"],"names":[],"mappings":"AAMA,wBAAgB,MAAM,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,QAGzC;AAGD,wBAAgB,OAAO,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,QAE1C;AACD,wBAAgB,MAAM,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,QAEzC;AACD,wBAAgB,QAAQ,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,QAE3C;AACD,wBAAgB,OAAO,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,QAE1C;AACD,wBAAgB,OAAO,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,QAE1C;AACD,wBAAgB,QAAQ,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,QAE3C;AACD,wBAAgB,OAAO,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,QAE1C;AACD,wBAAgB,QAAQ,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,QAE3C;AACD,wBAAgB,OAAO,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,QAE1C"}
1
+ {"version":3,"file":"cliOutput.d.ts","sourceRoot":"","sources":["../src/cliOutput.ts"],"names":[],"mappings":"AAMA,wBAAgB,MAAM,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,QAGzC;AAGD,wBAAgB,OAAO,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,QAE1C;AACD,wBAAgB,MAAM,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,QAEzC;AACD,wBAAgB,QAAQ,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,QAE3C;AACD,wBAAgB,OAAO,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,QAE1C;AACD,wBAAgB,OAAO,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,QAE1C;AACD,wBAAgB,QAAQ,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,QAE3C;AACD,wBAAgB,OAAO,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,QAE1C;AACD,wBAAgB,QAAQ,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,QAE3C;AACD,wBAAgB,OAAO,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,QAE1C;AAID,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAInF;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,QAItC"}
package/dist/cliOutput.js CHANGED
@@ -32,4 +32,26 @@ export function cliError(...texts) {
32
32
  }
33
33
  export function cliTodo(...texts) {
34
34
  console.log(...['ToDo:', ...texts].map(t => chalk.yellow(t)));
35
+ }
36
+ // the headline is name + message, whole - a TungstenError's message spans lines; the trace is the
37
+ // frames alone, so the headline is not printed twice
38
+ export function fatalErrorParts(error) {
39
+ if (!(error instanceof Error)) return {
40
+ headline: String(error),
41
+ trace: ''
42
+ };
43
+ const frames = (error.stack ?? '').split('\n').filter(line => line.startsWith(' at '));
44
+ return {
45
+ headline: `${error.name}: ${error.message}`,
46
+ trace: frames.join('\n')
47
+ };
48
+ }
49
+ // a command that dies: red headline, dimmed frames, in place of node's uncaught-exception dump
50
+ export function cliFatal(error) {
51
+ const {
52
+ headline,
53
+ trace
54
+ } = fatalErrorParts(error);
55
+ console.log(chalk.brightred(headline));
56
+ if (trace !== '') console.log(chalk.mediumgrey(trace));
35
57
  }
@@ -9,6 +9,6 @@ export type LinkProps = {
9
9
  export declare class Link extends TungstenSimpleComponent<LinkProps> {
10
10
  href: string;
11
11
  click: (event: AnchorMouseEvent) => void;
12
- content: () => ContentNode;
12
+ content: () => import("../ContentNode.js").ContentNodeElement;
13
13
  }
14
14
  //# sourceMappingURL=Link.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/components/Link.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAG3D,MAAM,MAAM,SAAS,GAAG;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9B,EAAE,EAAE,IAAI,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,WAAW,CAAA;CACxB,CAAA;AAED,qBAAa,IAAK,SAAQ,uBAAuB,CAAC,SAAS,CAAC;IACxD,IAAI,SAIe;IACnB,KAAK,GAAI,OAAO,gBAAgB,UAgB/B;IACD,OAAO,oBAUN;CACJ"}
1
+ {"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/components/Link.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAG3D,MAAM,MAAM,SAAS,GAAG;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9B,EAAE,EAAE,IAAI,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,WAAW,CAAA;CACxB,CAAA;AAED,qBAAa,IAAK,SAAQ,uBAAuB,CAAC,SAAS,CAAC;IACxD,IAAI,SAIe;IACnB,KAAK,GAAI,OAAO,gBAAgB,UAgB/B;IACD,OAAO,uDAUN;CACJ"}
@@ -0,0 +1,10 @@
1
+ import type { ContentNodeHtml } from '../indexInner.js';
2
+ import { TungstenSimpleComponent } from '../Components.jsx';
3
+ export interface NativeHtmlProps {
4
+ children: ContentNodeHtml | ContentNodeHtml[];
5
+ }
6
+ export declare class NativeHtml extends TungstenSimpleComponent<NativeHtmlProps> {
7
+ static __opaque: boolean;
8
+ content: () => ContentNodeHtml | ContentNodeHtml[];
9
+ }
10
+ //# sourceMappingURL=NativeHtml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeHtml.d.ts","sourceRoot":"","sources":["../../src/components/NativeHtml.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAE3D,MAAM,WAAW,eAAe;IAC5B,QAAQ,EAAE,eAAe,GAAG,eAAe,EAAE,CAAA;CAChD;AAGD,qBAAa,UAAW,SAAQ,uBAAuB,CAAC,eAAe,CAAC;IACpE,OAAgB,QAAQ,UAAO;IAC/B,OAAO,4CAA4B;CACtC"}
@@ -0,0 +1,12 @@
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
+ import { TungstenSimpleComponent } from "../Components.js";
5
+ // renders its children once and is never updated by its parent again: markup for DOM manipulation
6
+ export class NativeHtml extends TungstenSimpleComponent {
7
+ constructor(...args) {
8
+ super(...args);
9
+ _defineProperty(this, "content", () => this.props.children);
10
+ }
11
+ }
12
+ _defineProperty(NativeHtml, "__opaque", true);
@@ -6,7 +6,7 @@ type Props = {
6
6
  };
7
7
  export declare class PopMessages extends TungstenSimpleInternalStoreComponent<Props> {
8
8
  clientInit: () => void;
9
- content: () => import("../ContentNode.js").ContentNode;
9
+ content: () => import("../ContentNode.js").ContentNodeElement | null;
10
10
  }
11
11
  export {};
12
12
  //# sourceMappingURL=PopMessages.d.ts.map