@atlaspack/node-resolver-core 3.4.2-dev.3666 → 3.4.2-dev.3682

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.
Files changed (2) hide show
  1. package/lib/Wrapper.js +23 -8
  2. package/package.json +7 -7
package/lib/Wrapper.js CHANGED
@@ -61,6 +61,13 @@ function _module() {
61
61
  };
62
62
  return data;
63
63
  }
64
+ function _featureFlags() {
65
+ const data = require("@atlaspack/feature-flags");
66
+ _featureFlags = function () {
67
+ return data;
68
+ };
69
+ return data;
70
+ }
64
71
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
65
72
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
66
73
  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; }
@@ -86,10 +93,17 @@ class NodeResolver {
86
93
  let resolver = this.resolversByEnv.get(options.env.id);
87
94
  if (!resolver) {
88
95
  await (_rust().init === null || _rust().init === void 0 ? void 0 : (0, _rust().init)());
96
+ const useNativeFs = this.options.fs instanceof _fs().NodeFS && process.versions.pnp == null &&
97
+ // For Wasm builds
98
+ !_rust().init;
99
+ if (!useNativeFs && process.env.NODE_ENV !== 'test') {
100
+ var _this$options$logger;
101
+ (_this$options$logger = this.options.logger) === null || _this$options$logger === void 0 || _this$options$logger.warn({
102
+ message: 'Using JavaScript file system for resolution. This should not be used in other than internal atlaspack tests.'
103
+ });
104
+ }
89
105
  resolver = new (_rust().Resolver)(this.options.projectRoot, {
90
- fs: this.options.fs instanceof _fs().NodeFS && process.versions.pnp == null &&
91
- // For Wasm builds
92
- !_rust().init ? undefined : {
106
+ fs: useNativeFs ? undefined : {
93
107
  canonicalize: path => this.options.fs.realpathSync(path),
94
108
  read: path => this.options.fs.readFileSync(path),
95
109
  isFile: path => this.options.fs.statSync(path).isFile(),
@@ -107,7 +121,8 @@ class NodeResolver {
107
121
  return pnp.resolveToUnqualified(
108
122
  // append slash to force loading builtins from npm
109
123
  module + '/', from);
110
- } : undefined
124
+ } : undefined,
125
+ reduceStringCreation: (0, _featureFlags().getFeatureFlag)('reduceResolverStringCreation')
111
126
  });
112
127
  this.resolversByEnv.set(options.env.id, resolver);
113
128
  }
@@ -225,8 +240,8 @@ class NodeResolver {
225
240
  if ((resolved === null || resolved === void 0 ? void 0 : resolved.filePath) == null) {
226
241
  // Auto install the Node builtin polyfills
227
242
  if (this.options.shouldAutoInstall && packageManager) {
228
- var _this$options$logger;
229
- (_this$options$logger = this.options.logger) === null || _this$options$logger === void 0 || _this$options$logger.warn({
243
+ var _this$options$logger2;
244
+ (_this$options$logger2 = this.options.logger) === null || _this$options$logger2 === void 0 || _this$options$logger2.warn({
230
245
  message: (0, _diagnostic().md)`Auto installing polyfill for Node builtin module "${packageName}"...`,
231
246
  codeFrames: options.loc ? [{
232
247
  filePath: options.loc.filePath,
@@ -273,8 +288,8 @@ class NodeResolver {
273
288
  range: builtin.range
274
289
  }));
275
290
  } catch (e) {
276
- var _this$options$logger2;
277
- (_this$options$logger2 = this.options.logger) === null || _this$options$logger2 === void 0 || _this$options$logger2.warn((0, _diagnostic().errorToDiagnostic)(e));
291
+ var _this$options$logger3;
292
+ (_this$options$logger3 = this.options.logger) === null || _this$options$logger3 === void 0 || _this$options$logger3.warn((0, _diagnostic().errorToDiagnostic)(e));
278
293
  }
279
294
  }
280
295
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/node-resolver-core",
3
- "version": "3.4.2-dev.3666+0afd6de27",
3
+ "version": "3.4.2-dev.3682+e6c0286ea",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -21,11 +21,11 @@
21
21
  "lib"
22
22
  ],
23
23
  "dependencies": {
24
- "@atlaspack/diagnostic": "2.13.2-dev.3666+0afd6de27",
25
- "@atlaspack/feature-flags": "2.13.2-dev.3666+0afd6de27",
26
- "@atlaspack/fs": "2.13.2-dev.3666+0afd6de27",
27
- "@atlaspack/rust": "2.13.2-dev.3666+0afd6de27",
28
- "@atlaspack/utils": "2.13.2-dev.3666+0afd6de27",
24
+ "@atlaspack/diagnostic": "2.13.2-dev.3682+e6c0286ea",
25
+ "@atlaspack/feature-flags": "2.13.2-dev.3682+e6c0286ea",
26
+ "@atlaspack/fs": "2.13.2-dev.3682+e6c0286ea",
27
+ "@atlaspack/rust": "2.13.2-dev.3682+e6c0286ea",
28
+ "@atlaspack/utils": "2.13.2-dev.3682+e6c0286ea",
29
29
  "@mischnic/json-sourcemap": "^0.1.0",
30
30
  "nullthrows": "^1.1.1",
31
31
  "semver": "^7.5.2"
@@ -57,5 +57,5 @@
57
57
  "browser": {
58
58
  "./src/builtins.js": "./src/builtins.browser.js"
59
59
  },
60
- "gitHead": "0afd6de27cde19f2c9377e864bce83da5c098a54"
60
+ "gitHead": "e6c0286ea2a77c6a41c6c0f38d51caf420d61aae"
61
61
  }