@atlaspack/transformer-xml 2.14.5-canary.49 → 2.14.5-canary.491

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,446 @@
1
1
  # @atlaspack/transformer-xml
2
2
 
3
+ ## 2.14.64
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @atlaspack/types-internal@2.25.6
9
+ - @atlaspack/plugin@2.14.64
10
+
11
+ ## 2.14.63
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies []:
16
+ - @atlaspack/types-internal@2.25.5
17
+ - @atlaspack/plugin@2.14.63
18
+
19
+ ## 2.14.62
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies []:
24
+ - @atlaspack/types-internal@2.25.4
25
+ - @atlaspack/plugin@2.14.62
26
+
27
+ ## 2.14.61
28
+
29
+ ### Patch Changes
30
+
31
+ - Updated dependencies []:
32
+ - @atlaspack/types-internal@2.25.3
33
+ - @atlaspack/plugin@2.14.61
34
+
35
+ ## 2.14.60
36
+
37
+ ### Patch Changes
38
+
39
+ - Updated dependencies []:
40
+ - @atlaspack/types-internal@2.25.2
41
+ - @atlaspack/plugin@2.14.60
42
+
43
+ ## 2.14.59
44
+
45
+ ### Patch Changes
46
+
47
+ - Updated dependencies []:
48
+ - @atlaspack/types-internal@2.25.1
49
+ - @atlaspack/plugin@2.14.59
50
+
51
+ ## 2.14.58
52
+
53
+ ### Patch Changes
54
+
55
+ - Updated dependencies [[`71981ea`](https://github.com/atlassian-labs/atlaspack/commit/71981eac258f7e6dfb40ec4b202d194f71c64ff1)]:
56
+ - @atlaspack/types-internal@2.25.0
57
+ - @atlaspack/plugin@2.14.58
58
+
59
+ ## 2.14.57
60
+
61
+ ### Patch Changes
62
+
63
+ - Updated dependencies []:
64
+ - @atlaspack/types-internal@2.24.2
65
+ - @atlaspack/plugin@2.14.57
66
+
67
+ ## 2.14.56
68
+
69
+ ### Patch Changes
70
+
71
+ - Updated dependencies []:
72
+ - @atlaspack/types-internal@2.24.1
73
+ - @atlaspack/plugin@2.14.56
74
+
75
+ ## 2.14.55
76
+
77
+ ### Patch Changes
78
+
79
+ - Updated dependencies [[`857962a`](https://github.com/atlassian-labs/atlaspack/commit/857962a352bb0aebaf74a8765e8c44d7e875a4e9)]:
80
+ - @atlaspack/types-internal@2.24.0
81
+ - @atlaspack/plugin@2.14.55
82
+
83
+ ## 2.14.54
84
+
85
+ ### Patch Changes
86
+
87
+ - Updated dependencies []:
88
+ - @atlaspack/types-internal@2.23.2
89
+ - @atlaspack/plugin@2.14.54
90
+
91
+ ## 2.14.53
92
+
93
+ ### Patch Changes
94
+
95
+ - Updated dependencies []:
96
+ - @atlaspack/types-internal@2.23.1
97
+ - @atlaspack/plugin@2.14.53
98
+
99
+ ## 2.14.52
100
+
101
+ ### Patch Changes
102
+
103
+ - Updated dependencies [[`e058f0e`](https://github.com/atlassian-labs/atlaspack/commit/e058f0e7a0423ba9373e85a7dbd5c1dd43b47916)]:
104
+ - @atlaspack/types-internal@2.23.0
105
+ - @atlaspack/plugin@2.14.52
106
+
107
+ ## 2.14.51
108
+
109
+ ### Patch Changes
110
+
111
+ - Updated dependencies []:
112
+ - @atlaspack/types-internal@2.22.8
113
+ - @atlaspack/plugin@2.14.51
114
+
115
+ ## 2.14.50
116
+
117
+ ### Patch Changes
118
+
119
+ - Updated dependencies []:
120
+ - @atlaspack/types-internal@2.22.7
121
+ - @atlaspack/plugin@2.14.50
122
+
123
+ ## 2.14.49
124
+
125
+ ### Patch Changes
126
+
127
+ - Updated dependencies []:
128
+ - @atlaspack/types-internal@2.22.6
129
+ - @atlaspack/plugin@2.14.49
130
+
131
+ ## 2.14.48
132
+
133
+ ### Patch Changes
134
+
135
+ - Updated dependencies []:
136
+ - @atlaspack/types-internal@2.22.5
137
+ - @atlaspack/plugin@2.14.48
138
+
139
+ ## 2.14.47
140
+
141
+ ### Patch Changes
142
+
143
+ - Updated dependencies []:
144
+ - @atlaspack/types-internal@2.22.4
145
+ - @atlaspack/plugin@2.14.47
146
+
147
+ ## 2.14.46
148
+
149
+ ### Patch Changes
150
+
151
+ - Updated dependencies [[`02cc8b3`](https://github.com/atlassian-labs/atlaspack/commit/02cc8b32c06ca6b51806b33f6f707ca06e55e957)]:
152
+ - @atlaspack/types-internal@2.22.3
153
+ - @atlaspack/plugin@2.14.46
154
+
155
+ ## 2.14.45
156
+
157
+ ### Patch Changes
158
+
159
+ - Updated dependencies []:
160
+ - @atlaspack/types-internal@2.22.2
161
+ - @atlaspack/plugin@2.14.45
162
+
163
+ ## 2.14.44
164
+
165
+ ### Patch Changes
166
+
167
+ - Updated dependencies []:
168
+ - @atlaspack/types-internal@2.22.1
169
+ - @atlaspack/plugin@2.14.44
170
+
171
+ ## 2.14.43
172
+
173
+ ### Patch Changes
174
+
175
+ - Updated dependencies [[`00fa643`](https://github.com/atlassian-labs/atlaspack/commit/00fa6433202bfd3311479f6314c9ec878a789f2c)]:
176
+ - @atlaspack/types-internal@2.22.0
177
+ - @atlaspack/plugin@2.14.43
178
+
179
+ ## 2.14.42
180
+
181
+ ### Patch Changes
182
+
183
+ - Updated dependencies []:
184
+ - @atlaspack/types-internal@2.21.3
185
+ - @atlaspack/plugin@2.14.42
186
+
187
+ ## 2.14.41
188
+
189
+ ### Patch Changes
190
+
191
+ - Updated dependencies []:
192
+ - @atlaspack/types-internal@2.21.2
193
+ - @atlaspack/plugin@2.14.41
194
+
195
+ ## 2.14.40
196
+
197
+ ### Patch Changes
198
+
199
+ - Updated dependencies []:
200
+ - @atlaspack/types-internal@2.21.1
201
+ - @atlaspack/plugin@2.14.40
202
+
203
+ ## 2.14.39
204
+
205
+ ### Patch Changes
206
+
207
+ - Updated dependencies [[`8eb84ee`](https://github.com/atlassian-labs/atlaspack/commit/8eb84ee61a42bfe87c58079b610802b07a6a13e4), [`73168c2`](https://github.com/atlassian-labs/atlaspack/commit/73168c275a5d9abff9907bcf536b340bca1ed5f0), [`617a318`](https://github.com/atlassian-labs/atlaspack/commit/617a318ddc9419b38360257353fec50b9051ee13)]:
208
+ - @atlaspack/types-internal@2.21.0
209
+ - @atlaspack/plugin@2.14.39
210
+
211
+ ## 2.14.38
212
+
213
+ ### Patch Changes
214
+
215
+ - Updated dependencies []:
216
+ - @atlaspack/types-internal@2.20.8
217
+ - @atlaspack/plugin@2.14.38
218
+
219
+ ## 2.14.37
220
+
221
+ ### Patch Changes
222
+
223
+ - Updated dependencies []:
224
+ - @atlaspack/types-internal@2.20.7
225
+ - @atlaspack/plugin@2.14.37
226
+
227
+ ## 2.14.36
228
+
229
+ ### Patch Changes
230
+
231
+ - Updated dependencies []:
232
+ - @atlaspack/types-internal@2.20.6
233
+ - @atlaspack/plugin@2.14.36
234
+
235
+ ## 2.14.35
236
+
237
+ ### Patch Changes
238
+
239
+ - Updated dependencies [[`c372f3f`](https://github.com/atlassian-labs/atlaspack/commit/c372f3fd6fce8200d5cf47f41bc7895c6cbb5558)]:
240
+ - @atlaspack/types-internal@2.20.5
241
+ - @atlaspack/plugin@2.14.35
242
+
243
+ ## 2.14.34
244
+
245
+ ### Patch Changes
246
+
247
+ - Updated dependencies []:
248
+ - @atlaspack/types-internal@2.20.4
249
+ - @atlaspack/plugin@2.14.34
250
+
251
+ ## 2.14.33
252
+
253
+ ### Patch Changes
254
+
255
+ - Updated dependencies []:
256
+ - @atlaspack/types-internal@2.20.3
257
+ - @atlaspack/plugin@2.14.33
258
+
259
+ ## 2.14.32
260
+
261
+ ### Patch Changes
262
+
263
+ - Updated dependencies []:
264
+ - @atlaspack/types-internal@2.20.2
265
+ - @atlaspack/plugin@2.14.32
266
+
267
+ ## 2.14.31
268
+
269
+ ### Patch Changes
270
+
271
+ - [#785](https://github.com/atlassian-labs/atlaspack/pull/785) [`0e7dd5e`](https://github.com/atlassian-labs/atlaspack/commit/0e7dd5ec6fbe05aa9e0bb5775a9d0975f206a922) Thanks [@matt-koko](https://github.com/matt-koko)! - We need to re-publish every package in Atlaspack with the corrected types field.
272
+
273
+ - Updated dependencies [[`0e7dd5e`](https://github.com/atlassian-labs/atlaspack/commit/0e7dd5ec6fbe05aa9e0bb5775a9d0975f206a922)]:
274
+ - @atlaspack/plugin@2.14.31
275
+ - @atlaspack/types-internal@2.20.1
276
+
277
+ ## 2.14.30
278
+
279
+ ### Patch Changes
280
+
281
+ - Updated dependencies [[`eedcbc4`](https://github.com/atlassian-labs/atlaspack/commit/eedcbc408fc1e86a2a8e25f1a41c57146d8529e1), [`f6532d7`](https://github.com/atlassian-labs/atlaspack/commit/f6532d7a4f7f007bd4e5e36af04dd466f0b9f572)]:
282
+ - @atlaspack/types-internal@2.20.0
283
+ - @atlaspack/plugin@2.14.30
284
+
285
+ ## 2.14.29
286
+
287
+ ### Patch Changes
288
+
289
+ - Updated dependencies []:
290
+ - @atlaspack/types-internal@2.19.5
291
+ - @atlaspack/plugin@2.14.29
292
+
293
+ ## 2.14.28
294
+
295
+ ### Patch Changes
296
+
297
+ - Updated dependencies []:
298
+ - @atlaspack/types-internal@2.19.4
299
+ - @atlaspack/plugin@2.14.28
300
+
301
+ ## 2.14.27
302
+
303
+ ### Patch Changes
304
+
305
+ - Updated dependencies []:
306
+ - @atlaspack/types-internal@2.19.3
307
+ - @atlaspack/plugin@2.14.27
308
+
309
+ ## 2.14.26
310
+
311
+ ### Patch Changes
312
+
313
+ - [#742](https://github.com/atlassian-labs/atlaspack/pull/742) [`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd) Thanks [@yamadapc](https://github.com/yamadapc)! - Internal changes and bug fixes to environmentDeduplication flag
314
+
315
+ - Updated dependencies [[`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd)]:
316
+ - @atlaspack/types-internal@2.19.2
317
+ - @atlaspack/plugin@2.14.26
318
+
319
+ ## 2.14.25
320
+
321
+ ### Patch Changes
322
+
323
+ - Updated dependencies []:
324
+ - @atlaspack/types-internal@2.19.1
325
+ - @atlaspack/plugin@2.14.25
326
+
327
+ ## 2.14.24
328
+
329
+ ### Patch Changes
330
+
331
+ - Updated dependencies [[`7f5841c`](https://github.com/atlassian-labs/atlaspack/commit/7f5841c39df049f9546cccbeea2a7337e0337b45)]:
332
+ - @atlaspack/types-internal@2.19.0
333
+ - @atlaspack/plugin@2.14.24
334
+
335
+ ## 2.14.23
336
+
337
+ ### Patch Changes
338
+
339
+ - Updated dependencies []:
340
+ - @atlaspack/plugin@2.14.23
341
+
342
+ ## 2.14.22
343
+
344
+ ### Patch Changes
345
+
346
+ - [#720](https://github.com/atlassian-labs/atlaspack/pull/720) [`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94) Thanks [@alshdavid](https://github.com/alshdavid)! - Migrate to TypeScript
347
+
348
+ - Updated dependencies [[`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94)]:
349
+ - @atlaspack/plugin@2.14.22
350
+
351
+ ## 2.14.21
352
+
353
+ ### Patch Changes
354
+
355
+ - Updated dependencies []:
356
+ - @atlaspack/plugin@2.14.21
357
+
358
+ ## 2.14.20
359
+
360
+ ### Patch Changes
361
+
362
+ - [#702](https://github.com/atlassian-labs/atlaspack/pull/702) [`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa) Thanks [@alshdavid](https://github.com/alshdavid)! - Fixes to Flow types
363
+
364
+ - Updated dependencies [[`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa)]:
365
+ - @atlaspack/plugin@2.14.20
366
+
367
+ ## 2.14.19
368
+
369
+ ### Patch Changes
370
+
371
+ - Updated dependencies []:
372
+ - @atlaspack/plugin@2.14.19
373
+
374
+ ## 2.14.18
375
+
376
+ ### Patch Changes
377
+
378
+ - Updated dependencies []:
379
+ - @atlaspack/plugin@2.14.18
380
+
381
+ ## 2.14.17
382
+
383
+ ### Patch Changes
384
+
385
+ - Updated dependencies []:
386
+ - @atlaspack/plugin@2.14.17
387
+
388
+ ## 2.14.16
389
+
390
+ ### Patch Changes
391
+
392
+ - Updated dependencies []:
393
+ - @atlaspack/plugin@2.14.16
394
+
395
+ ## 2.14.15
396
+
397
+ ### Patch Changes
398
+
399
+ - Updated dependencies []:
400
+ - @atlaspack/plugin@2.14.15
401
+
402
+ ## 2.14.14
403
+
404
+ ### Patch Changes
405
+
406
+ - Updated dependencies []:
407
+ - @atlaspack/plugin@2.14.14
408
+
409
+ ## 2.14.13
410
+
411
+ ### Patch Changes
412
+
413
+ - Updated dependencies []:
414
+ - @atlaspack/plugin@2.14.13
415
+
416
+ ## 2.14.12
417
+
418
+ ### Patch Changes
419
+
420
+ - Updated dependencies []:
421
+ - @atlaspack/plugin@2.14.12
422
+
423
+ ## 2.14.11
424
+
425
+ ### Patch Changes
426
+
427
+ - Updated dependencies []:
428
+ - @atlaspack/plugin@2.14.11
429
+
430
+ ## 2.14.10
431
+
432
+ ### Patch Changes
433
+
434
+ - Updated dependencies []:
435
+ - @atlaspack/plugin@2.14.10
436
+
437
+ ## 2.14.9
438
+
439
+ ### Patch Changes
440
+
441
+ - Updated dependencies []:
442
+ - @atlaspack/plugin@2.14.9
443
+
3
444
  ## 2.14.8
4
445
 
5
446
  ### Patch Changes
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ const plugin_1 = require("@atlaspack/plugin");
37
+ const xmldom_1 = require("@xmldom/xmldom");
38
+ const atom = __importStar(require("./atom"));
39
+ const processingInstruction = __importStar(require("./processing-instruction"));
40
+ const rss = __importStar(require("./rss"));
41
+ const HANDLERS = {
42
+ 'http://www.w3.org/2005/Atom': atom,
43
+ };
44
+ const NON_NAMESPACED_HANDLERS = {
45
+ rss,
46
+ };
47
+ exports.default = new plugin_1.Transformer({
48
+ async transform({ asset }) {
49
+ let code = await asset.getCode();
50
+ let parser = new xmldom_1.DOMParser();
51
+ let dom = parser.parseFromString(code, 'application/xml');
52
+ let parts = [];
53
+ let nonNamespacedHandlers = !dom.documentElement.namespaceURI
54
+ ? // @ts-expect-error TS7053
55
+ NON_NAMESPACED_HANDLERS[dom.documentElement.nodeName] || {}
56
+ : {};
57
+ walk(dom, (node) => {
58
+ let handler = node.nodeType === node.ELEMENT_NODE
59
+ ? node.namespaceURI
60
+ ? // @ts-expect-error TS7053
61
+ HANDLERS[node.namespaceURI]?.[node.localName]
62
+ : nonNamespacedHandlers[node.nodeName]
63
+ : node.nodeType === node.PROCESSING_INSTRUCTION_NODE
64
+ ? // @ts-expect-error TS7053
65
+ processingInstruction[node.target]
66
+ : undefined;
67
+ if (handler) {
68
+ handler(node, asset, parts);
69
+ }
70
+ });
71
+ code = new xmldom_1.XMLSerializer().serializeToString(dom);
72
+ asset.setCode(code);
73
+ return [asset, ...parts];
74
+ },
75
+ });
76
+ function walk(element, visit) {
77
+ visit(element);
78
+ element = element.firstChild;
79
+ while (element) {
80
+ walk(element, visit);
81
+ element = element.nextSibling;
82
+ }
83
+ }
package/dist/atom.js ADDED
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.logo = exports.icon = void 0;
4
+ exports.link = link;
5
+ exports.content = content;
6
+ const xmldom_1 = require("@xmldom/xmldom");
7
+ const utils_1 = require("./utils");
8
+ // Handlers for elements defined by the Atom spec.
9
+ // See https://datatracker.ietf.org/doc/html/rfc4287
10
+ function link(element, asset) {
11
+ let href = element.getAttribute('href');
12
+ if (href) {
13
+ href = asset.addURLDependency(href, {
14
+ needsStableName: true,
15
+ });
16
+ element.setAttribute('href', href);
17
+ }
18
+ }
19
+ exports.icon = utils_1.urlHandler;
20
+ exports.logo = utils_1.urlHandler;
21
+ function content(element, asset, parts) {
22
+ let type = element.getAttribute('type');
23
+ let contents;
24
+ switch (type) {
25
+ case 'html':
26
+ contents = element.textContent;
27
+ element.textContent = '';
28
+ break;
29
+ case 'xhtml': {
30
+ let fragment = element.ownerDocument.createDocumentFragment();
31
+ let child;
32
+ while ((child = element.firstChild)) {
33
+ element.removeChild(child);
34
+ fragment.appendChild(child.cloneNode(true));
35
+ }
36
+ contents = new xmldom_1.XMLSerializer().serializeToString(fragment);
37
+ break;
38
+ }
39
+ default:
40
+ return;
41
+ }
42
+ if (contents) {
43
+ let parcelKey = `${asset.id}:${parts.length}`;
44
+ let el = element.ownerDocument.createElementNS('https://parceljs.org', 'inline');
45
+ el.setAttribute('key', parcelKey);
46
+ el.setAttribute('type', type);
47
+ element.appendChild(el);
48
+ asset.addDependency({
49
+ specifier: parcelKey,
50
+ specifierType: 'esm',
51
+ bundleBehavior: 'inline',
52
+ });
53
+ parts.push({
54
+ type,
55
+ content: contents,
56
+ uniqueKey: parcelKey,
57
+ bundleBehavior: 'inline',
58
+ });
59
+ }
60
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const xmldom_1 = require("@xmldom/xmldom");
4
+ module.exports = {
5
+ 'xml-stylesheet': (node, asset) => {
6
+ const pseudo = new xmldom_1.DOMParser().parseFromString(`<ψ ${node.data} />`);
7
+ // @ts-expect-error TS18047
8
+ const input = pseudo.firstChild.getAttribute('href');
9
+ const output = asset.addURLDependency(input, { priority: 'parallel' });
10
+ // @ts-expect-error TS18047
11
+ pseudo.firstChild.setAttribute('href', output);
12
+ node.data = new xmldom_1.XMLSerializer().serializeToString(pseudo).slice(2, -2);
13
+ },
14
+ };
package/dist/rss.js ADDED
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.comments = exports.url = exports.link = void 0;
4
+ exports.enclosure = enclosure;
5
+ exports.description = description;
6
+ const utils_1 = require("./utils");
7
+ // Handlers for elements defined by the RSS spec.
8
+ // See https://validator.w3.org/feed/docs/rss2.html
9
+ exports.link = utils_1.urlHandler;
10
+ exports.url = utils_1.urlHandler;
11
+ exports.comments = utils_1.urlHandler;
12
+ function enclosure(element, asset) {
13
+ let url = element.getAttribute('url');
14
+ if (url) {
15
+ url = asset.addURLDependency(url, {});
16
+ element.setAttribute('url', url);
17
+ }
18
+ }
19
+ function description(element, asset, parts) {
20
+ let parcelKey = `${asset.id}:${parts.length}`;
21
+ asset.addDependency({
22
+ specifier: parcelKey,
23
+ specifierType: 'esm',
24
+ bundleBehavior: 'inline',
25
+ });
26
+ parts.push({
27
+ type: 'html',
28
+ content: element.textContent,
29
+ uniqueKey: parcelKey,
30
+ bundleBehavior: 'inline',
31
+ });
32
+ let child;
33
+ while ((child = element.firstChild)) {
34
+ element.removeChild(child);
35
+ }
36
+ let el = element.ownerDocument.createElementNS('https://parceljs.org', 'inline');
37
+ el.setAttribute('key', parcelKey);
38
+ element.appendChild(el);
39
+ }
package/dist/utils.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.urlHandler = urlHandler;
4
+ function urlHandler(element, asset) {
5
+ // @ts-expect-error TS18047
6
+ element.textContent = asset.addURLDependency(element.textContent.trim(), {
7
+ needsStableName: true,
8
+ });
9
+ }
@@ -21,8 +21,7 @@ function _xmldom() {
21
21
  var atom = _interopRequireWildcard(require("./atom"));
22
22
  var processingInstruction = _interopRequireWildcard(require("./processing-instruction"));
23
23
  var rss = _interopRequireWildcard(require("./rss"));
24
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
25
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
24
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
26
25
  const HANDLERS = {
27
26
  'http://www.w3.org/2005/Atom': atom
28
27
  };
@@ -37,10 +36,15 @@ var _default = exports.default = new (_plugin().Transformer)({
37
36
  let parser = new (_xmldom().DOMParser)();
38
37
  let dom = parser.parseFromString(code, 'application/xml');
39
38
  let parts = [];
40
- let nonNamespacedHandlers = !dom.documentElement.namespaceURI ? NON_NAMESPACED_HANDLERS[dom.documentElement.nodeName] || {} : {};
39
+ let nonNamespacedHandlers = !dom.documentElement.namespaceURI ?
40
+ // @ts-expect-error TS7053
41
+ NON_NAMESPACED_HANDLERS[dom.documentElement.nodeName] || {} : {};
41
42
  walk(dom, node => {
42
43
  var _HANDLERS$node$namesp;
43
- let handler = node.nodeType === node.ELEMENT_NODE ? node.namespaceURI ? (_HANDLERS$node$namesp = HANDLERS[node.namespaceURI]) === null || _HANDLERS$node$namesp === void 0 ? void 0 : _HANDLERS$node$namesp[node.localName] : nonNamespacedHandlers[node.nodeName] : node.nodeType === node.PROCESSING_INSTRUCTION_NODE ? processingInstruction[node.target] : undefined;
44
+ let handler = node.nodeType === node.ELEMENT_NODE ? node.namespaceURI ? // @ts-expect-error TS7053
45
+ (_HANDLERS$node$namesp = HANDLERS[node.namespaceURI]) === null || _HANDLERS$node$namesp === void 0 ? void 0 : _HANDLERS$node$namesp[node.localName] : nonNamespacedHandlers[node.nodeName] : node.nodeType === node.PROCESSING_INSTRUCTION_NODE ?
46
+ // @ts-expect-error TS7053
47
+ processingInstruction[node.target] : undefined;
44
48
  if (handler) {
45
49
  handler(node, asset, parts);
46
50
  }
package/lib/atom.js CHANGED
@@ -17,6 +17,7 @@ function _xmldom() {
17
17
  var _utils = require("./utils");
18
18
  // Handlers for elements defined by the Atom spec.
19
19
  // See https://datatracker.ietf.org/doc/html/rfc4287
20
+
20
21
  function link(element, asset) {
21
22
  let href = element.getAttribute('href');
22
23
  if (href) {