@atlaspack/transformer-jsonld 2.14.5-canary.19 → 2.14.5-canary.191

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,187 @@
1
1
  # @atlaspack/transformer-jsonld
2
2
 
3
+ ## 2.14.29
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @atlaspack/plugin@2.14.29
9
+ - @atlaspack/types@2.15.19
10
+
11
+ ## 2.14.28
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies []:
16
+ - @atlaspack/plugin@2.14.28
17
+ - @atlaspack/types@2.15.18
18
+
19
+ ## 2.14.27
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies []:
24
+ - @atlaspack/plugin@2.14.27
25
+ - @atlaspack/types@2.15.17
26
+
27
+ ## 2.14.26
28
+
29
+ ### Patch Changes
30
+
31
+ - [#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
32
+
33
+ - Updated dependencies [[`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd)]:
34
+ - @atlaspack/plugin@2.14.26
35
+ - @atlaspack/types@2.15.16
36
+
37
+ ## 2.14.25
38
+
39
+ ### Patch Changes
40
+
41
+ - Updated dependencies []:
42
+ - @atlaspack/plugin@2.14.25
43
+ - @atlaspack/types@2.15.15
44
+
45
+ ## 2.14.24
46
+
47
+ ### Patch Changes
48
+
49
+ - Updated dependencies []:
50
+ - @atlaspack/plugin@2.14.24
51
+ - @atlaspack/types@2.15.14
52
+
53
+ ## 2.14.23
54
+
55
+ ### Patch Changes
56
+
57
+ - Updated dependencies []:
58
+ - @atlaspack/types@2.15.13
59
+ - @atlaspack/plugin@2.14.23
60
+
61
+ ## 2.14.22
62
+
63
+ ### Patch Changes
64
+
65
+ - [#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
66
+
67
+ - Updated dependencies [[`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94)]:
68
+ - @atlaspack/plugin@2.14.22
69
+ - @atlaspack/types@2.15.12
70
+
71
+ ## 2.14.21
72
+
73
+ ### Patch Changes
74
+
75
+ - Updated dependencies []:
76
+ - @atlaspack/types@2.15.11
77
+ - @atlaspack/plugin@2.14.21
78
+
79
+ ## 2.14.20
80
+
81
+ ### Patch Changes
82
+
83
+ - [#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
84
+
85
+ - Updated dependencies [[`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa)]:
86
+ - @atlaspack/plugin@2.14.20
87
+ - @atlaspack/types@2.15.10
88
+
89
+ ## 2.14.19
90
+
91
+ ### Patch Changes
92
+
93
+ - Updated dependencies []:
94
+ - @atlaspack/types@2.15.9
95
+ - @atlaspack/plugin@2.14.19
96
+
97
+ ## 2.14.18
98
+
99
+ ### Patch Changes
100
+
101
+ - Updated dependencies []:
102
+ - @atlaspack/types@2.15.8
103
+ - @atlaspack/plugin@2.14.18
104
+
105
+ ## 2.14.17
106
+
107
+ ### Patch Changes
108
+
109
+ - Updated dependencies []:
110
+ - @atlaspack/types@2.15.7
111
+ - @atlaspack/plugin@2.14.17
112
+
113
+ ## 2.14.16
114
+
115
+ ### Patch Changes
116
+
117
+ - Updated dependencies []:
118
+ - @atlaspack/types@2.15.6
119
+ - @atlaspack/plugin@2.14.16
120
+
121
+ ## 2.14.15
122
+
123
+ ### Patch Changes
124
+
125
+ - Updated dependencies []:
126
+ - @atlaspack/types@2.15.5
127
+ - @atlaspack/plugin@2.14.15
128
+
129
+ ## 2.14.14
130
+
131
+ ### Patch Changes
132
+
133
+ - Updated dependencies []:
134
+ - @atlaspack/types@2.15.4
135
+ - @atlaspack/plugin@2.14.14
136
+
137
+ ## 2.14.13
138
+
139
+ ### Patch Changes
140
+
141
+ - Updated dependencies []:
142
+ - @atlaspack/types@2.15.3
143
+ - @atlaspack/plugin@2.14.13
144
+
145
+ ## 2.14.12
146
+
147
+ ### Patch Changes
148
+
149
+ - Updated dependencies []:
150
+ - @atlaspack/types@2.15.2
151
+ - @atlaspack/plugin@2.14.12
152
+
153
+ ## 2.14.11
154
+
155
+ ### Patch Changes
156
+
157
+ - Updated dependencies []:
158
+ - @atlaspack/types@2.15.1
159
+ - @atlaspack/plugin@2.14.11
160
+
161
+ ## 2.14.10
162
+
163
+ ### Patch Changes
164
+
165
+ - Updated dependencies [[`51aba5f`](https://github.com/atlassian-labs/atlaspack/commit/51aba5fc0e49235ee06bbc3c376f48c3e7da5c4b), [`1e32d4e`](https://github.com/atlassian-labs/atlaspack/commit/1e32d4eae6b3af3968e8a0ef97d35b4347fd4196)]:
166
+ - @atlaspack/types@2.15.0
167
+ - @atlaspack/plugin@2.14.10
168
+
169
+ ## 2.14.9
170
+
171
+ ### Patch Changes
172
+
173
+ - Updated dependencies []:
174
+ - @atlaspack/types@2.14.9
175
+ - @atlaspack/plugin@2.14.9
176
+
177
+ ## 2.14.8
178
+
179
+ ### Patch Changes
180
+
181
+ - Updated dependencies []:
182
+ - @atlaspack/types@2.14.8
183
+ - @atlaspack/plugin@2.14.8
184
+
3
185
  ## 2.14.7
4
186
 
5
187
  ### Patch Changes
@@ -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];
@@ -0,0 +1,3 @@
1
+ import { Transformer } from '@atlaspack/plugin';
2
+ declare const _default: Transformer<unknown>;
3
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/transformer-jsonld",
3
- "version": "2.14.5-canary.19+a63b1da4d",
3
+ "version": "2.14.5-canary.191+eedcbc408",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -9,19 +9,22 @@
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",
21
+ "build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
19
22
  },
20
23
  "dependencies": {
21
- "@atlaspack/plugin": "2.14.5-canary.19+a63b1da4d",
22
- "@atlaspack/types": "2.14.5-canary.19+a63b1da4d",
24
+ "@atlaspack/plugin": "2.14.5-canary.191+eedcbc408",
25
+ "@atlaspack/types": "2.14.5-canary.191+eedcbc408",
23
26
  "json5": "^2.2.0"
24
27
  },
25
28
  "type": "commonjs",
26
- "gitHead": "a63b1da4d98a7eda8a2130700dc844a56aa8308e"
27
- }
29
+ "gitHead": "eedcbc408fc1e86a2a8e25f1a41c57146d8529e1"
30
+ }
@@ -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
+ }