@atlaspack/resolver-glob 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/resolver-glob
2
2
 
3
+ ## 2.14.21
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @atlaspack/utils@2.17.3
9
+ - @atlaspack/node-resolver-core@3.5.21
10
+ - @atlaspack/plugin@2.14.21
11
+
3
12
  ## 2.14.20
4
13
 
5
14
  ### Patch Changes
@@ -0,0 +1,3 @@
1
+ import { Resolver } from '@atlaspack/plugin';
2
+ declare const _default: Resolver<unknown>;
3
+ export default _default;
@@ -57,7 +57,9 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
57
57
  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; }
58
58
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
59
59
  const jsAssetTypes = new Set(['jsx', 'ts', 'tsx', 'mjs', 'mts', 'cts']);
60
- function errorToThrowableDiagnostic(error, dependency) {
60
+ function errorToThrowableDiagnostic(error,
61
+ // @ts-expect-error TS2304
62
+ dependency) {
61
63
  return new (_diagnostic().default)({
62
64
  diagnostic: {
63
65
  message: error,
@@ -68,6 +70,7 @@ function errorToThrowableDiagnostic(error, dependency) {
68
70
  });
69
71
  }
70
72
  var _default = exports.default = new (_plugin().Resolver)({
73
+ // @ts-expect-error TS2322
71
74
  async resolve({
72
75
  dependency,
73
76
  options,
@@ -94,6 +97,8 @@ var _default = exports.default = new (_plugin().Resolver)({
94
97
  if (error) {
95
98
  throw errorToThrowableDiagnostic(error, dependency);
96
99
  }
100
+
101
+ // @ts-expect-error TS2304
97
102
  let invalidateOnFileCreate = [];
98
103
  let invalidateOnFileChange = new Set();
99
104
  switch (specifier[0]) {
@@ -232,7 +237,11 @@ var _default = exports.default = new (_plugin().Resolver)({
232
237
  };
233
238
  }
234
239
  });
235
- function set(obj, path, value) {
240
+ function set(
241
+ // @ts-expect-error TS7006
242
+ obj, path,
243
+ // @ts-expect-error TS2304
244
+ value) {
236
245
  for (let i = 0; i < path.length - 1; i++) {
237
246
  let part = path[i];
238
247
  if (obj[part] == null) {
@@ -242,6 +251,8 @@ function set(obj, path, value) {
242
251
  }
243
252
  obj[path[path.length - 1]] = value;
244
253
  }
254
+
255
+ // @ts-expect-error TS7006
245
256
  function generate(matches, isAsync, indent = '', count = 0) {
246
257
  if (typeof matches === 'string') {
247
258
  if (isAsync) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/resolver-glob",
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,18 +9,22 @@
9
9
  "type": "git",
10
10
  "url": "https://github.com/atlassian-labs/atlaspack.git"
11
11
  },
12
- "main": "lib/GlobResolver.js",
13
- "source": "src/GlobResolver.js",
12
+ "main": "./lib/GlobResolver.js",
13
+ "source": "./src/GlobResolver.ts",
14
+ "types": "./lib/GlobResolver.d.ts",
14
15
  "engines": {
15
16
  "node": ">= 16.0.0"
16
17
  },
17
18
  "dependencies": {
18
- "@atlaspack/diagnostic": "2.14.1-canary.205+069de478e",
19
- "@atlaspack/node-resolver-core": "3.5.5-canary.137+069de478e",
20
- "@atlaspack/plugin": "2.14.5-canary.137+069de478e",
21
- "@atlaspack/utils": "2.14.5-canary.137+069de478e",
19
+ "@atlaspack/diagnostic": "2.14.1-canary.207+d2fd84977",
20
+ "@atlaspack/node-resolver-core": "3.5.5-canary.139+d2fd84977",
21
+ "@atlaspack/plugin": "2.14.5-canary.139+d2fd84977",
22
+ "@atlaspack/utils": "2.14.5-canary.139+d2fd84977",
22
23
  "nullthrows": "^1.1.1"
23
24
  },
24
25
  "type": "commonjs",
25
- "gitHead": "069de478e64fb5889f6f2ce023eb510782767fbd"
26
- }
26
+ "scripts": {
27
+ "check-ts": "tsc --emitDeclarationOnly --rootDir src"
28
+ },
29
+ "gitHead": "d2fd849770fe6305e9c694bd97b1bd905abd9d94"
30
+ }
@@ -1,4 +1,3 @@
1
- // @flow
2
1
  import {Resolver} from '@atlaspack/plugin';
3
2
  import {
4
3
  isGlob,
@@ -17,7 +16,11 @@ import invariant from 'assert';
17
16
 
18
17
  const jsAssetTypes = new Set(['jsx', 'ts', 'tsx', 'mjs', 'mts', 'cts']);
19
18
 
20
- function errorToThrowableDiagnostic(error, dependency): ThrowableDiagnostic {
19
+ function errorToThrowableDiagnostic(
20
+ error: string,
21
+ // @ts-expect-error TS2304
22
+ dependency: Dependency,
23
+ ): ThrowableDiagnostic {
21
24
  return new ThrowableDiagnostic({
22
25
  diagnostic: {
23
26
  message: error,
@@ -34,7 +37,8 @@ function errorToThrowableDiagnostic(error, dependency): ThrowableDiagnostic {
34
37
  });
35
38
  }
36
39
 
37
- export default (new Resolver({
40
+ export default new Resolver({
41
+ // @ts-expect-error TS2322
38
42
  async resolve({dependency, options, specifier, pipeline, logger}) {
39
43
  if (!isGlob(specifier)) {
40
44
  return;
@@ -65,7 +69,8 @@ export default (new Resolver({
65
69
  throw errorToThrowableDiagnostic(error, dependency);
66
70
  }
67
71
 
68
- let invalidateOnFileCreate = [];
72
+ // @ts-expect-error TS2304
73
+ let invalidateOnFileCreate: Array<FileCreateInvalidation> = [];
69
74
  let invalidateOnFileChange = new Set();
70
75
 
71
76
  switch (specifier[0]) {
@@ -137,7 +142,7 @@ export default (new Resolver({
137
142
  env: dependency.env,
138
143
  sourcePath: dependency.sourcePath,
139
144
  });
140
- } catch (err) {
145
+ } catch (err: any) {
141
146
  if (err instanceof ThrowableDiagnostic) {
142
147
  // Return instead of throwing so we can provide invalidations.
143
148
  return {
@@ -187,14 +192,14 @@ export default (new Resolver({
187
192
  let code = '';
188
193
  if (sourceAssetType === 'js') {
189
194
  let re = globToRegex(normalized, {capture: true});
190
- let matches = {};
195
+ let matches: Record<string, any> = {};
191
196
  for (let [file, relative] of results) {
192
197
  let match = file.match(re);
193
198
  if (!match) continue;
194
199
  let parts = match
195
200
  .slice(1)
196
201
  .filter(Boolean)
197
- .reduce((a, p) => a.concat(p.split('/')), []);
202
+ .reduce<Array<any>>((a, p) => a.concat(p.split('/')), []);
198
203
  set(matches, parts, relative);
199
204
  }
200
205
 
@@ -222,9 +227,15 @@ export default (new Resolver({
222
227
  priority: 'sync',
223
228
  };
224
229
  },
225
- }): Resolver<mixed>);
226
-
227
- function set(obj, path, value) {
230
+ }) as Resolver<unknown>;
231
+
232
+ function set(
233
+ // @ts-expect-error TS7006
234
+ obj,
235
+ path: Array<never> | Array<string>,
236
+ // @ts-expect-error TS2304
237
+ value: FilePath | string,
238
+ ) {
228
239
  for (let i = 0; i < path.length - 1; i++) {
229
240
  let part = path[i];
230
241
 
@@ -238,7 +249,8 @@ function set(obj, path, value) {
238
249
  obj[path[path.length - 1]] = value;
239
250
  }
240
251
 
241
- function generate(matches, isAsync, indent = '', count = 0) {
252
+ // @ts-expect-error TS7006
253
+ function generate(matches, isAsync: boolean, indent = '', count = 0) {
242
254
  if (typeof matches === 'string') {
243
255
  if (isAsync) {
244
256
  return {
package/tsconfig.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "../../../tsconfig.json",
3
+ "include": ["src"]
4
+ }