@atlaspack/transformer-jsonld 2.14.5-canary.14 → 2.14.5-canary.141

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,135 @@
1
1
  # @atlaspack/transformer-jsonld
2
2
 
3
+ ## 2.14.21
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @atlaspack/types@2.15.11
9
+ - @atlaspack/plugin@2.14.21
10
+
11
+ ## 2.14.20
12
+
13
+ ### Patch Changes
14
+
15
+ - [#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
16
+
17
+ - Updated dependencies [[`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa)]:
18
+ - @atlaspack/plugin@2.14.20
19
+ - @atlaspack/types@2.15.10
20
+
21
+ ## 2.14.19
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies []:
26
+ - @atlaspack/types@2.15.9
27
+ - @atlaspack/plugin@2.14.19
28
+
29
+ ## 2.14.18
30
+
31
+ ### Patch Changes
32
+
33
+ - Updated dependencies []:
34
+ - @atlaspack/types@2.15.8
35
+ - @atlaspack/plugin@2.14.18
36
+
37
+ ## 2.14.17
38
+
39
+ ### Patch Changes
40
+
41
+ - Updated dependencies []:
42
+ - @atlaspack/types@2.15.7
43
+ - @atlaspack/plugin@2.14.17
44
+
45
+ ## 2.14.16
46
+
47
+ ### Patch Changes
48
+
49
+ - Updated dependencies []:
50
+ - @atlaspack/types@2.15.6
51
+ - @atlaspack/plugin@2.14.16
52
+
53
+ ## 2.14.15
54
+
55
+ ### Patch Changes
56
+
57
+ - Updated dependencies []:
58
+ - @atlaspack/types@2.15.5
59
+ - @atlaspack/plugin@2.14.15
60
+
61
+ ## 2.14.14
62
+
63
+ ### Patch Changes
64
+
65
+ - Updated dependencies []:
66
+ - @atlaspack/types@2.15.4
67
+ - @atlaspack/plugin@2.14.14
68
+
69
+ ## 2.14.13
70
+
71
+ ### Patch Changes
72
+
73
+ - Updated dependencies []:
74
+ - @atlaspack/types@2.15.3
75
+ - @atlaspack/plugin@2.14.13
76
+
77
+ ## 2.14.12
78
+
79
+ ### Patch Changes
80
+
81
+ - Updated dependencies []:
82
+ - @atlaspack/types@2.15.2
83
+ - @atlaspack/plugin@2.14.12
84
+
85
+ ## 2.14.11
86
+
87
+ ### Patch Changes
88
+
89
+ - Updated dependencies []:
90
+ - @atlaspack/types@2.15.1
91
+ - @atlaspack/plugin@2.14.11
92
+
93
+ ## 2.14.10
94
+
95
+ ### Patch Changes
96
+
97
+ - Updated dependencies [[`51aba5f`](https://github.com/atlassian-labs/atlaspack/commit/51aba5fc0e49235ee06bbc3c376f48c3e7da5c4b), [`1e32d4e`](https://github.com/atlassian-labs/atlaspack/commit/1e32d4eae6b3af3968e8a0ef97d35b4347fd4196)]:
98
+ - @atlaspack/types@2.15.0
99
+ - @atlaspack/plugin@2.14.10
100
+
101
+ ## 2.14.9
102
+
103
+ ### Patch Changes
104
+
105
+ - Updated dependencies []:
106
+ - @atlaspack/types@2.14.9
107
+ - @atlaspack/plugin@2.14.9
108
+
109
+ ## 2.14.8
110
+
111
+ ### Patch Changes
112
+
113
+ - Updated dependencies []:
114
+ - @atlaspack/types@2.14.8
115
+ - @atlaspack/plugin@2.14.8
116
+
117
+ ## 2.14.7
118
+
119
+ ### Patch Changes
120
+
121
+ - Updated dependencies []:
122
+ - @atlaspack/types@2.14.7
123
+ - @atlaspack/plugin@2.14.7
124
+
125
+ ## 2.14.6
126
+
127
+ ### Patch Changes
128
+
129
+ - Updated dependencies []:
130
+ - @atlaspack/types@2.14.6
131
+ - @atlaspack/plugin@2.14.6
132
+
3
133
  ## 2.14.5
4
134
 
5
135
  ### Patch Changes
@@ -0,0 +1,3 @@
1
+ import { Transformer } from '@atlaspack/plugin';
2
+ declare const _default: Transformer<unknown>;
3
+ export default _default;
@@ -38,7 +38,7 @@ var _default = exports.default = new (_plugin().Transformer)({
38
38
  asset.setCode(JSON.stringify(jsonCode));
39
39
  return [asset];
40
40
  }
41
- });
41
+ }); // @ts-expect-error TS2304
42
42
  function extractUrlsFrom(data, asset) {
43
43
  if (!data) return null;
44
44
  if (typeof data === 'string') {
@@ -48,6 +48,8 @@ function extractUrlsFrom(data, asset) {
48
48
  if (Array.isArray(data)) return iterateThroughArray(data, asset);
49
49
  return iterateThroughObject(data, asset);
50
50
  }
51
+
52
+ // @ts-expect-error TS2304
51
53
  function iterateThroughObject(jsonObject, asset) {
52
54
  Object.keys(jsonObject).filter(k => SCHEMA_ATTRS.includes(k)).forEach(k => {
53
55
  let value = jsonObject[k];
@@ -55,6 +57,8 @@ function iterateThroughObject(jsonObject, asset) {
55
57
  });
56
58
  return jsonObject;
57
59
  }
60
+
61
+ // @ts-expect-error TS2304
58
62
  function iterateThroughArray(jsonArray, asset) {
59
63
  Object.keys(jsonArray).forEach(i => {
60
64
  let value = jsonArray[i];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/transformer-jsonld",
3
- "version": "2.14.5-canary.14+267b0d591",
3
+ "version": "2.14.5-canary.141+2f29297bd",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -9,19 +9,21 @@
9
9
  "type": "git",
10
10
  "url": "https://github.com/atlassian-labs/atlaspack.git"
11
11
  },
12
- "main": "lib/JSONLDTransformer.js",
13
- "source": "src/JSONLDTransformer.js",
12
+ "main": "./lib/JSONLDTransformer.js",
13
+ "source": "./src/JSONLDTransformer.ts",
14
+ "types": "./lib/JSONLDTransformer.d.ts",
14
15
  "engines": {
15
16
  "node": ">= 16.0.0"
16
17
  },
17
18
  "scripts": {
18
- "test": "yarn workspace @atlaspack/integration-tests test -g jsonld"
19
+ "test": "yarn workspace @atlaspack/integration-tests test -g jsonld",
20
+ "check-ts": "tsc --emitDeclarationOnly --rootDir src"
19
21
  },
20
22
  "dependencies": {
21
- "@atlaspack/plugin": "2.14.5-canary.14+267b0d591",
22
- "@atlaspack/types": "2.14.5-canary.14+267b0d591",
23
+ "@atlaspack/plugin": "2.14.5-canary.141+2f29297bd",
24
+ "@atlaspack/types": "2.14.5-canary.141+2f29297bd",
23
25
  "json5": "^2.2.0"
24
26
  },
25
27
  "type": "commonjs",
26
- "gitHead": "267b0d59131c00e4cd1526bbf87aa84b9c8fd411"
27
- }
28
+ "gitHead": "2f29297bd550840c9840871559349ef773bcbf6d"
29
+ }
@@ -1,5 +1,3 @@
1
- // @flow
2
-
3
1
  import {Transformer} from '@atlaspack/plugin';
4
2
  import json5 from 'json5';
5
3
 
@@ -20,7 +18,7 @@ const SCHEMA_ATTRS = [
20
18
  'url',
21
19
  ];
22
20
 
23
- export default (new Transformer({
21
+ export default new Transformer({
24
22
  async transform({asset}) {
25
23
  let rawCode = await asset.getCode();
26
24
  // allowing any recieved jsonld to be in json5 format
@@ -34,9 +32,10 @@ export default (new Transformer({
34
32
  asset.setCode(JSON.stringify(jsonCode));
35
33
  return [asset];
36
34
  },
37
- }): Transformer);
35
+ }) as Transformer<unknown>;
38
36
 
39
- function extractUrlsFrom(data, asset) {
37
+ // @ts-expect-error TS2304
38
+ function extractUrlsFrom(data: any, asset: MutableAsset) {
40
39
  if (!data) return null;
41
40
 
42
41
  if (typeof data === 'string') {
@@ -49,7 +48,8 @@ function extractUrlsFrom(data, asset) {
49
48
  return iterateThroughObject(data, asset);
50
49
  }
51
50
 
52
- function iterateThroughObject(jsonObject, asset) {
51
+ // @ts-expect-error TS2304
52
+ function iterateThroughObject(jsonObject: any, asset: MutableAsset) {
53
53
  Object.keys(jsonObject)
54
54
  .filter((k) => SCHEMA_ATTRS.includes(k))
55
55
  .forEach((k) => {
@@ -60,7 +60,8 @@ function iterateThroughObject(jsonObject, asset) {
60
60
  return jsonObject;
61
61
  }
62
62
 
63
- function iterateThroughArray(jsonArray, asset) {
63
+ // @ts-expect-error TS2304
64
+ function iterateThroughArray(jsonArray: any, asset: MutableAsset) {
64
65
  Object.keys(jsonArray).forEach((i) => {
65
66
  let value = jsonArray[i];
66
67
  jsonArray[i] = extractUrlsFrom(value, asset);
package/tsconfig.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "../../../tsconfig.json",
3
+ "include": ["src"]
4
+ }