@atlaspack/core 2.13.2-dev.3682 → 2.14.0
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 +61 -0
- package/package.json +20 -20
- package/src/Atlaspack.js +3 -2
- package/src/atlaspack-v3/AtlaspackV3.js +24 -8
- package/src/loadAtlaspackPlugin.js +26 -71
- package/src/projectPath.js +14 -1
- package/src/requests/WriteBundlesRequest.js +31 -22
- package/LICENSE +0 -201
- package/lib/AssetGraph.js +0 -521
- package/lib/Atlaspack.js +0 -676
- package/lib/AtlaspackConfig.js +0 -298
- package/lib/AtlaspackConfig.schema.js +0 -103
- package/lib/BundleGraph.js +0 -1527
- package/lib/CommittedAsset.js +0 -155
- package/lib/Dependency.js +0 -136
- package/lib/Environment.js +0 -144
- package/lib/IdentifierRegistry.js +0 -36
- package/lib/InternalConfig.js +0 -56
- package/lib/PackagerRunner.js +0 -525
- package/lib/ReporterRunner.js +0 -151
- package/lib/RequestTracker.js +0 -1178
- package/lib/SymbolPropagation.js +0 -618
- package/lib/TargetDescriptor.schema.js +0 -118
- package/lib/Transformation.js +0 -522
- package/lib/UncommittedAsset.js +0 -348
- package/lib/Validation.js +0 -203
- package/lib/applyRuntimes.js +0 -355
- package/lib/assetUtils.js +0 -205
- package/lib/atlaspack-v3/AtlaspackV3.js +0 -57
- package/lib/atlaspack-v3/NapiWorkerPool.js +0 -71
- package/lib/atlaspack-v3/fs.js +0 -39
- package/lib/atlaspack-v3/index.js +0 -26
- package/lib/atlaspack-v3/jsCallable.js +0 -20
- package/lib/atlaspack-v3/worker/compat/asset-symbols.js +0 -197
- package/lib/atlaspack-v3/worker/compat/bitflags.js +0 -84
- package/lib/atlaspack-v3/worker/compat/dependency.js +0 -44
- package/lib/atlaspack-v3/worker/compat/environment.js +0 -57
- package/lib/atlaspack-v3/worker/compat/index.js +0 -104
- package/lib/atlaspack-v3/worker/compat/mutable-asset.js +0 -164
- package/lib/atlaspack-v3/worker/compat/plugin-config.js +0 -78
- package/lib/atlaspack-v3/worker/compat/plugin-logger.js +0 -29
- package/lib/atlaspack-v3/worker/compat/plugin-options.js +0 -113
- package/lib/atlaspack-v3/worker/compat/plugin-tracer.js +0 -12
- package/lib/atlaspack-v3/worker/compat/target.js +0 -17
- package/lib/atlaspack-v3/worker/index.js +0 -3
- package/lib/atlaspack-v3/worker/worker.js +0 -280
- package/lib/constants.js +0 -21
- package/lib/dumpGraphToGraphViz.js +0 -206
- package/lib/index.js +0 -70
- package/lib/loadAtlaspackPlugin.js +0 -136
- package/lib/loadDotEnv.js +0 -54
- package/lib/projectPath.js +0 -94
- package/lib/public/Asset.js +0 -259
- package/lib/public/Bundle.js +0 -236
- package/lib/public/BundleGraph.js +0 -279
- package/lib/public/BundleGroup.js +0 -50
- package/lib/public/Config.js +0 -202
- package/lib/public/Dependency.js +0 -131
- package/lib/public/Environment.js +0 -247
- package/lib/public/MutableBundleGraph.js +0 -204
- package/lib/public/PluginOptions.js +0 -71
- package/lib/public/Symbols.js +0 -247
- package/lib/public/Target.js +0 -64
- package/lib/registerCoreWithSerializer.js +0 -51
- package/lib/requests/AssetGraphRequest.js +0 -432
- package/lib/requests/AssetGraphRequestRust.js +0 -220
- package/lib/requests/AssetRequest.js +0 -132
- package/lib/requests/AtlaspackBuildRequest.js +0 -79
- package/lib/requests/AtlaspackConfigRequest.js +0 -479
- package/lib/requests/BundleGraphRequest.js +0 -485
- package/lib/requests/ConfigRequest.js +0 -203
- package/lib/requests/DevDepRequest.js +0 -193
- package/lib/requests/EntryRequest.js +0 -295
- package/lib/requests/PackageRequest.js +0 -88
- package/lib/requests/PathRequest.js +0 -357
- package/lib/requests/TargetRequest.js +0 -1179
- package/lib/requests/ValidationRequest.js +0 -66
- package/lib/requests/WriteBundleRequest.js +0 -252
- package/lib/requests/WriteBundlesRequest.js +0 -153
- package/lib/requests/asset-graph-diff.js +0 -128
- package/lib/requests/asset-graph-dot.js +0 -131
- package/lib/resolveOptions.js +0 -265
- package/lib/serializerCore.browser.js +0 -29
- package/lib/summarizeRequest.js +0 -55
- package/lib/types.js +0 -35
- package/lib/utils.js +0 -160
- package/lib/worker.js +0 -184
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,66 @@
|
|
|
1
1
|
# @atlaspack/core
|
|
2
2
|
|
|
3
|
+
## 2.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#339](https://github.com/atlassian-labs/atlaspack/pull/339) [`bfe81e5`](https://github.com/atlassian-labs/atlaspack/commit/bfe81e551c4e4bb2cac7fc4745222e66962c1728) Thanks [@yamadapc](https://github.com/yamadapc)! - Update cache invalidation metrics with build type
|
|
8
|
+
|
|
9
|
+
- [#383](https://github.com/atlassian-labs/atlaspack/pull/383) [`8386ca4`](https://github.com/atlassian-labs/atlaspack/commit/8386ca4dc318688fbed1af3bbebf2af3e7d24552) Thanks [@benjervis](https://github.com/benjervis)! - `loadPlugin` no longer returns a `range` field. This field was only set by looking up a package's `parcelDependencies`, which no longer exist.
|
|
10
|
+
|
|
11
|
+
- [#358](https://github.com/atlassian-labs/atlaspack/pull/358) [`7e21377`](https://github.com/atlassian-labs/atlaspack/commit/7e21377914e8091d484f67cb11052a1efd2227e3) Thanks [@benjervis](https://github.com/benjervis)! - Add a step to the BundleGraphRequest that will scan for assets that have a transitive dep on `@confluence/loadable` and marks them as having side effects.
|
|
12
|
+
This allows the inline requires optimizer to be applied to projects that don't necessarily declare side effects correctly.
|
|
13
|
+
|
|
14
|
+
- [#366](https://github.com/atlassian-labs/atlaspack/pull/366) [`4812d0f`](https://github.com/atlassian-labs/atlaspack/commit/4812d0f7400af0f8416f1b7175ecb87700860a68) Thanks [@alshdavid](https://github.com/alshdavid)! - Added NapiWorkerPool
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [#401](https://github.com/atlassian-labs/atlaspack/pull/401) [`cd964ee`](https://github.com/atlassian-labs/atlaspack/commit/cd964eed5a330ae63733656ded691d1ea3afe4e3) Thanks [@MonicaOlejniczak](https://github.com/MonicaOlejniczak)! - Fix respondToFsEvents return type
|
|
19
|
+
|
|
20
|
+
- [#413](https://github.com/atlassian-labs/atlaspack/pull/413) [`1953d1b`](https://github.com/atlassian-labs/atlaspack/commit/1953d1bec266a39dc4bfce5f6c7959e77e63411e) Thanks [@pancaspe87](https://github.com/pancaspe87)! - Patch absolute paths
|
|
21
|
+
|
|
22
|
+
- [#416](https://github.com/atlassian-labs/atlaspack/pull/416) [`1de1c81`](https://github.com/atlassian-labs/atlaspack/commit/1de1c8138fbe4d38a64aa1f3c22a70aad59fb5bb) Thanks [@alshdavid](https://github.com/alshdavid)! - Replace require.resolve with path.join
|
|
23
|
+
|
|
24
|
+
- [#362](https://github.com/atlassian-labs/atlaspack/pull/362) [`726b0b0`](https://github.com/atlassian-labs/atlaspack/commit/726b0b02f4ba47426dd38d809036517477b8b1cd) Thanks [@alshdavid](https://github.com/alshdavid)! - Added conditional bundling config to native js transformer
|
|
25
|
+
|
|
26
|
+
- [#404](https://github.com/atlassian-labs/atlaspack/pull/404) [`be88bd9`](https://github.com/atlassian-labs/atlaspack/commit/be88bd9fc4cbc1c579685bf2e5d834b4136a6c7c) Thanks [@benjervis](https://github.com/benjervis)! - Removes the dependency check within the config default `package.json`.
|
|
27
|
+
|
|
28
|
+
Any dependencies that used to be auto-installed from `parcelDependencies` should
|
|
29
|
+
now be installed in the project root.
|
|
30
|
+
|
|
31
|
+
- [#415](https://github.com/atlassian-labs/atlaspack/pull/415) [`43113f8`](https://github.com/atlassian-labs/atlaspack/commit/43113f8f00232c5a52169a3f11f846d6e4d94b0a) Thanks [@yamadapc](https://github.com/yamadapc)! - Add feature-flag to fix supporting source-maps for inline bundles
|
|
32
|
+
|
|
33
|
+
- [#367](https://github.com/atlassian-labs/atlaspack/pull/367) [`3650f7c`](https://github.com/atlassian-labs/atlaspack/commit/3650f7c9ab803b5ae20b223e82b2268a1b614e43) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Add basic incremental build support to V3
|
|
34
|
+
|
|
35
|
+
- [#414](https://github.com/atlassian-labs/atlaspack/pull/414) [`eff9809`](https://github.com/atlassian-labs/atlaspack/commit/eff98093703b9999a511b87a19562f5aaccfcb53) Thanks [@alshdavid](https://github.com/alshdavid)! - Added type:commonjs to package.json files
|
|
36
|
+
|
|
37
|
+
- [#354](https://github.com/atlassian-labs/atlaspack/pull/354) [`a4990f6`](https://github.com/atlassian-labs/atlaspack/commit/a4990f6f32045b95d0e6da97f692269a38e13533) Thanks [@yamadapc](https://github.com/yamadapc)! - Log errors to load the graph including bail-out errors
|
|
38
|
+
|
|
39
|
+
- [#359](https://github.com/atlassian-labs/atlaspack/pull/359) [`c2ef915`](https://github.com/atlassian-labs/atlaspack/commit/c2ef915dc54784ce4b8180025ac1b2e13b375002) Thanks [@alshdavid](https://github.com/alshdavid)! - Added support for string featureflags to native
|
|
40
|
+
|
|
41
|
+
- [#340](https://github.com/atlassian-labs/atlaspack/pull/340) [`1b1ef6e`](https://github.com/atlassian-labs/atlaspack/commit/1b1ef6e64fdfcf1c1c744e90e8c6568b0fd0e072) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Ensure bundle graph request errors show up correctly
|
|
42
|
+
|
|
43
|
+
- [#402](https://github.com/atlassian-labs/atlaspack/pull/402) [`cc66aaa`](https://github.com/atlassian-labs/atlaspack/commit/cc66aaa66d67dd0cb89e083f387a278e74aad3f0) Thanks [@alshdavid](https://github.com/alshdavid)! - Initialize AtlaspackNative async
|
|
44
|
+
|
|
45
|
+
- [#373](https://github.com/atlassian-labs/atlaspack/pull/373) [`a1e3c87`](https://github.com/atlassian-labs/atlaspack/commit/a1e3c87f25c8d108807fb8ea0e91e8effb2c71a7) Thanks [@yamadapc](https://github.com/yamadapc)! - Add config request ID into the identifier registry
|
|
46
|
+
|
|
47
|
+
- Updated dependencies [[`bfe81e5`](https://github.com/atlassian-labs/atlaspack/commit/bfe81e551c4e4bb2cac7fc4745222e66962c1728), [`fa4fcf6`](https://github.com/atlassian-labs/atlaspack/commit/fa4fcf69a82b0a3727066ada6e93a149b259936e), [`cd964ee`](https://github.com/atlassian-labs/atlaspack/commit/cd964eed5a330ae63733656ded691d1ea3afe4e3), [`1953d1b`](https://github.com/atlassian-labs/atlaspack/commit/1953d1bec266a39dc4bfce5f6c7959e77e63411e), [`ce4ce95`](https://github.com/atlassian-labs/atlaspack/commit/ce4ce953914e08991cf58c70c98f758690e5ee21), [`1de1c81`](https://github.com/atlassian-labs/atlaspack/commit/1de1c8138fbe4d38a64aa1f3c22a70aad59fb5bb), [`28dee1d`](https://github.com/atlassian-labs/atlaspack/commit/28dee1db7d9a995161b45f76c1a03b80ccaeab4b), [`a317453`](https://github.com/atlassian-labs/atlaspack/commit/a317453432b7f30e98f2a4cbcafdaa5601bcde63), [`2055adb`](https://github.com/atlassian-labs/atlaspack/commit/2055adbe31de792e2a2a591b94d2f33f50735879), [`8bc3db9`](https://github.com/atlassian-labs/atlaspack/commit/8bc3db94cc7382b22ca8207c92af8f6389c17e2e), [`cfa1c63`](https://github.com/atlassian-labs/atlaspack/commit/cfa1c63d710c5f9c9abc55f34220b70fb517c3b8), [`17427a2`](https://github.com/atlassian-labs/atlaspack/commit/17427a2b2fc9c34ef0b941907c2868edef6d1507), [`e962cd7`](https://github.com/atlassian-labs/atlaspack/commit/e962cd735877f7f16163e60868d70d9c10054ebe), [`104a46a`](https://github.com/atlassian-labs/atlaspack/commit/104a46a5ee1fae176d29fcc6420d6bd9c01b35b1), [`9572aca`](https://github.com/atlassian-labs/atlaspack/commit/9572aca2a2313a3c05551f73e556128e77a37732), [`34b740d`](https://github.com/atlassian-labs/atlaspack/commit/34b740d4e2449fba7b50cb9708c56d8033dca5b9), [`4837b69`](https://github.com/atlassian-labs/atlaspack/commit/4837b6988e56ca842a24797b796160964d3696ce), [`e5fa92d`](https://github.com/atlassian-labs/atlaspack/commit/e5fa92de26c87fb5d4d681af1931451749ba970a), [`f6dbdff`](https://github.com/atlassian-labs/atlaspack/commit/f6dbdff59d843e2a832d206205343178b33bf1f5), [`7e21377`](https://github.com/atlassian-labs/atlaspack/commit/7e21377914e8091d484f67cb11052a1efd2227e3), [`43113f8`](https://github.com/atlassian-labs/atlaspack/commit/43113f8f00232c5a52169a3f11f846d6e4d94b0a), [`e962cd7`](https://github.com/atlassian-labs/atlaspack/commit/e962cd735877f7f16163e60868d70d9c10054ebe), [`3650f7c`](https://github.com/atlassian-labs/atlaspack/commit/3650f7c9ab803b5ae20b223e82b2268a1b614e43), [`eff9809`](https://github.com/atlassian-labs/atlaspack/commit/eff98093703b9999a511b87a19562f5aaccfcb53), [`c2ef915`](https://github.com/atlassian-labs/atlaspack/commit/c2ef915dc54784ce4b8180025ac1b2e13b375002), [`f635123`](https://github.com/atlassian-labs/atlaspack/commit/f635123f9a06961bc5e053e237f1023f10800ea3), [`4812d0f`](https://github.com/atlassian-labs/atlaspack/commit/4812d0f7400af0f8416f1b7175ecb87700860a68), [`80d963e`](https://github.com/atlassian-labs/atlaspack/commit/80d963ed950f5d742ebd78014cf74f3c65cd4474), [`8fae5f3`](https://github.com/atlassian-labs/atlaspack/commit/8fae5f3005bd7c806b175b4df1754abf58922591), [`3005307`](https://github.com/atlassian-labs/atlaspack/commit/30053076dfd20ca62ddbc682f58adb994029ac55), [`cc66aaa`](https://github.com/atlassian-labs/atlaspack/commit/cc66aaa66d67dd0cb89e083f387a278e74aad3f0), [`67df3f1`](https://github.com/atlassian-labs/atlaspack/commit/67df3f1af1432d77ee6b8850010d976d3313693a), [`0c3ad7a`](https://github.com/atlassian-labs/atlaspack/commit/0c3ad7a302330da1d5e3c025963cc583eb5c28ed)]:
|
|
48
|
+
- @atlaspack/diagnostic@2.14.0
|
|
49
|
+
- @atlaspack/feature-flags@2.14.0
|
|
50
|
+
- @atlaspack/fs@2.14.0
|
|
51
|
+
- @atlaspack/graph@3.4.0
|
|
52
|
+
- @atlaspack/logger@2.14.0
|
|
53
|
+
- @atlaspack/package-manager@2.14.0
|
|
54
|
+
- @atlaspack/plugin@2.14.0
|
|
55
|
+
- @atlaspack/profiler@2.14.0
|
|
56
|
+
- @atlaspack/rust@3.0.0
|
|
57
|
+
- @atlaspack/types@2.14.0
|
|
58
|
+
- @atlaspack/utils@2.14.0
|
|
59
|
+
- @atlaspack/workers@2.14.0
|
|
60
|
+
- @atlaspack/events@2.14.0
|
|
61
|
+
- @atlaspack/build-cache@2.13.2
|
|
62
|
+
- @atlaspack/cache@2.13.2
|
|
63
|
+
|
|
3
64
|
## 2.13.1
|
|
4
65
|
|
|
5
66
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.0",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -20,22 +20,22 @@
|
|
|
20
20
|
"check-ts": "tsc --noEmit index.d.ts"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@atlaspack/build-cache": "2.13.2-dev.3682+e6c0286ea",
|
|
24
|
-
"@atlaspack/cache": "2.13.2-dev.3682+e6c0286ea",
|
|
25
|
-
"@atlaspack/diagnostic": "2.13.2-dev.3682+e6c0286ea",
|
|
26
|
-
"@atlaspack/events": "2.13.2-dev.3682+e6c0286ea",
|
|
27
|
-
"@atlaspack/feature-flags": "2.13.2-dev.3682+e6c0286ea",
|
|
28
|
-
"@atlaspack/fs": "2.13.2-dev.3682+e6c0286ea",
|
|
29
|
-
"@atlaspack/graph": "3.3.2-dev.3682+e6c0286ea",
|
|
30
|
-
"@atlaspack/logger": "2.13.2-dev.3682+e6c0286ea",
|
|
31
|
-
"@atlaspack/package-manager": "2.13.2-dev.3682+e6c0286ea",
|
|
32
|
-
"@atlaspack/plugin": "2.13.2-dev.3682+e6c0286ea",
|
|
33
|
-
"@atlaspack/profiler": "2.13.2-dev.3682+e6c0286ea",
|
|
34
|
-
"@atlaspack/rust": "2.13.2-dev.3682+e6c0286ea",
|
|
35
|
-
"@atlaspack/types": "2.13.2-dev.3682+e6c0286ea",
|
|
36
|
-
"@atlaspack/utils": "2.13.2-dev.3682+e6c0286ea",
|
|
37
|
-
"@atlaspack/workers": "2.13.2-dev.3682+e6c0286ea",
|
|
38
23
|
"@mischnic/json-sourcemap": "^0.1.0",
|
|
24
|
+
"@atlaspack/build-cache": "2.13.2",
|
|
25
|
+
"@atlaspack/cache": "2.13.2",
|
|
26
|
+
"@atlaspack/diagnostic": "2.14.0",
|
|
27
|
+
"@atlaspack/events": "2.14.0",
|
|
28
|
+
"@atlaspack/feature-flags": "2.14.0",
|
|
29
|
+
"@atlaspack/fs": "2.14.0",
|
|
30
|
+
"@atlaspack/graph": "3.4.0",
|
|
31
|
+
"@atlaspack/logger": "2.14.0",
|
|
32
|
+
"@atlaspack/package-manager": "2.14.0",
|
|
33
|
+
"@atlaspack/plugin": "2.14.0",
|
|
34
|
+
"@atlaspack/profiler": "2.14.0",
|
|
35
|
+
"@atlaspack/rust": "3.0.0",
|
|
36
|
+
"@atlaspack/types": "2.14.0",
|
|
37
|
+
"@atlaspack/utils": "2.14.0",
|
|
38
|
+
"@atlaspack/workers": "2.14.0",
|
|
39
39
|
"@parcel/source-map": "^2.1.1",
|
|
40
40
|
"base-x": "^3.0.8",
|
|
41
41
|
"browserslist": "^4.6.6",
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
"semver": "^7.5.2"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@atlaspack/babel-register": "2.
|
|
51
|
+
"@atlaspack/babel-register": "2.14.0",
|
|
52
52
|
"@types/node": ">= 18",
|
|
53
|
-
"graphviz": "^0.0.9",
|
|
54
|
-
"jest-diff": "*",
|
|
55
53
|
"rfdc": "1",
|
|
54
|
+
"jest-diff": "*",
|
|
55
|
+
"graphviz": "^0.0.9",
|
|
56
56
|
"tempy": "^0.2.1"
|
|
57
57
|
},
|
|
58
58
|
"exports": {
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"browser": {
|
|
67
67
|
"./src/serializerCore.js": "./src/serializerCore.browser.js"
|
|
68
68
|
},
|
|
69
|
-
"
|
|
69
|
+
"type": "commonjs"
|
|
70
70
|
}
|
package/src/Atlaspack.js
CHANGED
|
@@ -68,6 +68,7 @@ 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
72
|
|
|
72
73
|
export default class Atlaspack {
|
|
73
74
|
#requestTracker /*: RequestTracker*/;
|
|
@@ -161,7 +162,7 @@ export default class Atlaspack {
|
|
|
161
162
|
const version = require('../package.json').version;
|
|
162
163
|
await lmdb.put('current_session_version', Buffer.from(version));
|
|
163
164
|
|
|
164
|
-
rustAtlaspack =
|
|
165
|
+
rustAtlaspack = await AtlaspackV3.create({
|
|
165
166
|
...options,
|
|
166
167
|
corePath: path.join(__dirname, '..'),
|
|
167
168
|
threads: process.env.NODE_ENV === 'test' ? 2 : undefined,
|
|
@@ -728,6 +729,6 @@ export function createWorkerFarm(
|
|
|
728
729
|
): WorkerFarm {
|
|
729
730
|
return new WorkerFarm({
|
|
730
731
|
...options,
|
|
731
|
-
workerPath:
|
|
732
|
+
workerPath: WORKER_PATH,
|
|
732
733
|
});
|
|
733
734
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
-
|
|
4
|
+
atlaspackNapiCreate,
|
|
5
|
+
atlaspackNapiBuildAssetGraph,
|
|
6
|
+
atlaspackNapiRespondToFsEvents,
|
|
7
|
+
type AtlaspackNapi,
|
|
5
8
|
type Lmdb,
|
|
6
9
|
type AtlaspackNapiOptions,
|
|
7
10
|
} from '@atlaspack/rust';
|
|
@@ -24,24 +27,27 @@ export type AtlaspackV3Options = {|
|
|
|
24
27
|
|};
|
|
25
28
|
|
|
26
29
|
export class AtlaspackV3 {
|
|
27
|
-
|
|
28
|
-
_workerIds: any[];
|
|
30
|
+
_atlaspack_napi: AtlaspackNapi;
|
|
29
31
|
|
|
30
|
-
constructor({
|
|
32
|
+
constructor(atlaspack_napi: AtlaspackNapi) {
|
|
33
|
+
this._atlaspack_napi = atlaspack_napi;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static async create({
|
|
31
37
|
fs,
|
|
32
38
|
packageManager,
|
|
33
39
|
threads,
|
|
34
40
|
lmdb,
|
|
35
41
|
napiWorkerPool = new NapiWorkerPool(),
|
|
36
42
|
...options
|
|
37
|
-
}: AtlaspackV3Options) {
|
|
43
|
+
}: AtlaspackV3Options): Promise<AtlaspackV3> {
|
|
38
44
|
options.logLevel = options.logLevel || 'error';
|
|
39
45
|
options.defaultTargetOptions = options.defaultTargetOptions || {};
|
|
40
46
|
// $FlowFixMe "engines" are readonly
|
|
41
47
|
options.defaultTargetOptions.engines =
|
|
42
48
|
options.defaultTargetOptions.engines || {};
|
|
43
49
|
|
|
44
|
-
|
|
50
|
+
const [internal, error] = await atlaspackNapiCreate(
|
|
45
51
|
{
|
|
46
52
|
fs,
|
|
47
53
|
packageManager,
|
|
@@ -51,10 +57,20 @@ export class AtlaspackV3 {
|
|
|
51
57
|
},
|
|
52
58
|
lmdb,
|
|
53
59
|
);
|
|
60
|
+
|
|
61
|
+
if (error !== null) {
|
|
62
|
+
throw new ThrowableDiagnostic({
|
|
63
|
+
diagnostic: error,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return new AtlaspackV3(internal);
|
|
54
68
|
}
|
|
55
69
|
|
|
56
70
|
async buildAssetGraph(): Promise<any> {
|
|
57
|
-
let [graph, error] = await
|
|
71
|
+
let [graph, error] = await atlaspackNapiBuildAssetGraph(
|
|
72
|
+
this._atlaspack_napi,
|
|
73
|
+
);
|
|
58
74
|
|
|
59
75
|
if (error !== null) {
|
|
60
76
|
throw new ThrowableDiagnostic({
|
|
@@ -66,6 +82,6 @@ export class AtlaspackV3 {
|
|
|
66
82
|
}
|
|
67
83
|
|
|
68
84
|
respondToFsEvents(events: Array<Event>): boolean {
|
|
69
|
-
return this.
|
|
85
|
+
return atlaspackNapiRespondToFsEvents(this._atlaspack_napi, events);
|
|
70
86
|
}
|
|
71
87
|
}
|
|
@@ -10,11 +10,7 @@ import ThrowableDiagnostic, {
|
|
|
10
10
|
generateJSONCodeHighlights,
|
|
11
11
|
md,
|
|
12
12
|
} from '@atlaspack/diagnostic';
|
|
13
|
-
import {
|
|
14
|
-
findAlternativeNodeModules,
|
|
15
|
-
loadConfig,
|
|
16
|
-
resolveConfig,
|
|
17
|
-
} from '@atlaspack/utils';
|
|
13
|
+
import {findAlternativeNodeModules, resolveConfig} from '@atlaspack/utils';
|
|
18
14
|
import {type ProjectPath, toProjectPath} from './projectPath';
|
|
19
15
|
import {version as ATLASPACK_VERSION} from '../package.json';
|
|
20
16
|
|
|
@@ -32,73 +28,32 @@ export default async function loadPlugin<T>(
|
|
|
32
28
|
resolveFrom: ProjectPath,
|
|
33
29
|
|}> {
|
|
34
30
|
let resolveFrom = configPath;
|
|
35
|
-
if (resolveFrom.includes(NODE_MODULES)) {
|
|
36
|
-
// Config packages can reference plugins, but cannot contain other plugins within them.
|
|
37
|
-
// This forces every published plugin to be published separately so they can be mixed and matched if needed.
|
|
38
|
-
if (pluginName.startsWith('.')) {
|
|
39
|
-
let configContents = await options.inputFS.readFile(configPath, 'utf8');
|
|
40
|
-
throw new ThrowableDiagnostic({
|
|
41
|
-
diagnostic: {
|
|
42
|
-
message: md`Local plugins are not supported in Atlaspack config packages. Please publish "${pluginName}" as a separate npm package.`,
|
|
43
|
-
origin: '@atlaspack/core',
|
|
44
|
-
codeFrames: keyPath
|
|
45
|
-
? [
|
|
46
|
-
{
|
|
47
|
-
filePath: configPath,
|
|
48
|
-
language: 'json5',
|
|
49
|
-
code: configContents,
|
|
50
|
-
codeHighlights: generateJSONCodeHighlights(configContents, [
|
|
51
|
-
{
|
|
52
|
-
key: keyPath,
|
|
53
|
-
type: 'value',
|
|
54
|
-
},
|
|
55
|
-
]),
|
|
56
|
-
},
|
|
57
|
-
]
|
|
58
|
-
: undefined,
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
31
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
language: 'json5',
|
|
89
|
-
code: contents,
|
|
90
|
-
codeHighlights: generateJSONCodeHighlights(contents, [
|
|
91
|
-
{
|
|
92
|
-
key: '/dependencies',
|
|
93
|
-
type: 'key',
|
|
94
|
-
},
|
|
95
|
-
]),
|
|
96
|
-
},
|
|
97
|
-
]
|
|
98
|
-
: undefined,
|
|
99
|
-
},
|
|
100
|
-
});
|
|
101
|
-
}
|
|
32
|
+
// Config packages can reference plugins, but cannot contain other plugins within them.
|
|
33
|
+
// This forces every published plugin to be published separately so they can be mixed and matched if needed.
|
|
34
|
+
if (resolveFrom.includes(NODE_MODULES) && pluginName.startsWith('.')) {
|
|
35
|
+
let configContents = await options.inputFS.readFile(configPath, 'utf8');
|
|
36
|
+
throw new ThrowableDiagnostic({
|
|
37
|
+
diagnostic: {
|
|
38
|
+
message: md`Local plugins are not supported in Atlaspack config packages. Please publish "${pluginName}" as a separate npm package.`,
|
|
39
|
+
origin: '@atlaspack/core',
|
|
40
|
+
codeFrames: keyPath
|
|
41
|
+
? [
|
|
42
|
+
{
|
|
43
|
+
filePath: configPath,
|
|
44
|
+
language: 'json5',
|
|
45
|
+
code: configContents,
|
|
46
|
+
codeHighlights: generateJSONCodeHighlights(configContents, [
|
|
47
|
+
{
|
|
48
|
+
key: keyPath,
|
|
49
|
+
type: 'value',
|
|
50
|
+
},
|
|
51
|
+
]),
|
|
52
|
+
},
|
|
53
|
+
]
|
|
54
|
+
: undefined,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
102
57
|
}
|
|
103
58
|
|
|
104
59
|
let resolved, pkg;
|
package/src/projectPath.js
CHANGED
|
@@ -2,19 +2,27 @@
|
|
|
2
2
|
import type {FilePath} from '@atlaspack/types';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import {relativePath, normalizeSeparators} from '@atlaspack/utils';
|
|
5
|
+
import {getFeatureFlagValue} from '@atlaspack/feature-flags';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* A path that's relative to the project root.
|
|
8
9
|
*/
|
|
9
10
|
export opaque type ProjectPath = string;
|
|
10
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Converts a file path to a project-relative path.
|
|
14
|
+
*
|
|
15
|
+
* @param projectRoot - The project root.
|
|
16
|
+
* @param p - The file path to convert.
|
|
17
|
+
* @returns The project path.
|
|
18
|
+
*/
|
|
11
19
|
function toProjectPath_(projectRoot: FilePath, p: FilePath): ProjectPath {
|
|
12
20
|
// If the file path is not provided, then treat it as though it is already from the project root
|
|
13
21
|
if (p == null) {
|
|
14
22
|
return p;
|
|
15
23
|
}
|
|
16
24
|
|
|
17
|
-
// If the file path is already relative and it does not begin with . then treat the path as if it
|
|
25
|
+
// If the file path is already relative and it does not begin with '.', then treat the path as if it
|
|
18
26
|
// is already from the project root. This prevents relative paths from being processed twice,
|
|
19
27
|
// most often within `toInternalSourceLocation` when handling loc types from symbols and asset
|
|
20
28
|
// dependencies.
|
|
@@ -27,6 +35,11 @@ function toProjectPath_(projectRoot: FilePath, p: FilePath): ProjectPath {
|
|
|
27
35
|
// the project root is not portable anyway.
|
|
28
36
|
let relative = relativePath(projectRoot, p, false);
|
|
29
37
|
if (relative.startsWith('..')) {
|
|
38
|
+
// e.g given projectRoot = '/Users/monorepo/project' and p = '/Users/monorepo/other-project/src/index.js' --> relative = '../other-project/src/index.js'
|
|
39
|
+
if (getFeatureFlagValue('patchProjectPaths')) {
|
|
40
|
+
return relative;
|
|
41
|
+
}
|
|
42
|
+
|
|
30
43
|
return process.platform === 'win32' ? normalizeSeparators(p) : p;
|
|
31
44
|
}
|
|
32
45
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import type {ContentKey} from '@atlaspack/graph';
|
|
4
4
|
import type {Async} from '@atlaspack/types';
|
|
5
|
+
import {getFeatureFlag} from '@atlaspack/feature-flags';
|
|
5
6
|
import type {SharedReference} from '@atlaspack/workers';
|
|
6
7
|
import type {StaticRunOpts} from '../RequestTracker';
|
|
7
8
|
import {requestTypes} from '../RequestTracker';
|
|
@@ -63,29 +64,37 @@ async function run({input, api, farm, options}) {
|
|
|
63
64
|
|} = {};
|
|
64
65
|
let writeEarlyPromises = {};
|
|
65
66
|
let hashRefToNameHash = new Map();
|
|
66
|
-
let bundles = bundleGraph.getBundles().filter((bundle) => {
|
|
67
|
-
// Do not package and write placeholder bundles to disk. We just
|
|
68
|
-
// need to update the name so other bundles can reference it.
|
|
69
|
-
if (bundle.isPlaceholder) {
|
|
70
|
-
let hash = bundle.id.slice(-8);
|
|
71
|
-
hashRefToNameHash.set(bundle.hashReference, hash);
|
|
72
|
-
let name = nullthrows(
|
|
73
|
-
bundle.name,
|
|
74
|
-
`Expected ${bundle.type} bundle to have a name`,
|
|
75
|
-
).replace(bundle.hashReference, hash);
|
|
76
|
-
res.set(bundle.id, {
|
|
77
|
-
filePath: joinProjectPath(bundle.target.distDir, name),
|
|
78
|
-
type: bundle.type, // FIXME: this is wrong if the packager changes the type...
|
|
79
|
-
stats: {
|
|
80
|
-
time: 0,
|
|
81
|
-
size: 0,
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
67
|
|
|
87
|
-
|
|
68
|
+
// Include inline bundles so that non-inline bundles referenced from inline bundles are written to
|
|
69
|
+
// separate files. This ensures that source maps are written and work.
|
|
70
|
+
const allBundles = bundleGraph.getBundles({
|
|
71
|
+
includeInline: getFeatureFlag('inlineBundlesSourceMapFixes'),
|
|
88
72
|
});
|
|
73
|
+
const bundles = allBundles
|
|
74
|
+
.filter((bundle) => bundle.bundleBehavior !== 'inline')
|
|
75
|
+
.filter((bundle) => {
|
|
76
|
+
// Do not package and write placeholder bundles to disk. We just
|
|
77
|
+
// need to update the name so other bundles can reference it.
|
|
78
|
+
if (bundle.isPlaceholder) {
|
|
79
|
+
let hash = bundle.id.slice(-8);
|
|
80
|
+
hashRefToNameHash.set(bundle.hashReference, hash);
|
|
81
|
+
let name = nullthrows(
|
|
82
|
+
bundle.name,
|
|
83
|
+
`Expected ${bundle.type} bundle to have a name`,
|
|
84
|
+
).replace(bundle.hashReference, hash);
|
|
85
|
+
res.set(bundle.id, {
|
|
86
|
+
filePath: joinProjectPath(bundle.target.distDir, name),
|
|
87
|
+
type: bundle.type, // FIXME: this is wrong if the packager changes the type...
|
|
88
|
+
stats: {
|
|
89
|
+
time: 0,
|
|
90
|
+
size: 0,
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return true;
|
|
97
|
+
});
|
|
89
98
|
|
|
90
99
|
// Package on the main thread if there is only one bundle to package.
|
|
91
100
|
// This avoids the cost of serializing the bundle graph for single file change builds.
|
|
@@ -194,7 +203,7 @@ function getBundlesIncludedInHash(
|
|
|
194
203
|
included = new Set(),
|
|
195
204
|
) {
|
|
196
205
|
included.add(bundleId);
|
|
197
|
-
for (let hashRef of bundleInfoMap[bundleId]
|
|
206
|
+
for (let hashRef of bundleInfoMap[bundleId]?.hashReferences ?? []) {
|
|
198
207
|
let referencedId = getIdFromHashRef(hashRef);
|
|
199
208
|
if (!included.has(referencedId)) {
|
|
200
209
|
getBundlesIncludedInHash(referencedId, bundleInfoMap, included);
|