@atlaspack/packager-xml 2.14.5-canary.137 → 2.14.5-canary.139

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,14 @@
1
1
  # @atlaspack/packager-xml
2
2
 
3
+ ## 2.14.21
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @atlaspack/types@2.15.11
9
+ - @atlaspack/utils@2.17.3
10
+ - @atlaspack/plugin@2.14.21
11
+
3
12
  ## 2.14.20
4
13
 
5
14
  ### Patch Changes
@@ -0,0 +1,3 @@
1
+ import { Packager } from '@atlaspack/plugin';
2
+ declare const _default: Packager<unknown, unknown>;
3
+ export default _default;
@@ -39,6 +39,7 @@ var _default = exports.default = new (_plugin().Packager)({
39
39
  bundleGraph,
40
40
  getInlineBundleContents
41
41
  }) {
42
+ // @ts-expect-error TS2552
42
43
  const assets = [];
43
44
  bundle.traverseAssets(asset => {
44
45
  assets.push(asset);
@@ -62,10 +63,13 @@ var _default = exports.default = new (_plugin().Packager)({
62
63
  let parsed = new (_xmldom().DOMParser)().parseFromString(contents, 'application/xml');
63
64
  if (parsed.documentElement != null) {
64
65
  let parent = element.parentNode;
66
+ // @ts-expect-error TS18047
65
67
  parent.removeChild(element);
68
+ // @ts-expect-error TS18047
66
69
  parent.appendChild(parsed.documentElement);
67
70
  }
68
71
  } else {
72
+ // @ts-expect-error TS18047
69
73
  element.parentNode.textContent = contents;
70
74
  }
71
75
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/packager-xml",
3
- "version": "2.14.5-canary.137+069de478e",
3
+ "version": "2.14.5-canary.139+d2fd84977",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -9,17 +9,21 @@
9
9
  "type": "git",
10
10
  "url": "https://github.com/atlassian-labs/atlaspack.git"
11
11
  },
12
- "main": "lib/XMLPackager.js",
13
- "source": "src/XMLPackager.js",
12
+ "main": "./lib/XMLPackager.js",
13
+ "source": "./src/XMLPackager.ts",
14
+ "types": "./lib/XMLPackager.d.ts",
14
15
  "engines": {
15
16
  "node": ">= 16.0.0"
16
17
  },
17
18
  "dependencies": {
18
- "@atlaspack/plugin": "2.14.5-canary.137+069de478e",
19
- "@atlaspack/types": "2.14.5-canary.137+069de478e",
20
- "@atlaspack/utils": "2.14.5-canary.137+069de478e",
19
+ "@atlaspack/plugin": "2.14.5-canary.139+d2fd84977",
20
+ "@atlaspack/types": "2.14.5-canary.139+d2fd84977",
21
+ "@atlaspack/utils": "2.14.5-canary.139+d2fd84977",
21
22
  "@xmldom/xmldom": "^0.7.9"
22
23
  },
23
24
  "type": "commonjs",
24
- "gitHead": "069de478e64fb5889f6f2ce023eb510782767fbd"
25
- }
25
+ "scripts": {
26
+ "check-ts": "tsc --emitDeclarationOnly --rootDir src"
27
+ },
28
+ "gitHead": "d2fd849770fe6305e9c694bd97b1bd905abd9d94"
29
+ }
@@ -1,5 +1,3 @@
1
- // @flow
2
-
3
1
  import type {Bundle, BundleGraph, NamedBundle} from '@atlaspack/types';
4
2
  import assert from 'assert';
5
3
  import {Packager} from '@atlaspack/plugin';
@@ -10,9 +8,10 @@ import {
10
8
  } from '@atlaspack/utils';
11
9
  import {DOMParser, XMLSerializer} from '@xmldom/xmldom';
12
10
 
13
- export default (new Packager({
11
+ export default new Packager({
14
12
  async package({bundle, bundleGraph, getInlineBundleContents}) {
15
- const assets = [];
13
+ // @ts-expect-error TS2552
14
+ const assets: Array<Asset> = [];
16
15
  bundle.traverseAssets((asset) => {
17
16
  assets.push(asset);
18
17
  });
@@ -55,10 +54,13 @@ export default (new Packager({
55
54
  );
56
55
  if (parsed.documentElement != null) {
57
56
  let parent = element.parentNode;
57
+ // @ts-expect-error TS18047
58
58
  parent.removeChild(element);
59
+ // @ts-expect-error TS18047
59
60
  parent.appendChild(parsed.documentElement);
60
61
  }
61
62
  } else {
63
+ // @ts-expect-error TS18047
62
64
  element.parentNode.textContent = contents;
63
65
  }
64
66
  }
@@ -86,14 +88,20 @@ export default (new Packager({
86
88
  map,
87
89
  });
88
90
  },
89
- }): Packager<mixed, mixed>);
91
+ }) as Packager<unknown, unknown>;
90
92
 
91
93
  async function getAssetContent(
92
94
  bundleGraph: BundleGraph<NamedBundle>,
93
- getInlineBundleContents,
94
- assetId,
95
+ getInlineBundleContents: (
96
+ arg1: Bundle,
97
+ arg2: BundleGraph<NamedBundle>,
98
+ // @ts-expect-error TS2304
99
+ ) => Async<{
100
+ contents: Blob;
101
+ }>,
102
+ assetId: any,
95
103
  ) {
96
- let inlineBundle: ?Bundle;
104
+ let inlineBundle: Bundle | null | undefined;
97
105
  bundleGraph.traverseBundles((bundle, context, {stop}) => {
98
106
  const entryAssets = bundle.getEntryAssets();
99
107
  if (entryAssets.some((a) => a.uniqueKey === assetId)) {
package/tsconfig.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "../../../tsconfig.json",
3
+ "include": ["src"]
4
+ }