@atlaspack/core 2.12.1-canary.3429 → 2.12.1-canary.3431

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.
@@ -52,9 +52,17 @@ class AtlaspackWorker {
52
52
  let resolvedPath = customRequire.resolve(specifier);
53
53
  // $FlowFixMe
54
54
  let resolvedModule = await import(resolvedPath);
55
+ let instance = undefined;
56
+ if (resolvedModule.default && resolvedModule.default[CONFIG]) {
57
+ instance = resolvedModule.default[CONFIG];
58
+ } else if (resolvedModule.default && resolvedModule.default.default[CONFIG]) {
59
+ instance = resolvedModule.default.default[CONFIG];
60
+ } else {
61
+ throw new Error(`Plugin could not be resolved\n\t${kind}\n\t${resolveFrom}\n\t${specifier}`);
62
+ }
55
63
  switch (kind) {
56
64
  case 'resolver':
57
- this.#resolvers.set(specifier, resolvedModule.default[CONFIG]);
65
+ this.#resolvers.set(specifier, instance);
58
66
  break;
59
67
  }
60
68
  });
@@ -65,7 +73,7 @@ class AtlaspackWorker {
65
73
  }) => {
66
74
  const resolver = this.#resolvers.get(key);
67
75
  if (!resolver) {
68
- throw new Error('Resolver not found');
76
+ throw new Error(`Resolver not found: ${key}`);
69
77
  }
70
78
  const result = await resolver.resolve({
71
79
  specifier,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/core",
3
- "version": "2.12.1-canary.3429+8cd6d09ce",
3
+ "version": "2.12.1-canary.3431+e27623c56",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -20,20 +20,20 @@
20
20
  "check-ts": "tsc --noEmit index.d.ts"
21
21
  },
22
22
  "dependencies": {
23
- "@atlaspack/cache": "2.12.1-canary.3429+8cd6d09ce",
24
- "@atlaspack/diagnostic": "2.12.1-canary.3429+8cd6d09ce",
25
- "@atlaspack/events": "2.12.1-canary.3429+8cd6d09ce",
26
- "@atlaspack/feature-flags": "2.12.1-canary.3429+8cd6d09ce",
27
- "@atlaspack/fs": "2.12.1-canary.3429+8cd6d09ce",
28
- "@atlaspack/graph": "3.2.1-canary.3429+8cd6d09ce",
29
- "@atlaspack/logger": "2.12.1-canary.3429+8cd6d09ce",
30
- "@atlaspack/package-manager": "2.12.1-canary.3429+8cd6d09ce",
31
- "@atlaspack/plugin": "2.12.1-canary.3429+8cd6d09ce",
32
- "@atlaspack/profiler": "2.12.1-canary.3429+8cd6d09ce",
33
- "@atlaspack/rust": "2.12.1-canary.3429+8cd6d09ce",
34
- "@atlaspack/types": "2.12.1-canary.3429+8cd6d09ce",
35
- "@atlaspack/utils": "2.12.1-canary.3429+8cd6d09ce",
36
- "@atlaspack/workers": "2.12.1-canary.3429+8cd6d09ce",
23
+ "@atlaspack/cache": "2.12.1-canary.3431+e27623c56",
24
+ "@atlaspack/diagnostic": "2.12.1-canary.3431+e27623c56",
25
+ "@atlaspack/events": "2.12.1-canary.3431+e27623c56",
26
+ "@atlaspack/feature-flags": "2.12.1-canary.3431+e27623c56",
27
+ "@atlaspack/fs": "2.12.1-canary.3431+e27623c56",
28
+ "@atlaspack/graph": "3.2.1-canary.3431+e27623c56",
29
+ "@atlaspack/logger": "2.12.1-canary.3431+e27623c56",
30
+ "@atlaspack/package-manager": "2.12.1-canary.3431+e27623c56",
31
+ "@atlaspack/plugin": "2.12.1-canary.3431+e27623c56",
32
+ "@atlaspack/profiler": "2.12.1-canary.3431+e27623c56",
33
+ "@atlaspack/rust": "2.12.1-canary.3431+e27623c56",
34
+ "@atlaspack/types": "2.12.1-canary.3431+e27623c56",
35
+ "@atlaspack/utils": "2.12.1-canary.3431+e27623c56",
36
+ "@atlaspack/workers": "2.12.1-canary.3431+e27623c56",
37
37
  "@mischnic/json-sourcemap": "^0.1.0",
38
38
  "@parcel/source-map": "^2.1.1",
39
39
  "base-x": "^3.0.8",
@@ -57,5 +57,5 @@
57
57
  "browser": {
58
58
  "./src/serializerCore.js": "./src/serializerCore.browser.js"
59
59
  },
60
- "gitHead": "8cd6d09ce1b68f1848c298ea900334b8d47c9fd9"
60
+ "gitHead": "e27623c56ff5bea187652ecb09db27db527ecd9e"
61
61
  }
@@ -32,9 +32,23 @@ export class AtlaspackWorker {
32
32
  // $FlowFixMe
33
33
  let resolvedModule = await import(resolvedPath);
34
34
 
35
+ let instance = undefined;
36
+ if (resolvedModule.default && resolvedModule.default[CONFIG]) {
37
+ instance = resolvedModule.default[CONFIG];
38
+ } else if (
39
+ resolvedModule.default &&
40
+ resolvedModule.default.default[CONFIG]
41
+ ) {
42
+ instance = resolvedModule.default.default[CONFIG];
43
+ } else {
44
+ throw new Error(
45
+ `Plugin could not be resolved\n\t${kind}\n\t${resolveFrom}\n\t${specifier}`,
46
+ );
47
+ }
48
+
35
49
  switch (kind) {
36
50
  case 'resolver':
37
- this.#resolvers.set(specifier, resolvedModule.default[CONFIG]);
51
+ this.#resolvers.set(specifier, instance);
38
52
  break;
39
53
  }
40
54
  },
@@ -46,7 +60,7 @@ export class AtlaspackWorker {
46
60
  > = jsCallable(async ({key, dependency, specifier}) => {
47
61
  const resolver = this.#resolvers.get(key);
48
62
  if (!resolver) {
49
- throw new Error('Resolver not found');
63
+ throw new Error(`Resolver not found: ${key}`);
50
64
  }
51
65
 
52
66
  const result = await resolver.resolve({