tungsten 0.3.2 → 0.3.3

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 (278) hide show
  1. package/dist/.build-complete +1 -0
  2. package/dist/Framework.d.ts +2 -0
  3. package/dist/Framework.d.ts.map +1 -1
  4. package/dist/Framework.js +68 -57
  5. package/dist/FrameworkConfig.d.ts +2 -0
  6. package/dist/FrameworkConfig.d.ts.map +1 -1
  7. package/dist/Instance/Instance.d.ts.map +1 -1
  8. package/dist/Instance/Instance.js +18 -1
  9. package/dist/Instance/InstanceConfig.d.ts +1 -0
  10. package/dist/Instance/InstanceConfig.d.ts.map +1 -1
  11. package/dist/PopMessage.type.d.ts +6 -0
  12. package/dist/PopMessage.type.d.ts.map +1 -0
  13. package/dist/PopMessage.type.js +1 -0
  14. package/dist/Servers/DevServer.d.ts +2 -0
  15. package/dist/Servers/DevServer.d.ts.map +1 -1
  16. package/dist/Servers/DevServer.js +84 -8
  17. package/dist/Servers/MatchedRouteInfo.d.ts +1 -1
  18. package/dist/Servers/MatchedRouteInfo.d.ts.map +1 -1
  19. package/dist/Servers/ProdServer.d.ts +1 -0
  20. package/dist/Servers/ProdServer.d.ts.map +1 -1
  21. package/dist/Servers/ProdServer.js +79 -5
  22. package/dist/Servers/hono/DevServerHono.js +25 -29
  23. package/dist/Servers/hono/ProdServerHono.js +49 -142
  24. package/dist/Servers/hono/TungstenServerHono.d.ts +1 -1
  25. package/dist/Servers/hono/TungstenServerHono.d.ts.map +1 -1
  26. package/dist/Servers/hono/TungstenServerHono.js +12 -29
  27. package/dist/Servers/routing.d.ts.map +1 -1
  28. package/dist/Servers/routing.js +10 -6
  29. package/dist/Servers/tungstenCorePrivateEnvSchema.d.ts +0 -3
  30. package/dist/Servers/tungstenCorePrivateEnvSchema.d.ts.map +1 -1
  31. package/dist/Servers/tungstenCorePrivateEnvSchema.js +3 -3
  32. package/dist/Servers/tungstenCorePublicEnvSchema.d.ts +8 -0
  33. package/dist/Servers/tungstenCorePublicEnvSchema.d.ts.map +1 -0
  34. package/dist/Servers/tungstenCorePublicEnvSchema.js +14 -0
  35. package/dist/Store/InternalStoreSchema.d.ts +2 -0
  36. package/dist/Store/InternalStoreSchema.d.ts.map +1 -1
  37. package/dist/Store/InternalStoreSchema.js +1 -0
  38. package/dist/api/Request.d.ts +1 -1
  39. package/dist/api/Request.d.ts.map +1 -1
  40. package/dist/api/Response.d.ts +1 -1
  41. package/dist/api/Response.d.ts.map +1 -1
  42. package/dist/babelPlugins/BabelTypes.d.ts +2 -2
  43. package/dist/babelPlugins/BabelTypes.d.ts.map +1 -1
  44. package/dist/babelPlugins/BabelTypes.js +0 -1
  45. package/dist/bin/commands/build.d.ts.map +1 -1
  46. package/dist/bin/commands/build.js +3 -0
  47. package/dist/bin/commands/dev.d.ts.map +1 -1
  48. package/dist/bin/commands/dev.js +15 -4
  49. package/dist/bin/commands/devmon.d.ts +2 -0
  50. package/dist/bin/commands/devmon.d.ts.map +1 -0
  51. package/dist/bin/commands/devmon.js +66 -0
  52. package/dist/bin/index.d.ts.map +1 -1
  53. package/dist/bin/index.js +6 -0
  54. package/dist/booleanAttributeValue.d.ts +21 -0
  55. package/dist/booleanAttributeValue.d.ts.map +1 -0
  56. package/dist/booleanAttributeValue.js +23 -0
  57. package/dist/build/compileJavascript.js +1 -1
  58. package/dist/build/compileUserApp.d.ts +2 -1
  59. package/dist/build/compileUserApp.d.ts.map +1 -1
  60. package/dist/build/compileUserApp.js +8 -7
  61. package/dist/build/createInstanceConfigFile.js +1 -1
  62. package/dist/compat/types.d.ts +1 -1
  63. package/dist/compat/types.d.ts.map +1 -1
  64. package/dist/components/PopMessages.d.ts +12 -0
  65. package/dist/components/PopMessages.d.ts.map +1 -0
  66. package/dist/components/PopMessages.js +45 -0
  67. package/dist/defaultConfig.d.ts +1 -0
  68. package/dist/defaultConfig.d.ts.map +1 -1
  69. package/dist/defaultConfig.js +2 -1
  70. package/dist/env/Interfaces.d.ts +2 -1
  71. package/dist/env/Interfaces.d.ts.map +1 -1
  72. package/dist/env/getEnvSchemas.d.ts +1 -1
  73. package/dist/env/getEnvSchemas.d.ts.map +1 -1
  74. package/dist/env/publicEnv.d.ts.map +1 -1
  75. package/dist/env/publicEnv.js +4 -1
  76. package/dist/frameworkConfigSchema.d.ts +4 -0
  77. package/dist/frameworkConfigSchema.d.ts.map +1 -1
  78. package/dist/frameworkConfigSchema.js +2 -1
  79. package/dist/hooks/index.d.ts +1 -0
  80. package/dist/hooks/index.d.ts.map +1 -1
  81. package/dist/hooks/index.js +1 -0
  82. package/dist/hooks/useInstance.d.ts +3 -0
  83. package/dist/hooks/useInstance.d.ts.map +1 -0
  84. package/dist/hooks/useInstance.js +4 -0
  85. package/dist/hydrate/hydrate.d.ts +6 -4
  86. package/dist/hydrate/hydrate.d.ts.map +1 -1
  87. package/dist/hydrate/hydrate.js +51 -13
  88. package/dist/hydrate/reconcileHydratedAttributes.d.ts.map +1 -1
  89. package/dist/hydrate/reconcileHydratedAttributes.js +4 -3
  90. package/dist/hydrate/renderHydrationMismatchBanner.d.ts +7 -0
  91. package/dist/hydrate/renderHydrationMismatchBanner.d.ts.map +1 -0
  92. package/dist/hydrate/renderHydrationMismatchBanner.js +69 -0
  93. package/dist/indexInner.d.ts +8 -0
  94. package/dist/indexInner.d.ts.map +1 -1
  95. package/dist/indexInner.js +7 -1
  96. package/dist/makeInstanceConfigFromFrameworkConfig.d.ts.map +1 -1
  97. package/dist/makeInstanceConfigFromFrameworkConfig.js +2 -1
  98. package/dist/pop.d.ts +10 -0
  99. package/dist/pop.d.ts.map +1 -0
  100. package/dist/pop.js +49 -0
  101. package/dist/rawHtml/filterContentNode.d.ts +20 -0
  102. package/dist/rawHtml/filterContentNode.d.ts.map +1 -0
  103. package/dist/rawHtml/filterContentNode.js +96 -0
  104. package/dist/rawHtml/parseHtml.d.ts +14 -0
  105. package/dist/rawHtml/parseHtml.d.ts.map +1 -1
  106. package/dist/rawHtml/parseHtml.js +4 -4
  107. package/dist/rawHtml/sanitizeHtml.d.ts +17 -0
  108. package/dist/rawHtml/sanitizeHtml.d.ts.map +1 -0
  109. package/dist/rawHtml/sanitizeHtml.js +19 -0
  110. package/dist/render/HeadData.d.ts +1 -0
  111. package/dist/render/HeadData.d.ts.map +1 -1
  112. package/dist/render/contentNodeToHtml.d.ts +18 -0
  113. package/dist/render/contentNodeToHtml.d.ts.map +1 -0
  114. package/dist/render/contentNodeToHtml.js +66 -0
  115. package/dist/render/contentToHtml.d.ts.map +1 -1
  116. package/dist/render/contentToHtml.js +2 -1
  117. package/dist/render/processHead.d.ts.map +1 -1
  118. package/dist/render/processHead.js +8 -2
  119. package/dist/render/renderingTreeToHtml.d.ts.map +1 -1
  120. package/dist/render/renderingTreeToHtml.js +8 -1
  121. package/dist/routing/ErrorRouteType.d.ts +6 -0
  122. package/dist/routing/ErrorRouteType.d.ts.map +1 -0
  123. package/dist/routing/ErrorRouteType.js +1 -0
  124. package/dist/routing/RouteTypes.d.ts +2 -1
  125. package/dist/routing/RouteTypes.d.ts.map +1 -1
  126. package/dist/routing/Routes.d.ts +5 -0
  127. package/dist/routing/Routes.d.ts.map +1 -1
  128. package/dist/routing/TungstenErrorInfo.d.ts +6 -0
  129. package/dist/routing/TungstenErrorInfo.d.ts.map +1 -0
  130. package/dist/routing/TungstenErrorInfo.js +6 -0
  131. package/dist/style/styleContentSxy.js +21 -0
  132. package/dist/testing/hydrateTestApp.d.ts +38 -0
  133. package/dist/testing/hydrateTestApp.d.ts.map +1 -0
  134. package/dist/testing/hydrateTestApp.js +242 -0
  135. package/dist/testing/index.d.ts +4 -3
  136. package/dist/testing/index.d.ts.map +1 -1
  137. package/dist/testing/index.js +16 -2
  138. package/dist/timeProfiler.d.ts +6 -0
  139. package/dist/timeProfiler.d.ts.map +1 -0
  140. package/dist/timeProfiler.js +31 -0
  141. package/dist/update/integrateUpdateVdom.d.ts +11 -0
  142. package/dist/update/integrateUpdateVdom.d.ts.map +1 -1
  143. package/dist/update/integrateUpdateVdom.js +9 -3
  144. package/dist/warnOnFrameworkChange.d.ts.map +1 -1
  145. package/dist/warnOnFrameworkChange.js +8 -8
  146. package/package.json +18 -16
  147. package/dist/FunctionComponentStandIn.sxyt.d.ts +0 -2
  148. package/dist/FunctionComponentStandIn.sxyt.d.ts.map +0 -1
  149. package/dist/FunctionComponentStandIn.sxyt.js +0 -52
  150. package/dist/Instance/gotoRedirect.sxyt.d.ts +0 -2
  151. package/dist/Instance/gotoRedirect.sxyt.d.ts.map +0 -1
  152. package/dist/Instance/gotoRedirect.sxyt.js +0 -148
  153. package/dist/Instance/runTrackedWork.sxyt.d.ts +0 -2
  154. package/dist/Instance/runTrackedWork.sxyt.d.ts.map +0 -1
  155. package/dist/Instance/runTrackedWork.sxyt.js +0 -35
  156. package/dist/Servers/devErrorPageAutoRetry.sxyt.d.ts +0 -2
  157. package/dist/Servers/devErrorPageAutoRetry.sxyt.d.ts.map +0 -1
  158. package/dist/Servers/devErrorPageAutoRetry.sxyt.js +0 -117
  159. package/dist/_client/cjsHelpers.sxyt.d.ts +0 -2
  160. package/dist/_client/cjsHelpers.sxyt.d.ts.map +0 -1
  161. package/dist/_client/cjsHelpers.sxyt.js +0 -45
  162. package/dist/auth/passwordHashing.sxyt.d.ts +0 -2
  163. package/dist/auth/passwordHashing.sxyt.d.ts.map +0 -1
  164. package/dist/auth/passwordHashing.sxyt.js +0 -46
  165. package/dist/auth/ref/checkPasswordResetToken.sxyt.d.ts +0 -2
  166. package/dist/auth/ref/checkPasswordResetToken.sxyt.d.ts.map +0 -1
  167. package/dist/auth/ref/checkPasswordResetToken.sxyt.js +0 -40
  168. package/dist/auth/ref/createPasswordResetToken.sxyt.d.ts +0 -2
  169. package/dist/auth/ref/createPasswordResetToken.sxyt.d.ts.map +0 -1
  170. package/dist/auth/ref/createPasswordResetToken.sxyt.js +0 -10
  171. package/dist/babelPlugins/BabelAddDevCacheBust.sxyt.d.ts +0 -2
  172. package/dist/babelPlugins/BabelAddDevCacheBust.sxyt.d.ts.map +0 -1
  173. package/dist/babelPlugins/BabelAddDevCacheBust.sxyt.js +0 -138
  174. package/dist/babelPlugins/fixImportsInSassErrorMessage.sxyt.d.ts +0 -2
  175. package/dist/babelPlugins/fixImportsInSassErrorMessage.sxyt.d.ts.map +0 -1
  176. package/dist/babelPlugins/fixImportsInSassErrorMessage.sxyt.js +0 -108
  177. package/dist/babelPlugins/transformPackageImports/resolveBareImport.sxyt.d.ts +0 -2
  178. package/dist/babelPlugins/transformPackageImports/resolveBareImport.sxyt.d.ts.map +0 -1
  179. package/dist/babelPlugins/transformPackageImports/resolveBareImport.sxyt.js +0 -104
  180. package/dist/bin/commands/compile.sxyt.d.ts +0 -2
  181. package/dist/bin/commands/compile.sxyt.d.ts.map +0 -1
  182. package/dist/bin/commands/compile.sxyt.js +0 -255
  183. package/dist/build/modifySassImports.sxyt.d.ts +0 -2
  184. package/dist/build/modifySassImports.sxyt.d.ts.map +0 -1
  185. package/dist/build/modifySassImports.sxyt.js +0 -55
  186. package/dist/build/sassImportParser.sxyt.d.ts +0 -2
  187. package/dist/build/sassImportParser.sxyt.d.ts.map +0 -1
  188. package/dist/build/sassImportParser.sxyt.js +0 -110
  189. package/dist/build/scssImportParserChatgpt.sxyt.d.ts +0 -2
  190. package/dist/build/scssImportParserChatgpt.sxyt.d.ts.map +0 -1
  191. package/dist/build/scssImportParserChatgpt.sxyt.js +0 -120
  192. package/dist/clone.sxyt.d.ts +0 -2
  193. package/dist/clone.sxyt.d.ts.map +0 -1
  194. package/dist/clone.sxyt.js +0 -24
  195. package/dist/componentProxyHandlers.sxyt.d.ts +0 -2
  196. package/dist/componentProxyHandlers.sxyt.d.ts.map +0 -1
  197. package/dist/componentProxyHandlers.sxyt.js +0 -130
  198. package/dist/components/RawHtml.sxyt.d.ts +0 -2
  199. package/dist/components/RawHtml.sxyt.d.ts.map +0 -1
  200. package/dist/components/RawHtml.sxyt.js +0 -104
  201. package/dist/components/bindable/BindableSelect.sxyt.d.ts +0 -2
  202. package/dist/components/bindable/BindableSelect.sxyt.d.ts.map +0 -1
  203. package/dist/components/bindable/BindableSelect.sxyt.js +0 -186
  204. package/dist/env/injectEnv.sxyt.d.ts +0 -2
  205. package/dist/env/injectEnv.sxyt.d.ts.map +0 -1
  206. package/dist/env/injectEnv.sxyt.js +0 -20
  207. package/dist/env/parseEnv.sxyt.d.ts +0 -2
  208. package/dist/env/parseEnv.sxyt.d.ts.map +0 -1
  209. package/dist/env/parseEnv.sxyt.js +0 -11
  210. package/dist/findProjectDir.sxyt.d.ts +0 -2
  211. package/dist/findProjectDir.sxyt.d.ts.map +0 -1
  212. package/dist/findProjectDir.sxyt.js +0 -82
  213. package/dist/hmr/applyHmrModule.sxyt.d.ts +0 -2
  214. package/dist/hmr/applyHmrModule.sxyt.d.ts.map +0 -1
  215. package/dist/hmr/applyHmrModule.sxyt.js +0 -182
  216. package/dist/hmr/instanceRegistry.sxyt.d.ts +0 -2
  217. package/dist/hmr/instanceRegistry.sxyt.d.ts.map +0 -1
  218. package/dist/hmr/instanceRegistry.sxyt.js +0 -24
  219. package/dist/hmr/refreshStylesheets.sxyt.d.ts +0 -2
  220. package/dist/hmr/refreshStylesheets.sxyt.d.ts.map +0 -1
  221. package/dist/hmr/refreshStylesheets.sxyt.js +0 -46
  222. package/dist/hydrate/hydrate.sxyt.d.ts +0 -2
  223. package/dist/hydrate/hydrate.sxyt.d.ts.map +0 -1
  224. package/dist/hydrate/hydrate.sxyt.js +0 -302
  225. package/dist/hydrate/reconcileHydratedAttributes.sxyt.d.ts +0 -2
  226. package/dist/hydrate/reconcileHydratedAttributes.sxyt.d.ts.map +0 -1
  227. package/dist/hydrate/reconcileHydratedAttributes.sxyt.js +0 -190
  228. package/dist/importDevModuleWithRetry.sxyt.d.ts +0 -2
  229. package/dist/importDevModuleWithRetry.sxyt.d.ts.map +0 -1
  230. package/dist/importDevModuleWithRetry.sxyt.js +0 -104
  231. package/dist/innerHtmlFromProps.sxyt.d.ts +0 -2
  232. package/dist/innerHtmlFromProps.sxyt.d.ts.map +0 -1
  233. package/dist/innerHtmlFromProps.sxyt.js +0 -99
  234. package/dist/postcssPlugins/parseSelectors.sxyt.d.ts +0 -2
  235. package/dist/postcssPlugins/parseSelectors.sxyt.d.ts.map +0 -1
  236. package/dist/postcssPlugins/parseSelectors.sxyt.js +0 -62
  237. package/dist/postcssPlugins/parseSelectorsRich.sxyt.d.ts +0 -2
  238. package/dist/postcssPlugins/parseSelectorsRich.sxyt.d.ts.map +0 -1
  239. package/dist/postcssPlugins/parseSelectorsRich.sxyt.js +0 -155
  240. package/dist/rawHtml/parseHtml.sxyt.d.ts +0 -2
  241. package/dist/rawHtml/parseHtml.sxyt.d.ts.map +0 -1
  242. package/dist/rawHtml/parseHtml.sxyt.js +0 -239
  243. package/dist/render/getFunctionBodyAsString.sxyt.d.ts +0 -2
  244. package/dist/render/getFunctionBodyAsString.sxyt.d.ts.map +0 -1
  245. package/dist/render/getFunctionBodyAsString.sxyt.js +0 -37
  246. package/dist/render/processHead.sxyt.d.ts +0 -2
  247. package/dist/render/processHead.sxyt.d.ts.map +0 -1
  248. package/dist/render/processHead.sxyt.js +0 -93
  249. package/dist/render/processProps.sxyt.d.ts +0 -2
  250. package/dist/render/processProps.sxyt.d.ts.map +0 -1
  251. package/dist/render/processProps.sxyt.js +0 -90
  252. package/dist/routing/compareRequestToRegex.sxyt.d.ts +0 -2
  253. package/dist/routing/compareRequestToRegex.sxyt.d.ts.map +0 -1
  254. package/dist/routing/compareRequestToRegex.sxyt.js +0 -65
  255. package/dist/routing/getPathPriority.sxyt.d.ts +0 -2
  256. package/dist/routing/getPathPriority.sxyt.d.ts.map +0 -1
  257. package/dist/routing/getPathPriority.sxyt.js +0 -24
  258. package/dist/routing/matchPath.sxyt.d.ts +0 -2
  259. package/dist/routing/matchPath.sxyt.d.ts.map +0 -1
  260. package/dist/routing/matchPath.sxyt.js +0 -41
  261. package/dist/routing/patternToRegex.sxyt.d.ts +0 -2
  262. package/dist/routing/patternToRegex.sxyt.d.ts.map +0 -1
  263. package/dist/routing/patternToRegex.sxyt.js +0 -69
  264. package/dist/routing/splitRequest.sxyt.d.ts +0 -2
  265. package/dist/routing/splitRequest.sxyt.d.ts.map +0 -1
  266. package/dist/routing/splitRequest.sxyt.js +0 -47
  267. package/dist/style/jssToCss.sxyt.d.ts +0 -2
  268. package/dist/style/jssToCss.sxyt.d.ts.map +0 -1
  269. package/dist/style/jssToCss.sxyt.js +0 -17
  270. package/dist/testing/createTestApp.sxyt.d.ts +0 -2
  271. package/dist/testing/createTestApp.sxyt.d.ts.map +0 -1
  272. package/dist/testing/createTestApp.sxyt.js +0 -470
  273. package/dist/testing/ensureTestEnvLoaded.sxyt.d.ts +0 -2
  274. package/dist/testing/ensureTestEnvLoaded.sxyt.d.ts.map +0 -1
  275. package/dist/testing/ensureTestEnvLoaded.sxyt.js +0 -20
  276. package/dist/update/hotSwap.sxyt.d.ts +0 -2
  277. package/dist/update/hotSwap.sxyt.d.ts.map +0 -1
  278. package/dist/update/hotSwap.sxyt.js +0 -252
@@ -1,93 +0,0 @@
1
- import { expect } from 'chai';
2
- import { Window } from 'happy-dom';
3
- import { describe } from 'sxy-test-runner';
4
- import { processHead } from "./processHead.js";
5
- import { $props, $type } from "../contentNodeSymbols.js";
6
- import { Instance } from "../Instance/Instance.js";
7
- import { initStores } from "../Servers/initStores.js";
8
- import { UpdateScheduler } from "../update/UpdateScheduler.js";
9
- function makeHeadData(hmr) {
10
- const location = '/';
11
- const globalData = {};
12
- const matchedRouteInfo = {
13
- key: null,
14
- params: {},
15
- content: null
16
- };
17
- const {
18
- internalStore,
19
- stores,
20
- storeSubscriptions
21
- } = initStores(location, null, globalData, matchedRouteInfo);
22
- const instanceConfig = {
23
- prod: false,
24
- useRootComponent: true,
25
- clientSideNav: false,
26
- siteBasePath: '/',
27
- staticSite: false
28
- };
29
- const emptyRoutes = {}; // eslint-disable-line no-type-assertion/no-type-assertion -- not exercised by this test
30
- const window = new Window();
31
- const document = window.document; // eslint-disable-line no-type-assertion/no-type-assertion -- happy-dom's Document is structurally compatible
32
- const scheduler = new UpdateScheduler();
33
- // navigation: false sidesteps Instance's popstate listener setup, which reaches for the
34
- // process-wide `window` global when no runtimeContext is given at all - see hydrate.sxyt.tsx
35
- const instance = new Instance(location, instanceConfig, null, emptyRoutes, emptyRoutes,
36
- // eslint-disable-line no-type-assertion/no-type-assertion
37
- internalStore, stores, storeSubscriptions, globalData, matchedRouteInfo, {
38
- document,
39
- window: document.defaultView,
40
- scheduler,
41
- navigation: false
42
- });
43
- return {
44
- found: false,
45
- instance,
46
- clientImportAliases: {},
47
- importAliases: {},
48
- compilationLocation: '',
49
- dev: true,
50
- tungstenPublicEnv: undefined,
51
- siteBasePath: '',
52
- hmr
53
- };
54
- }
55
- function reloadScriptText(headNode) {
56
- const children = headNode[$props].children ?? [];
57
- const scripts = children.filter(node => node[$type] === 'script');
58
- const reloadScript = scripts.find(node => typeof node[$props].children === 'string' && node[$props].children.includes('__tungsten_live_reload__'));
59
- return reloadScript?.[$props].children; // eslint-disable-line no-type-assertion/no-type-assertion -- narrowed by the find() predicate above
60
- }
61
- describe('processHead() - hmr config option', ({
62
- it
63
- }) => {
64
- it('injects the full Tier 2 hot-swap script when hmr is true', () => {
65
- const headNode = {
66
- [$type]: 'head',
67
- [$props]: {}
68
- };
69
- processHead(headNode, makeHeadData(true));
70
- const script = reloadScriptText(headNode);
71
- expect(script).to.contain('applyHmrModule');
72
- expect(script).to.contain('refreshStylesheets');
73
- });
74
- it(`injects only the Tier 1 always-full-reload script when hmr is 'reload'`, () => {
75
- const headNode = {
76
- [$type]: 'head',
77
- [$props]: {}
78
- };
79
- processHead(headNode, makeHeadData('reload'));
80
- const script = reloadScriptText(headNode);
81
- expect(script).to.not.contain('applyHmrModule');
82
- expect(script).to.not.contain('refreshStylesheets');
83
- expect(script).to.contain('location.reload()');
84
- });
85
- it('injects no live-reload script at all when hmr is false', () => {
86
- const headNode = {
87
- [$type]: 'head',
88
- [$props]: {}
89
- };
90
- processHead(headNode, makeHeadData(false));
91
- expect(reloadScriptText(headNode)).to.equal(undefined);
92
- });
93
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=processProps.sxyt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"processProps.sxyt.d.ts","sourceRoot":"","sources":["../../src/render/processProps.sxyt.ts"],"names":[],"mappings":""}
@@ -1,90 +0,0 @@
1
- import { describe } from 'sxy-test-runner';
2
- import { expect } from 'chai';
3
- import { processProps } from "./processProps.js";
4
- import { htmlEvents } from "../htmlEvents.js";
5
- describe('processProps()', ({
6
- it
7
- }) => {
8
- it('keeps ordinary attributes', () => {
9
- expect(processProps({
10
- name: 'a',
11
- title: 't',
12
- 'data-x': '1'
13
- })).to.deep.equal({
14
- name: 'a',
15
- title: 't',
16
- 'data-x': '1'
17
- });
18
- });
19
- // The list of handlers used to be written out by hand and missed most of
20
- // them, so anything not named leaked into the markup as an attribute
21
- // holding a stringified function.
22
- it('strips every event handler Tungsten recognises, not a hand-picked few', () => {
23
- const handlers = Object.fromEntries(Object.keys(htmlEvents).map(name => [name, () => undefined]));
24
- expect(processProps({
25
- ...handlers,
26
- name: 'a'
27
- })).to.deep.equal({
28
- name: 'a'
29
- });
30
- });
31
- it('strips the handlers that were missing from the old list', () => {
32
- const kept = processProps({
33
- onInput: () => undefined,
34
- onFocus: () => undefined,
35
- onBlur: () => undefined,
36
- onScroll: () => undefined,
37
- onPaste: () => undefined,
38
- name: 'a'
39
- });
40
- expect(Object.keys(kept)).to.deep.equal(['name']);
41
- });
42
- it('strips props that are instructions to Tungsten rather than attributes', () => {
43
- const kept = processProps({
44
- ref: {
45
- current: null
46
- },
47
- __zoneHtml: '<b>x</b>',
48
- __opaque: true,
49
- dangerouslySetInnerHTML: {
50
- __html: '<b>x</b>'
51
- },
52
- name: 'a'
53
- });
54
- expect(Object.keys(kept)).to.deep.equal(['name']);
55
- });
56
- it('renames className to class', () => {
57
- expect(processProps({
58
- className: 'a b'
59
- })).to.deep.equal({
60
- class: 'a b'
61
- });
62
- // a raw class prop is dropped; className is the one that reaches HTML
63
- expect(processProps({
64
- class: 'ignored'
65
- })).to.deep.equal({});
66
- });
67
- it('turns a style object into a css string', () => {
68
- expect(processProps({
69
- style: {
70
- backgroundColor: 'red'
71
- }
72
- }).style).to.equal('background-color: red;');
73
- });
74
- it('folds css into style and does not leave css behind as an attribute', () => {
75
- const kept = processProps({
76
- css: 'color: red'
77
- });
78
- expect(kept.style).to.equal('color: red');
79
- expect('css' in kept).to.equal(false);
80
- });
81
- it('does not mutate the props it is given', () => {
82
- const props = {
83
- className: 'a',
84
- onClick: () => undefined,
85
- name: 'n'
86
- };
87
- processProps(props);
88
- expect(Object.keys(props).sort()).to.deep.equal(['className', 'name', 'onClick']);
89
- });
90
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=compareRequestToRegex.sxyt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compareRequestToRegex.sxyt.d.ts","sourceRoot":"","sources":["../../src/routing/compareRequestToRegex.sxyt.ts"],"names":[],"mappings":""}
@@ -1,65 +0,0 @@
1
- import { describe } from 'sxy-test-runner';
2
- import { expect } from 'chai';
3
- import { objects } from 'sxy-lib';
4
- import { compareRequestToRegex } from "./compareRequestToRegex.js";
5
- import { patternToRegex } from "./patternToRegex.js";
6
- describe('routing/compareRequestToRegex()', ({
7
- it
8
- }) => {
9
- it(`/foo matches /foo no params`, () => {
10
- const pattern = '/foo';
11
- const request = '/foo';
12
- const {
13
- regex,
14
- keys
15
- } = patternToRegex(pattern);
16
- const {
17
- success,
18
- params
19
- } = compareRequestToRegex(request, regex, keys);
20
- success.should.equal(true);
21
- objects.count(params).should.equal(0);
22
- });
23
- it(`/foo does not match /foo/bar`, () => {
24
- const pattern = '/foo';
25
- const request = '/foo/bar';
26
- const {
27
- regex,
28
- keys
29
- } = patternToRegex(pattern);
30
- const {
31
- success,
32
- params
33
- } = compareRequestToRegex(request, regex, keys); // eslint-disable-line @typescript-eslint/no-unused-vars
34
- success.should.equal(false);
35
- });
36
- it(`/foo/:bar matches /foo/bing with the params { bar: 'bing' }"`, () => {
37
- const pattern = '/foo/:bar';
38
- const request = '/foo/bing';
39
- const {
40
- regex,
41
- keys
42
- } = patternToRegex(pattern);
43
- const c = compareRequestToRegex(request, regex, keys);
44
- const {
45
- success,
46
- params
47
- } = c;
48
- success.should.equal(true);
49
- objects.count(params).should.equal(1);
50
- expect(params.bar).to.equal('bing');
51
- });
52
- it(`/foo/:bar does not match /foo/"`, () => {
53
- const pattern = '/foo/:bar';
54
- const request = '/foo/';
55
- const {
56
- regex,
57
- keys
58
- } = patternToRegex(pattern);
59
- const {
60
- success,
61
- params
62
- } = compareRequestToRegex(request, regex, keys); // eslint-disable-line @typescript-eslint/no-unused-vars
63
- success.should.equal(false);
64
- });
65
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=getPathPriority.sxyt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getPathPriority.sxyt.d.ts","sourceRoot":"","sources":["../../src/routing/getPathPriority.sxyt.ts"],"names":[],"mappings":""}
@@ -1,24 +0,0 @@
1
- import { describe } from 'sxy-test-runner';
2
- import { getPathPriority } from "./getPathPriority.js";
3
- describe('routing/compareRequestToRegex()', ({
4
- it
5
- }) => {
6
- it(`/foo returns priority 2`, () => {
7
- const pattern = '/foo';
8
- const priority = getPathPriority(pattern);
9
- //console.log('priority', priority)
10
- priority.should.equal(2);
11
- });
12
- it(`/foo/:bar/foo returns priority 212`, () => {
13
- const pattern = '/foo/:bar/foo';
14
- const priority = getPathPriority(pattern);
15
- //console.log('priority', priority)
16
- priority.should.equal(212);
17
- });
18
- it(`/foo/:bar([^\\/])/foo returns priority 212`, () => {
19
- const pattern = '/foo/:bar([^\\/])/foo';
20
- const priority = getPathPriority(pattern);
21
- //console.log('priority', priority)
22
- priority.should.equal(212);
23
- });
24
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=matchPath.sxyt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"matchPath.sxyt.d.ts","sourceRoot":"","sources":["../../src/routing/matchPath.sxyt.ts"],"names":[],"mappings":""}
@@ -1,41 +0,0 @@
1
- import { describe } from 'sxy-test-runner';
2
- import { expect } from 'chai';
3
- import { matchPath } from "./matchPath.js";
4
- describe('routing/matchPath()', ({
5
- it
6
- }) => {
7
- it(`returns null for /foo against /bar`, () => {
8
- expect(matchPath('/foo', '/bar')).to.equal(null);
9
- });
10
- it(`returns match object for /foo against /foo`, () => {
11
- const match = matchPath('/foo', '/foo');
12
- expect(match).not.to.equal(null);
13
- });
14
- it(`returns match object for /foo/ against /foo`, () => {
15
- const match = matchPath('/foo/', '/foo');
16
- expect(match).not.to.equal(null);
17
- });
18
- it(`matches /foo when the request has a query string`, () => {
19
- const match = matchPath('/foo', '/foo?bar=1');
20
- expect(match).not.to.equal(null);
21
- expect(match.query).to.deep.equal({
22
- bar: '1'
23
- });
24
- expect(match.pathname).to.equal('/foo');
25
- });
26
- it(`matches /foo when the request has a hash fragment`, () => {
27
- const match = matchPath('/foo', '/foo#section');
28
- expect(match).not.to.equal(null);
29
- expect(match.hash).to.equal('section');
30
- });
31
- it(`matches a dynamic route with a query string and captures the param`, () => {
32
- const match = matchPath('/leads/:id/details', '/leads/5/details?queue=1');
33
- expect(match).not.to.equal(null);
34
- expect(match.params).to.deep.equal({
35
- id: '5'
36
- });
37
- expect(match.query).to.deep.equal({
38
- queue: '1'
39
- });
40
- });
41
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=patternToRegex.sxyt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"patternToRegex.sxyt.d.ts","sourceRoot":"","sources":["../../src/routing/patternToRegex.sxyt.ts"],"names":[],"mappings":""}
@@ -1,69 +0,0 @@
1
- import { describe } from 'sxy-test-runner';
2
- import { patternToRegex } from "./patternToRegex.js";
3
- import { regexEquals } from "../_testing/regexEquals.js";
4
- describe('routing/patternToRegex()', ({
5
- it
6
- }) => {
7
- it(`Converts /foo to /^\\/foo\\/?$/ with no keys`, () => {
8
- const {
9
- regex,
10
- keys
11
- } = patternToRegex('/foo');
12
- regexEquals(regex, /^\/foo\/?$/).should.equal(true);
13
- keys.length.should.equal(0);
14
- });
15
- it(`Converts /foo/:bar to /^\\/foo\\/([^/]+)\\/?$/ and saves the key "bar"`, () => {
16
- const {
17
- regex,
18
- keys
19
- } = patternToRegex('/foo/:bar');
20
- regexEquals(regex, /^\/foo\/([^/]+)\/?$/).should.equal(true);
21
- keys.length.should.equal(1);
22
- keys[0].should.equal('bar');
23
- });
24
- it(`Converts /foo/:bar(\\d+) to /^\\/foo\\/(\\d+)\\/?$/, preserving the regex matcher, and saves the key "bar"`, () => {
25
- const {
26
- regex,
27
- keys
28
- } = patternToRegex('/foo/:bar(\\d+)');
29
- regexEquals(regex, /^\/foo\/(\d+)\/?$/).should.equal(true);
30
- keys.length.should.equal(1);
31
- keys[0].should.equal('bar');
32
- });
33
- it(`Converts /foo/:bar/baz to /^\\/foo\\/([^/]+)\\/baz/?$/ and saves the key "bar"`, () => {
34
- const {
35
- regex,
36
- keys
37
- } = patternToRegex('/foo/:bar/baz');
38
- regexEquals(regex, /^\/foo\/([^/]+)\/baz\/?$/).should.equal(true);
39
- keys.length.should.equal(1);
40
- keys[0].should.equal('bar');
41
- });
42
- it(`Converts /foo/:bar<digits> to /^\\/foo\\/(\\d+)\\/?$/ and saves the key "bar"`, () => {
43
- const {
44
- regex,
45
- keys
46
- } = patternToRegex('/foo/:bar<digits>');
47
- regexEquals(regex, /^\/foo\/(\d+)\/?$/).should.equal(true);
48
- keys.length.should.equal(1);
49
- keys[0].should.equal('bar');
50
- });
51
- it(`Converts /foo/:bar<int-ge1> to /^\\/foo\\/([1-9]\\d*)\\/?$/ and saves the key "bar"`, () => {
52
- const {
53
- regex,
54
- keys
55
- } = patternToRegex('/foo/:bar<int-ge1>');
56
- regexEquals(regex, /^\/foo\/([1-9]\d*)\/?$/).should.equal(true);
57
- keys.length.should.equal(1);
58
- keys[0].should.equal('bar');
59
- });
60
- it(`Converts /foo/:bar<1+> to /^\\/foo\\/([1-9]\\d*)\\/?$/ and saves the key "bar"`, () => {
61
- const {
62
- regex,
63
- keys
64
- } = patternToRegex('/foo/:bar<1+>');
65
- regexEquals(regex, /^\/foo\/([1-9]\d*)\/?$/).should.equal(true);
66
- keys.length.should.equal(1);
67
- keys[0].should.equal('bar');
68
- });
69
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=splitRequest.sxyt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"splitRequest.sxyt.d.ts","sourceRoot":"","sources":["../../src/routing/splitRequest.sxyt.ts"],"names":[],"mappings":""}
@@ -1,47 +0,0 @@
1
- import { describe } from 'sxy-test-runner';
2
- import { expect } from 'chai';
3
- import { splitRequest } from "./splitRequest.js";
4
- describe('routing/splitRequest()', ({
5
- it
6
- }) => {
7
- it(`returns the path unchanged when there is no query or hash`, () => {
8
- expect(splitRequest('/foo/bar')).to.deep.equal({
9
- pathname: '/foo/bar',
10
- query: {},
11
- hash: ''
12
- });
13
- });
14
- it(`splits off a query string and parses it`, () => {
15
- expect(splitRequest('/foo?a=1&b=2')).to.deep.equal({
16
- pathname: '/foo',
17
- query: {
18
- a: '1',
19
- b: '2'
20
- },
21
- hash: ''
22
- });
23
- });
24
- it(`splits off a hash fragment`, () => {
25
- expect(splitRequest('/foo#section')).to.deep.equal({
26
- pathname: '/foo',
27
- query: {},
28
- hash: 'section'
29
- });
30
- });
31
- it(`splits off both query and hash`, () => {
32
- expect(splitRequest('/foo?a=1#section')).to.deep.equal({
33
- pathname: '/foo',
34
- query: {
35
- a: '1'
36
- },
37
- hash: 'section'
38
- });
39
- });
40
- it(`does not treat a '?' inside the hash as a query delimiter`, () => {
41
- expect(splitRequest('/foo#a?b')).to.deep.equal({
42
- pathname: '/foo',
43
- query: {},
44
- hash: 'a?b'
45
- });
46
- });
47
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=jssToCss.sxyt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jssToCss.sxyt.d.ts","sourceRoot":"","sources":["../../src/style/jssToCss.sxyt.ts"],"names":[],"mappings":""}
@@ -1,17 +0,0 @@
1
- export {};
2
- /*
3
- describe('jssToCss()', ({it}: DescribeArg) => {
4
- it(`Converts color: red`, () => {
5
- // @ts-ignore
6
- jssToCss({ color: 'red'}).should.equal('color: red;')
7
- })
8
- it(`Converts border-color: red`, () => {
9
- // @ts-ignore
10
- jssToCss({ borderColor: 'red'}).should.equal('border-color: red;')
11
- })
12
- it(`Converts font-size: 14px`, () => {
13
- // @ts-ignore
14
- jssToCss({ fontSize: 14}).should.equal('font-size: 14px;')
15
- })
16
- })
17
- */
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=createTestApp.sxyt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createTestApp.sxyt.d.ts","sourceRoot":"","sources":["../../src/testing/createTestApp.sxyt.tsx"],"names":[],"mappings":""}