@atlaspack/core 2.14.1-dev.15 → 2.14.1-dev.36

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/lib/Atlaspack.js CHANGED
@@ -125,7 +125,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
125
125
  (0, _registerCoreWithSerializer.registerCoreWithSerializer)();
126
126
  const INTERNAL_TRANSFORM = exports.INTERNAL_TRANSFORM = Symbol('internal_transform');
127
127
  const INTERNAL_RESOLVE = exports.INTERNAL_RESOLVE = Symbol('internal_resolve');
128
- const WORKER_PATH = exports.WORKER_PATH = _path().default.join(__dirname, 'worker.js');
128
+ const WORKER_PATH = exports.WORKER_PATH = _path().default.join( /*#__ATLASPACK_IGNORE__*/__dirname, 'worker.js');
129
129
  class Atlaspack {
130
130
  #requestTracker /*: RequestTracker*/;
131
131
  #config /*: AtlaspackConfig*/;
@@ -832,7 +832,7 @@ class BundleGraph {
832
832
  // If this asset is referenced by any async dependency, it's referenced.
833
833
  return true;
834
834
  }
835
- let dependencies = this._graph.getNodeIdsConnectedTo(assetNodeId).map(id => (0, _nullthrows().default)(this._graph.getNode(id))).filter(node => node.type === 'dependency').map(node => {
835
+ let dependencies = this._graph.getNodeIdsConnectedTo(assetNodeId, _graph().ALL_EDGE_TYPES).map(id => (0, _nullthrows().default)(this._graph.getNode(id))).filter(node => node.type === 'dependency').map(node => {
836
836
  (0, _assert().default)(node.type === 'dependency');
837
837
  return node.value;
838
838
  });
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ // This file is overridden in super package builds
8
+ // $FlowFixMe
9
+ var _default = exports.default = {};
@@ -25,6 +25,8 @@ function _diagnostic() {
25
25
  };
26
26
  return data;
27
27
  }
28
+ var _package = require("../package.json");
29
+ var _internalPlugins = _interopRequireDefault(require("./internal-plugins"));
28
30
  function _utils() {
29
31
  const data = require("@atlaspack/utils");
30
32
  _utils = function () {
@@ -39,6 +41,18 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
39
41
  const NODE_MODULES = `${_path().default.sep}node_modules${_path().default.sep}`;
40
42
  const CONFIG = Symbol.for('parcel-plugin-config');
41
43
  async function loadPlugin(pluginName, configPath, keyPath, options) {
44
+ if (_internalPlugins.default && _internalPlugins.default[pluginName]) {
45
+ let plugin = _internalPlugins.default[pluginName]();
46
+ plugin = plugin.default[CONFIG];
47
+ if (!plugin) {
48
+ throw new Error(`Plugin ${pluginName} is not a valid Atlaspack plugin, should export an instance of a Atlaspack plugin ex. "export default new Reporter({ ... })".`);
49
+ }
50
+ return {
51
+ plugin,
52
+ version: _package.version,
53
+ resolveFrom: (0, _projectPath.toProjectPathUnsafe)(options.projectRoot)
54
+ };
55
+ }
42
56
  let resolveFrom = configPath;
43
57
 
44
58
  // Config packages can reference plugins, but cannot contain other plugins within them.
@@ -40,7 +40,7 @@ function _diagnostic() {
40
40
  return data;
41
41
  }
42
42
  function _json() {
43
- const data = require("json5");
43
+ const data = _interopRequireDefault(require("json5"));
44
44
  _json = function () {
45
45
  return data;
46
46
  };
@@ -179,7 +179,7 @@ function create(config, options) {
179
179
  async function parseAndProcessConfig(configPath, contents, options) {
180
180
  let config;
181
181
  try {
182
- config = (0, _json().parse)(contents);
182
+ config = _json().default.parse(contents);
183
183
  } catch (e) {
184
184
  let pos = {
185
185
  line: e.lineNumber,
@@ -139,8 +139,7 @@ async function resolveOptions(initialOptions) {
139
139
  // where symlinked dependencies outside the project root need to trigger HMR
140
140
  // updates. Default to the project root if not provided.
141
141
  let watchDir = initialOptions.watchDir != null ? _path().default.resolve(initialOptions.watchDir) : projectRoot;
142
- const needsRustLmdbCache = (0, _featureFlags().getFeatureFlag)('useLmdbJsLite') || (0, _featureFlags().getFeatureFlag)('atlaspackV3');
143
- let cache = needsRustLmdbCache ? new (_cache().LMDBLiteCache)(cacheDir) : outputFS instanceof _fs().NodeFS ? new (_cache().LMDBCache)(cacheDir) : new (_cache().FSCache)(outputFS, cacheDir);
142
+ let cache = outputFS instanceof _fs().NodeFS ? new (_cache().LMDBLiteCache)(cacheDir) : new (_cache().FSCache)(outputFS, cacheDir);
144
143
  let mode = initialOptions.mode ?? 'development';
145
144
  let shouldOptimize = (initialOptions === null || initialOptions === void 0 || (_initialOptions$defau = initialOptions.defaultTargetOptions) === null || _initialOptions$defau === void 0 ? void 0 : _initialOptions$defau.shouldOptimize) ?? mode === 'production';
146
145
  let publicUrl = (initialOptions === null || initialOptions === void 0 || (_initialOptions$defau2 = initialOptions.defaultTargetOptions) === null || _initialOptions$defau2 === void 0 ? void 0 : _initialOptions$defau2.publicUrl) ?? '/';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/core",
3
- "version": "2.14.1-dev.15+30b65feb9",
3
+ "version": "2.14.1-dev.36+b98b1df81",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -20,21 +20,21 @@
20
20
  "check-ts": "tsc --noEmit index.d.ts"
21
21
  },
22
22
  "dependencies": {
23
- "@atlaspack/build-cache": "2.13.3-dev.15+30b65feb9",
24
- "@atlaspack/cache": "2.13.3-dev.15+30b65feb9",
25
- "@atlaspack/diagnostic": "2.14.1-dev.15+30b65feb9",
26
- "@atlaspack/events": "2.14.1-dev.15+30b65feb9",
27
- "@atlaspack/feature-flags": "2.14.1-dev.15+30b65feb9",
28
- "@atlaspack/fs": "2.14.1-dev.15+30b65feb9",
29
- "@atlaspack/graph": "3.4.1-dev.15+30b65feb9",
30
- "@atlaspack/logger": "2.14.1-dev.15+30b65feb9",
31
- "@atlaspack/package-manager": "2.14.1-dev.15+30b65feb9",
32
- "@atlaspack/plugin": "2.14.1-dev.15+30b65feb9",
33
- "@atlaspack/profiler": "2.14.1-dev.15+30b65feb9",
34
- "@atlaspack/rust": "3.0.1-dev.15+30b65feb9",
35
- "@atlaspack/types": "2.14.1-dev.15+30b65feb9",
36
- "@atlaspack/utils": "2.14.1-dev.15+30b65feb9",
37
- "@atlaspack/workers": "2.14.1-dev.15+30b65feb9",
23
+ "@atlaspack/build-cache": "2.13.3-dev.36+b98b1df81",
24
+ "@atlaspack/cache": "2.13.3-dev.36+b98b1df81",
25
+ "@atlaspack/diagnostic": "2.14.1-dev.36+b98b1df81",
26
+ "@atlaspack/events": "2.14.1-dev.36+b98b1df81",
27
+ "@atlaspack/feature-flags": "2.14.1-dev.36+b98b1df81",
28
+ "@atlaspack/fs": "2.14.1-dev.36+b98b1df81",
29
+ "@atlaspack/graph": "3.4.1-dev.36+b98b1df81",
30
+ "@atlaspack/logger": "2.14.1-dev.36+b98b1df81",
31
+ "@atlaspack/package-manager": "2.14.1-dev.36+b98b1df81",
32
+ "@atlaspack/plugin": "2.14.1-dev.36+b98b1df81",
33
+ "@atlaspack/profiler": "2.14.1-dev.36+b98b1df81",
34
+ "@atlaspack/rust": "3.0.1-dev.36+b98b1df81",
35
+ "@atlaspack/types": "2.14.1-dev.36+b98b1df81",
36
+ "@atlaspack/utils": "2.14.1-dev.36+b98b1df81",
37
+ "@atlaspack/workers": "2.14.1-dev.36+b98b1df81",
38
38
  "@mischnic/json-sourcemap": "^0.1.0",
39
39
  "@parcel/source-map": "^2.1.1",
40
40
  "base-x": "^3.0.8",
@@ -67,5 +67,5 @@
67
67
  "./src/serializerCore.js": "./src/serializerCore.browser.js"
68
68
  },
69
69
  "type": "commonjs",
70
- "gitHead": "30b65feb98113722e721c7cdee547765d195b65a"
70
+ "gitHead": "b98b1df81bc5ca2c1f977d250c958c137bd0b4ee"
71
71
  }
package/src/Atlaspack.js CHANGED
@@ -68,7 +68,10 @@ registerCoreWithSerializer();
68
68
 
69
69
  export const INTERNAL_TRANSFORM: symbol = Symbol('internal_transform');
70
70
  export const INTERNAL_RESOLVE: symbol = Symbol('internal_resolve');
71
- export const WORKER_PATH: string = path.join(__dirname, 'worker.js');
71
+ export const WORKER_PATH: string = path.join(
72
+ /*#__ATLASPACK_IGNORE__*/ __dirname,
73
+ 'worker.js',
74
+ );
72
75
 
73
76
  export default class Atlaspack {
74
77
  #requestTracker /*: RequestTracker*/;
@@ -1315,7 +1315,7 @@ export default class BundleGraph {
1315
1315
  }
1316
1316
 
1317
1317
  let dependencies = this._graph
1318
- .getNodeIdsConnectedTo(assetNodeId)
1318
+ .getNodeIdsConnectedTo(assetNodeId, ALL_EDGE_TYPES)
1319
1319
  .map((id) => nullthrows(this._graph.getNode(id)))
1320
1320
  .filter((node) => node.type === 'dependency')
1321
1321
  .map((node) => {
@@ -0,0 +1,4 @@
1
+ // @flow
2
+ // This file is overridden in super package builds
3
+ // $FlowFixMe
4
+ export default {};
@@ -8,8 +8,14 @@ import ThrowableDiagnostic, {
8
8
  generateJSONCodeHighlights,
9
9
  md,
10
10
  } from '@atlaspack/diagnostic';
11
+ import {version as ATLASPACK_VERSION} from '../package.json';
12
+ import atlaspackInternalPlugins from './internal-plugins';
11
13
  import {findAlternativeNodeModules} from '@atlaspack/utils';
12
- import {type ProjectPath, toProjectPath} from './projectPath';
14
+ import {
15
+ type ProjectPath,
16
+ toProjectPath,
17
+ toProjectPathUnsafe,
18
+ } from './projectPath';
13
19
 
14
20
  const NODE_MODULES = `${path.sep}node_modules${path.sep}`;
15
21
  const CONFIG = Symbol.for('parcel-plugin-config');
@@ -24,6 +30,21 @@ export default async function loadPlugin<T>(
24
30
  version: Semver,
25
31
  resolveFrom: ProjectPath,
26
32
  |}> {
33
+ if (atlaspackInternalPlugins && atlaspackInternalPlugins[pluginName]) {
34
+ let plugin = atlaspackInternalPlugins[pluginName]();
35
+ plugin = plugin.default[CONFIG];
36
+ if (!plugin) {
37
+ throw new Error(
38
+ `Plugin ${pluginName} is not a valid Atlaspack plugin, should export an instance of a Atlaspack plugin ex. "export default new Reporter({ ... })".`,
39
+ );
40
+ }
41
+ return {
42
+ plugin,
43
+ version: ATLASPACK_VERSION,
44
+ resolveFrom: toProjectPathUnsafe(options.projectRoot),
45
+ };
46
+ }
47
+
27
48
  let resolveFrom = configPath;
28
49
 
29
50
  // Config packages can reference plugins, but cannot contain other plugins within them.
@@ -30,7 +30,7 @@ import ThrowableDiagnostic, {
30
30
  md,
31
31
  errorToDiagnostic,
32
32
  } from '@atlaspack/diagnostic';
33
- import {parse} from 'json5';
33
+ import json5 from 'json5';
34
34
  import path from 'path';
35
35
  import invariant from 'assert';
36
36
 
@@ -216,7 +216,7 @@ export async function parseAndProcessConfig(
216
216
  ): Promise<AtlaspackConfigChain> {
217
217
  let config: RawAtlaspackConfig;
218
218
  try {
219
- config = parse(contents);
219
+ config = json5.parse(contents);
220
220
  } catch (e) {
221
221
  let pos = {
222
222
  line: e.lineNumber,
@@ -12,7 +12,7 @@ import type {AtlaspackOptions} from './types';
12
12
  import path from 'path';
13
13
  import {hashString} from '@atlaspack/rust';
14
14
  import {NodeFS, NodeVCSAwareFS} from '@atlaspack/fs';
15
- import {LMDBCache, LMDBLiteCache, FSCache} from '@atlaspack/cache';
15
+ import {LMDBLiteCache, FSCache} from '@atlaspack/cache';
16
16
  import {getFeatureFlag, getFeatureFlagValue} from '@atlaspack/feature-flags';
17
17
  import {NodePackageManager} from '@atlaspack/package-manager';
18
18
  import {
@@ -146,14 +146,10 @@ export default async function resolveOptions(
146
146
  ? path.resolve(initialOptions.watchDir)
147
147
  : projectRoot;
148
148
 
149
- const needsRustLmdbCache =
150
- getFeatureFlag('useLmdbJsLite') || getFeatureFlag('atlaspackV3');
151
-
152
- let cache = needsRustLmdbCache
153
- ? new LMDBLiteCache(cacheDir)
154
- : outputFS instanceof NodeFS
155
- ? new LMDBCache(cacheDir)
156
- : new FSCache(outputFS, cacheDir);
149
+ let cache =
150
+ outputFS instanceof NodeFS
151
+ ? new LMDBLiteCache(cacheDir)
152
+ : new FSCache(outputFS, cacheDir);
157
153
 
158
154
  let mode = initialOptions.mode ?? 'development';
159
155
  let shouldOptimize =