@hyperframes/core 0.7.13 → 0.7.15

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 (238) hide show
  1. package/dist/compiler/staticGuard.js +1 -1
  2. package/dist/compiler/staticGuard.js.map +1 -1
  3. package/dist/core.types.d.ts +2 -369
  4. package/dist/core.types.d.ts.map +1 -1
  5. package/dist/core.types.js +1 -84
  6. package/dist/core.types.js.map +1 -1
  7. package/dist/generators/hyperframes.d.ts +1 -1
  8. package/dist/generators/hyperframes.d.ts.map +1 -1
  9. package/dist/generators/hyperframes.js +1 -1
  10. package/dist/generators/hyperframes.js.map +1 -1
  11. package/dist/index.d.ts +5 -7
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +7 -4
  14. package/dist/index.js.map +1 -1
  15. package/dist/lint/index.d.ts +2 -2
  16. package/dist/lint/index.d.ts.map +1 -1
  17. package/dist/lint/index.js +2 -1
  18. package/dist/lint/index.js.map +1 -1
  19. package/dist/parsers/gsapConstants.d.ts +2 -12
  20. package/dist/parsers/gsapConstants.d.ts.map +1 -1
  21. package/dist/parsers/gsapConstants.js +2 -110
  22. package/dist/parsers/gsapConstants.js.map +1 -1
  23. package/dist/parsers/gsapParserAcorn.d.ts +2 -48
  24. package/dist/parsers/gsapParserAcorn.d.ts.map +1 -1
  25. package/dist/parsers/gsapParserAcorn.js +2 -1057
  26. package/dist/parsers/gsapParserAcorn.js.map +1 -1
  27. package/dist/parsers/gsapParserExports.d.ts +2 -20
  28. package/dist/parsers/gsapParserExports.d.ts.map +1 -1
  29. package/dist/parsers/gsapParserExports.js +2 -8
  30. package/dist/parsers/gsapParserExports.js.map +1 -1
  31. package/dist/parsers/gsapWriterAcorn.d.ts +2 -90
  32. package/dist/parsers/gsapWriterAcorn.d.ts.map +1 -1
  33. package/dist/parsers/gsapWriterAcorn.js +2 -2016
  34. package/dist/parsers/gsapWriterAcorn.js.map +1 -1
  35. package/dist/parsers/hfIds.d.ts +2 -16
  36. package/dist/parsers/hfIds.d.ts.map +1 -1
  37. package/dist/parsers/hfIds.js +2 -127
  38. package/dist/parsers/hfIds.js.map +1 -1
  39. package/dist/parsers/springEase.d.ts +2 -28
  40. package/dist/parsers/springEase.d.ts.map +1 -1
  41. package/dist/parsers/springEase.js +2 -69
  42. package/dist/parsers/springEase.js.map +1 -1
  43. package/dist/slideshow/index.d.ts +1 -0
  44. package/dist/slideshow/index.d.ts.map +1 -1
  45. package/dist/slideshow/index.js +1 -0
  46. package/dist/slideshow/index.js.map +1 -1
  47. package/dist/studio-api/helpers/draftMarkers.d.ts +2 -10
  48. package/dist/studio-api/helpers/draftMarkers.d.ts.map +1 -1
  49. package/dist/studio-api/helpers/draftMarkers.js +2 -10
  50. package/dist/studio-api/helpers/draftMarkers.js.map +1 -1
  51. package/dist/studio-api/helpers/finiteMutation.d.ts +2 -10
  52. package/dist/studio-api/helpers/finiteMutation.d.ts.map +1 -1
  53. package/dist/studio-api/helpers/finiteMutation.js +2 -20
  54. package/dist/studio-api/helpers/finiteMutation.js.map +1 -1
  55. package/dist/studio-api/helpers/manualEditsRenderScript.d.ts +2 -12
  56. package/dist/studio-api/helpers/manualEditsRenderScript.d.ts.map +1 -1
  57. package/dist/studio-api/helpers/manualEditsRenderScript.js +2 -632
  58. package/dist/studio-api/helpers/manualEditsRenderScript.js.map +1 -1
  59. package/dist/studio-api/helpers/screenshotClip.d.ts +2 -7
  60. package/dist/studio-api/helpers/screenshotClip.d.ts.map +1 -1
  61. package/dist/studio-api/helpers/screenshotClip.js +2 -21
  62. package/dist/studio-api/helpers/screenshotClip.js.map +1 -1
  63. package/dist/studio-api/helpers/studioMotionRenderScript.d.ts +2 -8
  64. package/dist/studio-api/helpers/studioMotionRenderScript.d.ts.map +1 -1
  65. package/dist/studio-api/helpers/studioMotionRenderScript.js +2 -207
  66. package/dist/studio-api/helpers/studioMotionRenderScript.js.map +1 -1
  67. package/dist/studio-api/index.d.ts +2 -9
  68. package/dist/studio-api/index.d.ts.map +1 -1
  69. package/dist/studio-api/index.js +2 -8
  70. package/dist/studio-api/index.js.map +1 -1
  71. package/package.json +16 -18
  72. package/dist/generated/runtime-inline.js +0 -11
  73. package/dist/hyperframe.manifest.json +0 -22
  74. package/dist/hyperframe.runtime.mjs +0 -325
  75. package/dist/lint/context.d.ts +0 -17
  76. package/dist/lint/context.d.ts.map +0 -1
  77. package/dist/lint/context.js +0 -37
  78. package/dist/lint/context.js.map +0 -1
  79. package/dist/lint/hyperframeLinter.d.ts +0 -14
  80. package/dist/lint/hyperframeLinter.d.ts.map +0 -1
  81. package/dist/lint/hyperframeLinter.js +0 -132
  82. package/dist/lint/hyperframeLinter.js.map +0 -1
  83. package/dist/lint/rules/adapters.d.ts +0 -3
  84. package/dist/lint/rules/adapters.d.ts.map +0 -1
  85. package/dist/lint/rules/adapters.js +0 -40
  86. package/dist/lint/rules/adapters.js.map +0 -1
  87. package/dist/lint/rules/captions.d.ts +0 -3
  88. package/dist/lint/rules/captions.d.ts.map +0 -1
  89. package/dist/lint/rules/captions.js +0 -242
  90. package/dist/lint/rules/captions.js.map +0 -1
  91. package/dist/lint/rules/composition.d.ts +0 -5
  92. package/dist/lint/rules/composition.d.ts.map +0 -1
  93. package/dist/lint/rules/composition.js +0 -694
  94. package/dist/lint/rules/composition.js.map +0 -1
  95. package/dist/lint/rules/core.d.ts +0 -3
  96. package/dist/lint/rules/core.d.ts.map +0 -1
  97. package/dist/lint/rules/core.js +0 -432
  98. package/dist/lint/rules/core.js.map +0 -1
  99. package/dist/lint/rules/fonts.d.ts +0 -3
  100. package/dist/lint/rules/fonts.d.ts.map +0 -1
  101. package/dist/lint/rules/fonts.js +0 -205
  102. package/dist/lint/rules/fonts.js.map +0 -1
  103. package/dist/lint/rules/gsap.d.ts +0 -4
  104. package/dist/lint/rules/gsap.d.ts.map +0 -1
  105. package/dist/lint/rules/gsap.js +0 -1039
  106. package/dist/lint/rules/gsap.js.map +0 -1
  107. package/dist/lint/rules/media.d.ts +0 -3
  108. package/dist/lint/rules/media.d.ts.map +0 -1
  109. package/dist/lint/rules/media.js +0 -491
  110. package/dist/lint/rules/media.js.map +0 -1
  111. package/dist/lint/rules/slideshow.d.ts +0 -4
  112. package/dist/lint/rules/slideshow.d.ts.map +0 -1
  113. package/dist/lint/rules/slideshow.js +0 -74
  114. package/dist/lint/rules/slideshow.js.map +0 -1
  115. package/dist/lint/rules/textures.d.ts +0 -3
  116. package/dist/lint/rules/textures.d.ts.map +0 -1
  117. package/dist/lint/rules/textures.js +0 -192
  118. package/dist/lint/rules/textures.js.map +0 -1
  119. package/dist/lint/types.d.ts +0 -36
  120. package/dist/lint/types.d.ts.map +0 -1
  121. package/dist/lint/types.js +0 -2
  122. package/dist/lint/types.js.map +0 -1
  123. package/dist/lint/utils.d.ts +0 -55
  124. package/dist/lint/utils.d.ts.map +0 -1
  125. package/dist/lint/utils.js +0 -264
  126. package/dist/lint/utils.js.map +0 -1
  127. package/dist/parsers/gsapInline.d.ts +0 -47
  128. package/dist/parsers/gsapInline.d.ts.map +0 -1
  129. package/dist/parsers/gsapInline.js +0 -513
  130. package/dist/parsers/gsapInline.js.map +0 -1
  131. package/dist/parsers/gsapParser.d.ts +0 -158
  132. package/dist/parsers/gsapParser.d.ts.map +0 -1
  133. package/dist/parsers/gsapParser.js +0 -2634
  134. package/dist/parsers/gsapParser.js.map +0 -1
  135. package/dist/parsers/gsapParser.test-helpers.d.ts +0 -49
  136. package/dist/parsers/gsapParser.test-helpers.d.ts.map +0 -1
  137. package/dist/parsers/gsapParser.test-helpers.js +0 -97
  138. package/dist/parsers/gsapParser.test-helpers.js.map +0 -1
  139. package/dist/parsers/gsapSerialize.d.ts +0 -191
  140. package/dist/parsers/gsapSerialize.d.ts.map +0 -1
  141. package/dist/parsers/gsapSerialize.js +0 -410
  142. package/dist/parsers/gsapSerialize.js.map +0 -1
  143. package/dist/parsers/gsapUnroll.d.ts +0 -7
  144. package/dist/parsers/gsapUnroll.d.ts.map +0 -1
  145. package/dist/parsers/gsapUnroll.js +0 -137
  146. package/dist/parsers/gsapUnroll.js.map +0 -1
  147. package/dist/parsers/htmlParser.d.ts +0 -27
  148. package/dist/parsers/htmlParser.d.ts.map +0 -1
  149. package/dist/parsers/htmlParser.js +0 -731
  150. package/dist/parsers/htmlParser.js.map +0 -1
  151. package/dist/studio-api/createStudioApi.d.ts +0 -10
  152. package/dist/studio-api/createStudioApi.d.ts.map +0 -1
  153. package/dist/studio-api/createStudioApi.js +0 -32
  154. package/dist/studio-api/createStudioApi.js.map +0 -1
  155. package/dist/studio-api/helpers/backupJournal.d.ts +0 -9
  156. package/dist/studio-api/helpers/backupJournal.d.ts.map +0 -1
  157. package/dist/studio-api/helpers/backupJournal.js +0 -81
  158. package/dist/studio-api/helpers/backupJournal.js.map +0 -1
  159. package/dist/studio-api/helpers/hfIdPersist.d.ts +0 -11
  160. package/dist/studio-api/helpers/hfIdPersist.d.ts.map +0 -1
  161. package/dist/studio-api/helpers/hfIdPersist.js +0 -39
  162. package/dist/studio-api/helpers/hfIdPersist.js.map +0 -1
  163. package/dist/studio-api/helpers/mediaValidation.d.ts +0 -20
  164. package/dist/studio-api/helpers/mediaValidation.d.ts.map +0 -1
  165. package/dist/studio-api/helpers/mediaValidation.js +0 -56
  166. package/dist/studio-api/helpers/mediaValidation.js.map +0 -1
  167. package/dist/studio-api/helpers/mime.d.ts +0 -4
  168. package/dist/studio-api/helpers/mime.d.ts.map +0 -1
  169. package/dist/studio-api/helpers/mime.js +0 -39
  170. package/dist/studio-api/helpers/mime.js.map +0 -1
  171. package/dist/studio-api/helpers/previewAdapter.d.ts +0 -43
  172. package/dist/studio-api/helpers/previewAdapter.d.ts.map +0 -1
  173. package/dist/studio-api/helpers/previewAdapter.js +0 -118
  174. package/dist/studio-api/helpers/previewAdapter.js.map +0 -1
  175. package/dist/studio-api/helpers/projectSignature.d.ts +0 -5
  176. package/dist/studio-api/helpers/projectSignature.d.ts.map +0 -1
  177. package/dist/studio-api/helpers/projectSignature.js +0 -154
  178. package/dist/studio-api/helpers/projectSignature.js.map +0 -1
  179. package/dist/studio-api/helpers/safePath.d.ts +0 -12
  180. package/dist/studio-api/helpers/safePath.d.ts.map +0 -1
  181. package/dist/studio-api/helpers/safePath.js +0 -38
  182. package/dist/studio-api/helpers/safePath.js.map +0 -1
  183. package/dist/studio-api/helpers/sourceMutation.d.ts +0 -28
  184. package/dist/studio-api/helpers/sourceMutation.d.ts.map +0 -1
  185. package/dist/studio-api/helpers/sourceMutation.js +0 -339
  186. package/dist/studio-api/helpers/sourceMutation.js.map +0 -1
  187. package/dist/studio-api/helpers/subComposition.d.ts +0 -20
  188. package/dist/studio-api/helpers/subComposition.d.ts.map +0 -1
  189. package/dist/studio-api/helpers/subComposition.js +0 -289
  190. package/dist/studio-api/helpers/subComposition.js.map +0 -1
  191. package/dist/studio-api/helpers/waveform.d.ts +0 -4
  192. package/dist/studio-api/helpers/waveform.d.ts.map +0 -1
  193. package/dist/studio-api/helpers/waveform.js +0 -80
  194. package/dist/studio-api/helpers/waveform.js.map +0 -1
  195. package/dist/studio-api/routes/files.d.ts +0 -4
  196. package/dist/studio-api/routes/files.d.ts.map +0 -1
  197. package/dist/studio-api/routes/files.js +0 -1200
  198. package/dist/studio-api/routes/files.js.map +0 -1
  199. package/dist/studio-api/routes/fonts.d.ts +0 -3
  200. package/dist/studio-api/routes/fonts.d.ts.map +0 -1
  201. package/dist/studio-api/routes/fonts.js +0 -157
  202. package/dist/studio-api/routes/fonts.js.map +0 -1
  203. package/dist/studio-api/routes/lint.d.ts +0 -4
  204. package/dist/studio-api/routes/lint.d.ts.map +0 -1
  205. package/dist/studio-api/routes/lint.js +0 -29
  206. package/dist/studio-api/routes/lint.js.map +0 -1
  207. package/dist/studio-api/routes/preview.d.ts +0 -4
  208. package/dist/studio-api/routes/preview.d.ts.map +0 -1
  209. package/dist/studio-api/routes/preview.js +0 -331
  210. package/dist/studio-api/routes/preview.js.map +0 -1
  211. package/dist/studio-api/routes/projects.d.ts +0 -4
  212. package/dist/studio-api/routes/projects.d.ts.map +0 -1
  213. package/dist/studio-api/routes/projects.js +0 -45
  214. package/dist/studio-api/routes/projects.js.map +0 -1
  215. package/dist/studio-api/routes/registry.d.ts +0 -4
  216. package/dist/studio-api/routes/registry.d.ts.map +0 -1
  217. package/dist/studio-api/routes/registry.js +0 -31
  218. package/dist/studio-api/routes/registry.js.map +0 -1
  219. package/dist/studio-api/routes/render.d.ts +0 -4
  220. package/dist/studio-api/routes/render.d.ts.map +0 -1
  221. package/dist/studio-api/routes/render.js +0 -269
  222. package/dist/studio-api/routes/render.js.map +0 -1
  223. package/dist/studio-api/routes/storyboard.d.ts +0 -4
  224. package/dist/studio-api/routes/storyboard.d.ts.map +0 -1
  225. package/dist/studio-api/routes/storyboard.js +0 -65
  226. package/dist/studio-api/routes/storyboard.js.map +0 -1
  227. package/dist/studio-api/routes/thumbnail.d.ts +0 -4
  228. package/dist/studio-api/routes/thumbnail.d.ts.map +0 -1
  229. package/dist/studio-api/routes/thumbnail.js +0 -107
  230. package/dist/studio-api/routes/thumbnail.js.map +0 -1
  231. package/dist/studio-api/routes/waveform.d.ts +0 -4
  232. package/dist/studio-api/routes/waveform.d.ts.map +0 -1
  233. package/dist/studio-api/routes/waveform.js +0 -41
  234. package/dist/studio-api/routes/waveform.js.map +0 -1
  235. package/dist/studio-api/types.d.ts +0 -120
  236. package/dist/studio-api/types.d.ts.map +0 -1
  237. package/dist/studio-api/types.js +0 -2
  238. package/dist/studio-api/types.js.map +0 -1
@@ -1,264 +0,0 @@
1
- // Shared types, regex constants, and utility functions used across lint rule modules.
2
- // Nothing in this file should emit findings — it only parses and extracts.
3
- const TAG_PATTERN = /<([a-z][\w:-]*)(\s[^<>]*?)?>/gi;
4
- export const STYLE_BLOCK_PATTERN = /<style\b([^>]*)>([\s\S]*?)<\/style>/gi;
5
- export const SCRIPT_BLOCK_PATTERN = /<script\b([^>]*)>([\s\S]*?)<\/script>/gi;
6
- const COMPOSITION_ID_IN_CSS_PATTERN = /\[data-composition-id=["']([^"']+)["']\]/g;
7
- export const TIMELINE_REGISTRY_INIT_PATTERN = /window\.__timelines\s*=\s*window\.__timelines\s*\|\|\s*\{\}|window\.__timelines\s*=\s*\{\}|window\.__timelines\s*\?\?=\s*\{\}/i;
8
- export const TIMELINE_REGISTRY_ASSIGN_PATTERN = /window\.__timelines(?:\[[^\]]+\]|\.[A-Za-z_$][\w$]*)\s*=/i;
9
- export const WINDOW_TIMELINE_ASSIGN_PATTERN = /window\.__timelines(?:\[\s*["']([^"']+)["']\s*\]|\.\s*([A-Za-z_$][\w$]*))\s*=\s*([A-Za-z_$][\w$]*)/i;
10
- export const INVALID_SCRIPT_CLOSE_PATTERN = /<script[^>]*>[\s\S]*?<\s*\/\s*script(?!>)/i;
11
- const TIMELINE_REGISTRY_KEY_PATTERN = /window\.__timelines(?:\[\s*["']([^"']+)["']\s*\]|\.\s*([A-Za-z_$][\w$]*))\s*=/g;
12
- export function extractOpenTags(source) {
13
- const tags = [];
14
- let match;
15
- const pattern = new RegExp(TAG_PATTERN.source, TAG_PATTERN.flags);
16
- while ((match = pattern.exec(source)) !== null) {
17
- const raw = match[0];
18
- if (raw.startsWith("</") || raw.startsWith("<!"))
19
- continue;
20
- tags.push({
21
- raw,
22
- name: (match[1] || "").toLowerCase(),
23
- attrs: match[2] || "",
24
- index: match.index,
25
- });
26
- }
27
- return tags;
28
- }
29
- export function extractBlocks(source, pattern) {
30
- const blocks = [];
31
- let match;
32
- const p = new RegExp(pattern.source, pattern.flags);
33
- while ((match = p.exec(source)) !== null) {
34
- blocks.push({
35
- attrs: match[1] || "",
36
- content: match[2] || "",
37
- raw: match[0],
38
- index: match.index,
39
- });
40
- }
41
- return blocks;
42
- }
43
- /**
44
- * Find the `<html>` open tag in the source. Distinct from `findRootTag`,
45
- * which returns the first element inside `<body>` — the latter is "the
46
- * composition's visible root", whereas `<html>` is where document-level
47
- * metadata like `data-composition-variables` lives.
48
- */
49
- export function findHtmlTag(source) {
50
- const match = /<html\b([^<>]*)>/i.exec(source);
51
- if (!match)
52
- return null;
53
- return {
54
- raw: match[0],
55
- name: "html",
56
- attrs: match[1] ?? "",
57
- index: match.index,
58
- };
59
- }
60
- export function findRootTag(source) {
61
- const bodyOpenMatch = /<body\b([^>]*)>/i.exec(source);
62
- const bodyCloseMatch = /<\/body>/i.exec(source);
63
- if (bodyOpenMatch &&
64
- (readAttr(bodyOpenMatch[0], "data-composition-id") ||
65
- readAttr(bodyOpenMatch[0], "data-width") ||
66
- readAttr(bodyOpenMatch[0], "data-height"))) {
67
- return {
68
- raw: bodyOpenMatch[0],
69
- name: "body",
70
- attrs: bodyOpenMatch[1] ?? "",
71
- index: bodyOpenMatch.index,
72
- };
73
- }
74
- const bodyStart = bodyOpenMatch ? bodyOpenMatch.index + bodyOpenMatch[0].length : 0;
75
- const bodyEnd = bodyOpenMatch && bodyCloseMatch && bodyCloseMatch.index > bodyStart
76
- ? bodyCloseMatch.index
77
- : source.length;
78
- const bodyContent = bodyOpenMatch ? source.slice(bodyStart, bodyEnd) : source;
79
- const bodyTags = extractOpenTags(bodyContent);
80
- for (const tag of bodyTags) {
81
- if (["script", "style", "meta", "link", "title"].includes(tag.name))
82
- continue;
83
- return { ...tag, index: tag.index + bodyStart };
84
- }
85
- return null;
86
- }
87
- export function readAttr(tagSource, attr) {
88
- if (!tagSource)
89
- return null;
90
- const escaped = attr.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
91
- const match = tagSource.match(new RegExp(`\\b${escaped}\\s*=\\s*["']([^"']+)["']`, "i"));
92
- return match?.[1] || null;
93
- }
94
- /**
95
- * Read an attribute that may legitimately contain the opposite quote
96
- * character. `readAttr` truncates `data-variable-values='{"title":"Hello"}'`
97
- * at the first internal `"` because its `[^"']+` class excludes both quote
98
- * types. This variant alternates: a double-quoted value never contains an
99
- * unescaped `"`, and a single-quoted value never contains an unescaped `'`,
100
- * so each branch can use a quote-specific class.
101
- *
102
- * Use for attributes whose values are JSON or otherwise carry the opposite
103
- * quote character. Existing single-token attributes (`id`, `class`, etc.)
104
- * stick with `readAttr` for consistency with the rest of the lint code.
105
- */
106
- export function readJsonAttr(tagSource, attr) {
107
- if (!tagSource)
108
- return null;
109
- const escaped = attr.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
110
- const match = tagSource.match(new RegExp(`\\b${escaped}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`, "i"));
111
- if (!match)
112
- return null;
113
- return match[1] ?? match[2] ?? null;
114
- }
115
- export function collectCompositionIds(tags) {
116
- const ids = new Set();
117
- for (const tag of tags) {
118
- const compId = readAttr(tag.raw, "data-composition-id");
119
- if (compId)
120
- ids.add(compId);
121
- }
122
- return ids;
123
- }
124
- export function extractCompositionIdsFromCss(css) {
125
- const ids = new Set();
126
- let match;
127
- const pattern = new RegExp(COMPOSITION_ID_IN_CSS_PATTERN.source, COMPOSITION_ID_IN_CSS_PATTERN.flags);
128
- while ((match = pattern.exec(css)) !== null) {
129
- if (match[1])
130
- ids.add(match[1]);
131
- }
132
- return [...ids];
133
- }
134
- export function extractTimelineRegistryKeys(source) {
135
- const keys = new Set();
136
- let match;
137
- const pattern = new RegExp(TIMELINE_REGISTRY_KEY_PATTERN.source, TIMELINE_REGISTRY_KEY_PATTERN.flags);
138
- while ((match = pattern.exec(source)) !== null) {
139
- const key = match[1] ?? match[2];
140
- if (key)
141
- keys.add(key);
142
- }
143
- return [...keys];
144
- }
145
- export function getInlineScriptSyntaxError(source) {
146
- if (!source.trim())
147
- return null;
148
- try {
149
- // eslint-disable-next-line no-new-func
150
- new Function(source);
151
- return null;
152
- }
153
- catch (error) {
154
- if (error instanceof Error)
155
- return error.message;
156
- return String(error);
157
- }
158
- }
159
- // fallow-ignore-next-line complexity
160
- export function stripJsComments(source) {
161
- let out = "";
162
- let i = 0;
163
- let quote = null;
164
- let escaped = false;
165
- while (i < source.length) {
166
- const ch = source[i] ?? "";
167
- const next = source[i + 1] ?? "";
168
- if (quote) {
169
- out += ch;
170
- if (escaped) {
171
- escaped = false;
172
- }
173
- else if (ch === "\\") {
174
- escaped = true;
175
- }
176
- else if (ch === quote) {
177
- quote = null;
178
- }
179
- i += 1;
180
- continue;
181
- }
182
- if (ch === "'" || ch === '"' || ch === "`") {
183
- quote = ch;
184
- out += ch;
185
- i += 1;
186
- continue;
187
- }
188
- if (ch === "/" && next === "/") {
189
- out += " ";
190
- i += 2;
191
- while (i < source.length && source[i] !== "\n" && source[i] !== "\r") {
192
- out += " ";
193
- i += 1;
194
- }
195
- continue;
196
- }
197
- if (ch === "/" && next === "*") {
198
- out += " ";
199
- i += 2;
200
- while (i < source.length) {
201
- const blockCh = source[i] ?? "";
202
- const blockNext = source[i + 1] ?? "";
203
- if (blockCh === "*" && blockNext === "/") {
204
- out += " ";
205
- i += 2;
206
- break;
207
- }
208
- out += blockCh === "\n" || blockCh === "\r" ? blockCh : " ";
209
- i += 1;
210
- }
211
- continue;
212
- }
213
- out += ch;
214
- i += 1;
215
- }
216
- return out;
217
- }
218
- // One linear pass that drops every `<!-- … -->` region. Uses indexOf, not a
219
- // `/<!--[\s\S]*?-->/` regex: that pattern backtracks O(n²) on inputs with many
220
- // unterminated "<!--" (CodeQL js/polynomial-redos). An unterminated "<!--" with
221
- // no closing "-->" is kept verbatim, matching the prior regex's no-match behavior.
222
- function stripHtmlCommentsOnce(source) {
223
- let out = "";
224
- let i = 0;
225
- for (;;) {
226
- const start = source.indexOf("<!--", i);
227
- if (start < 0)
228
- return out + source.slice(i);
229
- const end = source.indexOf("-->", start + 4);
230
- if (end < 0)
231
- return out + source.slice(i);
232
- out += source.slice(i, start);
233
- i = end + 3;
234
- }
235
- }
236
- // Strip HTML comments to a fixpoint. A single pass is not enough: deleting one
237
- // comment can splice adjacent markers into a fresh, complete <!-- … --> (e.g.
238
- // "<<!-- -->!-- … -->" → "<!-- … -->"), which would otherwise survive and let a
239
- // commented-out <template>/tag hijack the linter's tag scan.
240
- export function stripHtmlComments(source) {
241
- let out = source;
242
- for (let prev = ""; prev !== out;) {
243
- prev = out;
244
- out = stripHtmlCommentsOnce(out);
245
- }
246
- return out;
247
- }
248
- export function extractScriptTextsAndSrcs(scripts) {
249
- const texts = scripts.filter((s) => !/\bsrc\s*=/.test(s.attrs)).map((s) => s.content);
250
- const srcs = scripts.map((s) => readAttr(`<script ${s.attrs}>`, "src") || "").filter(Boolean);
251
- return { texts, srcs };
252
- }
253
- export function isMediaTag(tagName) {
254
- return tagName === "video" || tagName === "audio" || tagName === "img";
255
- }
256
- export function truncateSnippet(value, maxLength = 220) {
257
- const normalized = value.replace(/\s+/g, " ").trim();
258
- if (!normalized)
259
- return undefined;
260
- if (normalized.length <= maxLength)
261
- return normalized;
262
- return `${normalized.slice(0, maxLength - 3)}...`;
263
- }
264
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/lint/utils.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,2EAA2E;AAgB3E,MAAM,WAAW,GAAG,gCAAgC,CAAC;AACrD,MAAM,CAAC,MAAM,mBAAmB,GAAG,uCAAuC,CAAC;AAC3E,MAAM,CAAC,MAAM,oBAAoB,GAAG,yCAAyC,CAAC;AAC9E,MAAM,6BAA6B,GAAG,2CAA2C,CAAC;AAClF,MAAM,CAAC,MAAM,8BAA8B,GACzC,gIAAgI,CAAC;AACnI,MAAM,CAAC,MAAM,gCAAgC,GAC3C,2DAA2D,CAAC;AAC9D,MAAM,CAAC,MAAM,8BAA8B,GACzC,qGAAqG,CAAC;AACxG,MAAM,CAAC,MAAM,4BAA4B,GAAG,4CAA4C,CAAC;AAEzF,MAAM,6BAA6B,GACjC,gFAAgF,CAAC;AAEnF,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,MAAM,IAAI,GAAc,EAAE,CAAC;IAC3B,IAAI,KAA6B,CAAC;IAClC,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,C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AC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IACtF,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,KAAK,GAAG,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC9F,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,OAAO,OAAO,KAAK,OAAO,IAAI,OAAO,KAAK,OAAO,IAAI,OAAO,KAAK,KAAK,CAAC;AACzE,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAAa,EAAE,SAAS,GAAG,GAAG;IAC5D,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IACrD,IAAI,CAAC,UAAU;QAAE,OAAO,SAAS,CAAC;IAClC,IAAI,UAAU,CAAC,MAAM,IAAI,SAAS;QAAE,OAAO,UAAU,CAAC;IACtD,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC;AACpD,CAAC"}
@@ -1,47 +0,0 @@
1
- /**
2
- * Static evaluation for computed GSAP timelines (browser-safe, acorn/ESTree).
3
- *
4
- * The read parser resolves only literals and top-level consts, so timelines
5
- * built by a helper called N times or by a bounded loop collapse to position 0.
6
- * This module expands those constructs into a synthetic analysis AST: each
7
- * helper invocation and each loop iteration becomes its own concrete set of
8
- * `tl.*` calls, with parameters/loop-vars substituted by the call's argument
9
- * (or element/index) AST nodes — after which the existing parse pipeline
10
- * resolves positions and `motionPath` arcs unchanged.
11
- *
12
- * Substituted nodes keep their original source offsets, so downstream
13
- * source-slicing (raw extras, keyframes) stays correct. The substitution
14
- * primitives never mutate their input; `inlineComputedTimelines` rewrites the
15
- * Program body of the freshly-parsed AST it is handed (owned by the caller).
16
- */
17
- import type { GsapProvenance } from "./gsapSerialize.js";
18
- type Node = any;
19
- /** Deep structural clone preserving `start`/`end`/`loc` (needed for source slicing). */
20
- export declare function cloneNode<T extends Node>(node: T): T;
21
- /**
22
- * Substitute bound identifiers in an already-cloned subtree, returning the
23
- * (possibly replaced) root. Names shadowed anywhere inside (nested function
24
- * params, declared vars) are dropped up front rather than tracked per scope —
25
- * worst case we under-substitute and the caller falls back to current behavior.
26
- * Never substitutes identifiers in key/member positions. Mutates the passed
27
- * clone in place — callers pass `cloneNode(...)`.
28
- */
29
- export declare function substituteParams(node: Node, bindings: ReadonlyMap<string, Node>): Node;
30
- /** Tag a node (typically a `tl.*` CallExpression) with its construction provenance. */
31
- export declare function tagProvenance(node: Node, provenance: GsapProvenance): Node;
32
- /** Read a provenance tag previously set by `tagProvenance`, if any. */
33
- export declare function readProvenance(node: Node): GsapProvenance | undefined;
34
- /** Synthesize a numeric `Literal` node (for loop indices, which have no source node). */
35
- export declare function numericLiteral(value: number): Node;
36
- /** Resolve an expression to a literal value (top-level consts in scope, arithmetic). */
37
- type LiteralResolver = (node: Node) => number | string | boolean | undefined;
38
- /**
39
- * Rewrite the Program body so helper invocations and bounded loops that build
40
- * the timeline are expanded into concrete per-call / per-iteration `tl.*`
41
- * statements, each tagged with provenance. Mutates `ast` in place (caller owns
42
- * the freshly-parsed tree). Constructs it can't statically resolve are left
43
- * untouched, so the parser falls back to current behavior for them.
44
- */
45
- export declare function inlineComputedTimelines(ast: Node, timelineVar: string, resolve: LiteralResolver): void;
46
- export {};
47
- //# sourceMappingURL=gsapInline.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gsapInline.d.ts","sourceRoot":"","sources":["../../src/parsers/gsapInline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,KAAK,IAAI,GAAG,GAAG,CAAC;AAyChB,wFAAwF;AACxF,wBAAgB,SAAS,CAAC,CAAC,SAAS,IAAI,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAEpD;AAoCD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,IAAI,CAStF;AAWD,uFAAuF;AACvF,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,cAAc,GAAG,IAAI,CAG1E;AAED,uEAAuE;AACvE,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,cAAc,GAAG,SAAS,CAErE;AAED,yFAAyF;AACzF,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAElD;AAID,wFAAwF;AACxF,KAAK,eAAe,GAAG,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AA8Z7E;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,IAAI,EACT,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,eAAe,GACvB,IAAI,CAYN"}