@atlaspack/transformer-jsonld 2.14.5-canary.20 → 2.14.5-canary.200

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