@atlaspack/core 2.13.2-dev.3689 → 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.
Files changed (85) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/package.json +20 -20
  3. package/src/Atlaspack.js +3 -2
  4. package/src/atlaspack-v3/AtlaspackV3.js +25 -9
  5. package/src/requests/WriteBundlesRequest.js +31 -22
  6. package/LICENSE +0 -201
  7. package/lib/AssetGraph.js +0 -521
  8. package/lib/Atlaspack.js +0 -676
  9. package/lib/AtlaspackConfig.js +0 -298
  10. package/lib/AtlaspackConfig.schema.js +0 -103
  11. package/lib/BundleGraph.js +0 -1527
  12. package/lib/CommittedAsset.js +0 -155
  13. package/lib/Dependency.js +0 -136
  14. package/lib/Environment.js +0 -144
  15. package/lib/IdentifierRegistry.js +0 -36
  16. package/lib/InternalConfig.js +0 -56
  17. package/lib/PackagerRunner.js +0 -525
  18. package/lib/ReporterRunner.js +0 -151
  19. package/lib/RequestTracker.js +0 -1178
  20. package/lib/SymbolPropagation.js +0 -618
  21. package/lib/TargetDescriptor.schema.js +0 -118
  22. package/lib/Transformation.js +0 -522
  23. package/lib/UncommittedAsset.js +0 -348
  24. package/lib/Validation.js +0 -203
  25. package/lib/applyRuntimes.js +0 -355
  26. package/lib/assetUtils.js +0 -205
  27. package/lib/atlaspack-v3/AtlaspackV3.js +0 -57
  28. package/lib/atlaspack-v3/NapiWorkerPool.js +0 -71
  29. package/lib/atlaspack-v3/fs.js +0 -39
  30. package/lib/atlaspack-v3/index.js +0 -26
  31. package/lib/atlaspack-v3/jsCallable.js +0 -20
  32. package/lib/atlaspack-v3/worker/compat/asset-symbols.js +0 -197
  33. package/lib/atlaspack-v3/worker/compat/bitflags.js +0 -84
  34. package/lib/atlaspack-v3/worker/compat/dependency.js +0 -44
  35. package/lib/atlaspack-v3/worker/compat/environment.js +0 -57
  36. package/lib/atlaspack-v3/worker/compat/index.js +0 -104
  37. package/lib/atlaspack-v3/worker/compat/mutable-asset.js +0 -164
  38. package/lib/atlaspack-v3/worker/compat/plugin-config.js +0 -78
  39. package/lib/atlaspack-v3/worker/compat/plugin-logger.js +0 -29
  40. package/lib/atlaspack-v3/worker/compat/plugin-options.js +0 -113
  41. package/lib/atlaspack-v3/worker/compat/plugin-tracer.js +0 -12
  42. package/lib/atlaspack-v3/worker/compat/target.js +0 -17
  43. package/lib/atlaspack-v3/worker/index.js +0 -3
  44. package/lib/atlaspack-v3/worker/worker.js +0 -280
  45. package/lib/constants.js +0 -21
  46. package/lib/dumpGraphToGraphViz.js +0 -206
  47. package/lib/index.js +0 -70
  48. package/lib/loadAtlaspackPlugin.js +0 -115
  49. package/lib/loadDotEnv.js +0 -54
  50. package/lib/projectPath.js +0 -112
  51. package/lib/public/Asset.js +0 -259
  52. package/lib/public/Bundle.js +0 -236
  53. package/lib/public/BundleGraph.js +0 -279
  54. package/lib/public/BundleGroup.js +0 -50
  55. package/lib/public/Config.js +0 -202
  56. package/lib/public/Dependency.js +0 -131
  57. package/lib/public/Environment.js +0 -247
  58. package/lib/public/MutableBundleGraph.js +0 -204
  59. package/lib/public/PluginOptions.js +0 -71
  60. package/lib/public/Symbols.js +0 -247
  61. package/lib/public/Target.js +0 -64
  62. package/lib/registerCoreWithSerializer.js +0 -51
  63. package/lib/requests/AssetGraphRequest.js +0 -432
  64. package/lib/requests/AssetGraphRequestRust.js +0 -220
  65. package/lib/requests/AssetRequest.js +0 -132
  66. package/lib/requests/AtlaspackBuildRequest.js +0 -79
  67. package/lib/requests/AtlaspackConfigRequest.js +0 -479
  68. package/lib/requests/BundleGraphRequest.js +0 -485
  69. package/lib/requests/ConfigRequest.js +0 -203
  70. package/lib/requests/DevDepRequest.js +0 -193
  71. package/lib/requests/EntryRequest.js +0 -295
  72. package/lib/requests/PackageRequest.js +0 -88
  73. package/lib/requests/PathRequest.js +0 -357
  74. package/lib/requests/TargetRequest.js +0 -1179
  75. package/lib/requests/ValidationRequest.js +0 -66
  76. package/lib/requests/WriteBundleRequest.js +0 -252
  77. package/lib/requests/WriteBundlesRequest.js +0 -153
  78. package/lib/requests/asset-graph-diff.js +0 -128
  79. package/lib/requests/asset-graph-dot.js +0 -131
  80. package/lib/resolveOptions.js +0 -265
  81. package/lib/serializerCore.browser.js +0 -29
  82. package/lib/summarizeRequest.js +0 -55
  83. package/lib/types.js +0 -35
  84. package/lib/utils.js +0 -160
  85. 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.13.2-dev.3689+7a2e6e783",
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.3689+7a2e6e783",
24
- "@atlaspack/cache": "2.13.2-dev.3689+7a2e6e783",
25
- "@atlaspack/diagnostic": "2.13.2-dev.3689+7a2e6e783",
26
- "@atlaspack/events": "2.13.2-dev.3689+7a2e6e783",
27
- "@atlaspack/feature-flags": "2.13.2-dev.3689+7a2e6e783",
28
- "@atlaspack/fs": "2.13.2-dev.3689+7a2e6e783",
29
- "@atlaspack/graph": "3.3.2-dev.3689+7a2e6e783",
30
- "@atlaspack/logger": "2.13.2-dev.3689+7a2e6e783",
31
- "@atlaspack/package-manager": "2.13.2-dev.3689+7a2e6e783",
32
- "@atlaspack/plugin": "2.13.2-dev.3689+7a2e6e783",
33
- "@atlaspack/profiler": "2.13.2-dev.3689+7a2e6e783",
34
- "@atlaspack/rust": "2.13.2-dev.3689+7a2e6e783",
35
- "@atlaspack/types": "2.13.2-dev.3689+7a2e6e783",
36
- "@atlaspack/utils": "2.13.2-dev.3689+7a2e6e783",
37
- "@atlaspack/workers": "2.13.2-dev.3689+7a2e6e783",
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.13.1",
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
- "gitHead": "7a2e6e7835fa846b27021b374097c6a4f37541ba"
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 = new AtlaspackV3({
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: require.resolve('./worker'),
732
+ workerPath: WORKER_PATH,
732
733
  });
733
734
  }
@@ -1,7 +1,10 @@
1
1
  // @flow
2
2
 
3
3
  import {
4
- AtlaspackNapi,
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
- _internal: AtlaspackNapi;
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
- this._internal = AtlaspackNapi.create(
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 this._internal.buildAssetGraph();
71
+ let [graph, error] = await atlaspackNapiBuildAssetGraph(
72
+ this._atlaspack_napi,
73
+ );
58
74
 
59
75
  if (error !== null) {
60
76
  throw new ThrowableDiagnostic({
@@ -65,7 +81,7 @@ export class AtlaspackV3 {
65
81
  return graph;
66
82
  }
67
83
 
68
- respondToFsEvents(events: Array<Event>): Promise<boolean> {
69
- return this._internal.respondToFsEvents(events);
84
+ respondToFsEvents(events: Array<Event>): boolean {
85
+ return atlaspackNapiRespondToFsEvents(this._atlaspack_napi, events);
70
86
  }
71
87
  }
@@ -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
- return true;
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].hashReferences) {
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);
package/LICENSE DELETED
@@ -1,201 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright (c) 2024 Atlassian US., Inc.
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.