@atlaspack/core 2.22.0 → 2.23.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 (92) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/lib/Environment.js +2 -0
  3. package/lib/TargetDescriptor.schema.js +1 -1
  4. package/lib/atlaspack-v3/worker/compat/environment.js +5 -2
  5. package/lib/public/Environment.js +5 -2
  6. package/lib/{atlaspack-v3 → types/atlaspack-v3}/worker/compat/environment.d.ts +1 -0
  7. package/lib/{public → types/public}/Environment.d.ts +1 -0
  8. package/package.json +17 -16
  9. package/src/Environment.ts +2 -0
  10. package/src/TargetDescriptor.schema.ts +1 -0
  11. package/src/atlaspack-v3/worker/compat/environment.ts +6 -1
  12. package/src/public/Environment.ts +10 -1
  13. package/test/Environment.test.ts +22 -0
  14. package/test/PublicEnvironment.test.ts +21 -0
  15. /package/lib/{AssetGraph.d.ts → types/AssetGraph.d.ts} +0 -0
  16. /package/lib/{Atlaspack.d.ts → types/Atlaspack.d.ts} +0 -0
  17. /package/lib/{AtlaspackConfig.d.ts → types/AtlaspackConfig.d.ts} +0 -0
  18. /package/lib/{AtlaspackConfig.schema.d.ts → types/AtlaspackConfig.schema.d.ts} +0 -0
  19. /package/lib/{BundleGraph.d.ts → types/BundleGraph.d.ts} +0 -0
  20. /package/lib/{CommittedAsset.d.ts → types/CommittedAsset.d.ts} +0 -0
  21. /package/lib/{Dependency.d.ts → types/Dependency.d.ts} +0 -0
  22. /package/lib/{Environment.d.ts → types/Environment.d.ts} +0 -0
  23. /package/lib/{EnvironmentManager.d.ts → types/EnvironmentManager.d.ts} +0 -0
  24. /package/lib/{IdentifierRegistry.d.ts → types/IdentifierRegistry.d.ts} +0 -0
  25. /package/lib/{InternalConfig.d.ts → types/InternalConfig.d.ts} +0 -0
  26. /package/lib/{PackagerRunner.d.ts → types/PackagerRunner.d.ts} +0 -0
  27. /package/lib/{ReporterRunner.d.ts → types/ReporterRunner.d.ts} +0 -0
  28. /package/lib/{RequestTracker.d.ts → types/RequestTracker.d.ts} +0 -0
  29. /package/lib/{SymbolPropagation.d.ts → types/SymbolPropagation.d.ts} +0 -0
  30. /package/lib/{TargetDescriptor.schema.d.ts → types/TargetDescriptor.schema.d.ts} +0 -0
  31. /package/lib/{Transformation.d.ts → types/Transformation.d.ts} +0 -0
  32. /package/lib/{UncommittedAsset.d.ts → types/UncommittedAsset.d.ts} +0 -0
  33. /package/lib/{Validation.d.ts → types/Validation.d.ts} +0 -0
  34. /package/lib/{applyRuntimes.d.ts → types/applyRuntimes.d.ts} +0 -0
  35. /package/lib/{assetUtils.d.ts → types/assetUtils.d.ts} +0 -0
  36. /package/lib/{atlaspack-v3 → types/atlaspack-v3}/AtlaspackV3.d.ts +0 -0
  37. /package/lib/{atlaspack-v3 → types/atlaspack-v3}/NapiWorkerPool.d.ts +0 -0
  38. /package/lib/{atlaspack-v3 → types/atlaspack-v3}/fs.d.ts +0 -0
  39. /package/lib/{atlaspack-v3 → types/atlaspack-v3}/index.d.ts +0 -0
  40. /package/lib/{atlaspack-v3 → types/atlaspack-v3}/jsCallable.d.ts +0 -0
  41. /package/lib/{atlaspack-v3 → types/atlaspack-v3}/worker/compat/asset-symbols.d.ts +0 -0
  42. /package/lib/{atlaspack-v3 → types/atlaspack-v3}/worker/compat/bitflags.d.ts +0 -0
  43. /package/lib/{atlaspack-v3 → types/atlaspack-v3}/worker/compat/dependency.d.ts +0 -0
  44. /package/lib/{atlaspack-v3 → types/atlaspack-v3}/worker/compat/index.d.ts +0 -0
  45. /package/lib/{atlaspack-v3 → types/atlaspack-v3}/worker/compat/mutable-asset.d.ts +0 -0
  46. /package/lib/{atlaspack-v3 → types/atlaspack-v3}/worker/compat/plugin-config.d.ts +0 -0
  47. /package/lib/{atlaspack-v3 → types/atlaspack-v3}/worker/compat/plugin-logger.d.ts +0 -0
  48. /package/lib/{atlaspack-v3 → types/atlaspack-v3}/worker/compat/plugin-options.d.ts +0 -0
  49. /package/lib/{atlaspack-v3 → types/atlaspack-v3}/worker/compat/plugin-tracer.d.ts +0 -0
  50. /package/lib/{atlaspack-v3 → types/atlaspack-v3}/worker/compat/target.d.ts +0 -0
  51. /package/lib/{atlaspack-v3 → types/atlaspack-v3}/worker/worker.d.ts +0 -0
  52. /package/lib/{constants.d.ts → types/constants.d.ts} +0 -0
  53. /package/lib/{dumpGraphToGraphViz.d.ts → types/dumpGraphToGraphViz.d.ts} +0 -0
  54. /package/lib/{index.d.ts → types/index.d.ts} +0 -0
  55. /package/lib/{loadAtlaspackPlugin.d.ts → types/loadAtlaspackPlugin.d.ts} +0 -0
  56. /package/lib/{loadDotEnv.d.ts → types/loadDotEnv.d.ts} +0 -0
  57. /package/lib/{projectPath.d.ts → types/projectPath.d.ts} +0 -0
  58. /package/lib/{public → types/public}/Asset.d.ts +0 -0
  59. /package/lib/{public → types/public}/Bundle.d.ts +0 -0
  60. /package/lib/{public → types/public}/BundleGraph.d.ts +0 -0
  61. /package/lib/{public → types/public}/BundleGroup.d.ts +0 -0
  62. /package/lib/{public → types/public}/Config.d.ts +0 -0
  63. /package/lib/{public → types/public}/Dependency.d.ts +0 -0
  64. /package/lib/{public → types/public}/MutableBundleGraph.d.ts +0 -0
  65. /package/lib/{public → types/public}/PluginOptions.d.ts +0 -0
  66. /package/lib/{public → types/public}/Symbols.d.ts +0 -0
  67. /package/lib/{public → types/public}/Target.d.ts +0 -0
  68. /package/lib/{registerCoreWithSerializer.d.ts → types/registerCoreWithSerializer.d.ts} +0 -0
  69. /package/lib/{requests → types/requests}/AssetGraphRequest.d.ts +0 -0
  70. /package/lib/{requests → types/requests}/AssetGraphRequestRust.d.ts +0 -0
  71. /package/lib/{requests → types/requests}/AssetRequest.d.ts +0 -0
  72. /package/lib/{requests → types/requests}/AtlaspackBuildRequest.d.ts +0 -0
  73. /package/lib/{requests → types/requests}/AtlaspackConfigRequest.d.ts +0 -0
  74. /package/lib/{requests → types/requests}/BundleGraphRequest.d.ts +0 -0
  75. /package/lib/{requests → types/requests}/ConfigRequest.d.ts +0 -0
  76. /package/lib/{requests → types/requests}/DevDepRequest.d.ts +0 -0
  77. /package/lib/{requests → types/requests}/EntryRequest.d.ts +0 -0
  78. /package/lib/{requests → types/requests}/PackageRequest.d.ts +0 -0
  79. /package/lib/{requests → types/requests}/PathRequest.d.ts +0 -0
  80. /package/lib/{requests → types/requests}/TargetRequest.d.ts +0 -0
  81. /package/lib/{requests → types/requests}/ValidationRequest.d.ts +0 -0
  82. /package/lib/{requests → types/requests}/WriteBundleRequest.d.ts +0 -0
  83. /package/lib/{requests → types/requests}/WriteBundlesRequest.d.ts +0 -0
  84. /package/lib/{requests → types/requests}/asset-graph-diff.d.ts +0 -0
  85. /package/lib/{requests → types/requests}/asset-graph-dot.d.ts +0 -0
  86. /package/lib/{resolveOptions.d.ts → types/resolveOptions.d.ts} +0 -0
  87. /package/lib/{rustWorkerThreadDylibHack.d.ts → types/rustWorkerThreadDylibHack.d.ts} +0 -0
  88. /package/lib/{serializerCore.browser.d.ts → types/serializerCore.browser.d.ts} +0 -0
  89. /package/lib/{summarizeRequest.d.ts → types/summarizeRequest.d.ts} +0 -0
  90. /package/lib/{types.d.ts → types/types.d.ts} +0 -0
  91. /package/lib/{utils.d.ts → types/utils.d.ts} +0 -0
  92. /package/lib/{worker.d.ts → types/worker.d.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @atlaspack/core
2
2
 
3
+ ## 2.23.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#732](https://github.com/atlassian-labs/atlaspack/pull/732) [`7f5841c`](https://github.com/atlassian-labs/atlaspack/commit/7f5841c39df049f9546cccbeea2a7337e0337b45) Thanks [@vykimnguyen](https://github.com/vykimnguyen)! - add tesseract context
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`ad26146`](https://github.com/atlassian-labs/atlaspack/commit/ad26146f13b4c1cc65d4a0f9c67060b90ef14ff3), [`f1b48e7`](https://github.com/atlassian-labs/atlaspack/commit/f1b48e7a04e005cef0f36a3e692087a9ecdb6f7a), [`7f5841c`](https://github.com/atlassian-labs/atlaspack/commit/7f5841c39df049f9546cccbeea2a7337e0337b45), [`73dd7ba`](https://github.com/atlassian-labs/atlaspack/commit/73dd7baab69456ef2f6e4a0cc7dbb04f407eb148)]:
12
+ - @atlaspack/rust@3.6.0
13
+ - @atlaspack/feature-flags@2.22.0
14
+ - @atlaspack/cache@3.2.19
15
+ - @atlaspack/fs@2.15.19
16
+ - @atlaspack/logger@2.14.16
17
+ - @atlaspack/utils@2.18.1
18
+ - @atlaspack/package-manager@2.14.24
19
+ - @atlaspack/graph@3.5.13
20
+ - @atlaspack/plugin@2.14.24
21
+ - @atlaspack/profiler@2.14.21
22
+ - @atlaspack/types@2.15.14
23
+ - @atlaspack/workers@2.14.24
24
+
3
25
  ## 2.22.0
4
26
 
5
27
  ### Minor Changes
@@ -59,6 +59,7 @@ function createEnvironment({
59
59
  case 'browser':
60
60
  case 'web-worker':
61
61
  case 'service-worker':
62
+ case 'tesseract':
62
63
  case 'electron-renderer':
63
64
  engines = {
64
65
  // @ts-expect-error TS2322
@@ -79,6 +80,7 @@ function createEnvironment({
79
80
  case 'browser':
80
81
  case 'web-worker':
81
82
  case 'service-worker':
83
+ case 'tesseract':
82
84
  default:
83
85
  includeNodeModules = true;
84
86
  break;
@@ -28,7 +28,7 @@ const PACKAGE_DESCRIPTOR_SCHEMA = exports.PACKAGE_DESCRIPTOR_SCHEMA = {
28
28
  properties: {
29
29
  context: {
30
30
  type: 'string',
31
- enum: ['node', 'browser', 'web-worker', 'electron-main', 'electron-renderer', 'service-worker']
31
+ enum: ['node', 'browser', 'web-worker', 'electron-main', 'electron-renderer', 'service-worker', 'tesseract']
32
32
  },
33
33
  includeNodeModules: {
34
34
  oneOf: [{
@@ -23,7 +23,7 @@ class Environment {
23
23
  this.unstableSingleFileOutput = false;
24
24
  }
25
25
  isBrowser() {
26
- return this.context === 'browser' || this.isWorker() || this.isWorklet() || this.context === 'electron-renderer';
26
+ return this.context === 'browser' || this.isWorker() || this.isTesseract() || this.isWorklet() || this.context === 'electron-renderer';
27
27
  }
28
28
  isNode() {
29
29
  return this.context === 'node' || this.isElectron();
@@ -37,8 +37,11 @@ class Environment {
37
37
  isWorklet() {
38
38
  return this.context === 'worklet';
39
39
  }
40
+ isTesseract() {
41
+ return this.context === 'tesseract';
42
+ }
40
43
  isIsolated() {
41
- return this.isWorker() || this.isWorklet();
44
+ return this.isWorker() || this.isTesseract() || this.isWorklet();
42
45
  }
43
46
 
44
47
  // TODO
@@ -29,11 +29,11 @@ function _semver() {
29
29
  var _utils = require("../utils");
30
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
31
  const inspect = Symbol.for('nodejs.util.inspect.custom');
32
- const BROWSER_ENVS = exports.BROWSER_ENVS = new Set(['browser', 'web-worker', 'service-worker', 'worklet', 'electron-renderer']);
32
+ const BROWSER_ENVS = exports.BROWSER_ENVS = new Set(['browser', 'web-worker', 'service-worker', 'worklet', 'tesseract', 'electron-renderer']);
33
33
  const ELECTRON_ENVS = new Set(['electron-main', 'electron-renderer']);
34
34
  const NODE_ENVS = new Set(['node', ...ELECTRON_ENVS]);
35
35
  const WORKER_ENVS = new Set(['web-worker', 'service-worker']);
36
- const ISOLATED_ENVS = exports.ISOLATED_ENVS = new Set([...WORKER_ENVS, 'worklet']);
36
+ const ISOLATED_ENVS = exports.ISOLATED_ENVS = new Set([...WORKER_ENVS, 'worklet', 'tesseract']);
37
37
  const ALL_BROWSERS = ['chrome', 'and_chr', 'edge', 'firefox', 'and_ff', 'safari', 'ios', 'samsung', 'opera', 'ie', 'op_mini', 'blackberry', 'op_mob', 'ie_mob', 'and_uc', 'and_qq', 'baidu', 'kaios'];
38
38
 
39
39
  // See require("caniuse-api").getSupport(<feature name>)
@@ -199,6 +199,9 @@ class Environment {
199
199
  isWorklet() {
200
200
  return this.#environment.context === 'worklet';
201
201
  }
202
+ isTesseract() {
203
+ return this.#environment.context === 'tesseract';
204
+ }
202
205
  matchesEngines(minVersions, defaultValue = false) {
203
206
  // Determine if the environment matches some minimum version requirements.
204
207
  // For browsers, we run a browserslist query with and without the minimum
@@ -19,6 +19,7 @@ export declare class Environment implements IEnvironment {
19
19
  isElectron(): boolean;
20
20
  isWorker(): boolean;
21
21
  isWorklet(): boolean;
22
+ isTesseract(): boolean;
22
23
  isIsolated(): boolean;
23
24
  matchesEngines(minVersions: VersionMap, defaultValue?: boolean): boolean;
24
25
  supports(feature: EnvironmentFeature, defaultValue?: boolean): boolean;
@@ -26,6 +26,7 @@ export default class Environment implements IEnvironment {
26
26
  isIsolated(): boolean;
27
27
  isWorker(): boolean;
28
28
  isWorklet(): boolean;
29
+ isTesseract(): boolean;
29
30
  matchesEngines(minVersions: VersionMap, defaultValue?: boolean): boolean;
30
31
  supports(feature: EnvironmentFeature, defaultValue?: boolean): boolean;
31
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/core",
3
- "version": "2.22.0",
3
+ "version": "2.23.0",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "main": "./lib/index.js",
13
13
  "source": "./src/index.ts",
14
- "types": "./lib/index.d.ts",
14
+ "types": "./lib/types/index.d.ts",
15
15
  "engines": {
16
16
  "node": ">= 16.0.0"
17
17
  },
@@ -19,25 +19,26 @@
19
19
  "test": "mocha",
20
20
  "test-ci": "mocha",
21
21
  "generate-ts": "tsc --emitDeclarationOnly",
22
- "check-ts": "tsc --emitDeclarationOnly --rootDir src"
22
+ "check-ts": "tsc --emitDeclarationOnly --rootDir src",
23
+ "build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
23
24
  },
24
25
  "dependencies": {
25
26
  "@mischnic/json-sourcemap": "^0.1.0",
26
27
  "@atlaspack/build-cache": "2.13.4",
27
- "@atlaspack/cache": "3.2.18",
28
+ "@atlaspack/cache": "3.2.19",
28
29
  "@atlaspack/diagnostic": "2.14.2",
29
30
  "@atlaspack/events": "2.14.2",
30
- "@atlaspack/feature-flags": "2.21.0",
31
- "@atlaspack/fs": "2.15.18",
32
- "@atlaspack/graph": "3.5.12",
33
- "@atlaspack/logger": "2.14.15",
34
- "@atlaspack/package-manager": "2.14.23",
35
- "@atlaspack/plugin": "2.14.23",
36
- "@atlaspack/profiler": "2.14.20",
37
- "@atlaspack/rust": "3.5.0",
38
- "@atlaspack/types": "2.15.13",
39
- "@atlaspack/utils": "2.18.0",
40
- "@atlaspack/workers": "2.14.23",
31
+ "@atlaspack/feature-flags": "2.22.0",
32
+ "@atlaspack/fs": "2.15.19",
33
+ "@atlaspack/graph": "3.5.13",
34
+ "@atlaspack/logger": "2.14.16",
35
+ "@atlaspack/package-manager": "2.14.24",
36
+ "@atlaspack/plugin": "2.14.24",
37
+ "@atlaspack/profiler": "2.14.21",
38
+ "@atlaspack/rust": "3.6.0",
39
+ "@atlaspack/types": "2.15.14",
40
+ "@atlaspack/utils": "2.18.1",
41
+ "@atlaspack/workers": "2.14.24",
41
42
  "@parcel/source-map": "^2.1.1",
42
43
  "base-x": "^3.0.8",
43
44
  "browserslist": "^4.6.6",
@@ -61,4 +62,4 @@
61
62
  "./src/serializerCore.js": "./src/serializerCore.browser.js"
62
63
  },
63
64
  "type": "commonjs"
64
- }
65
+ }
@@ -57,6 +57,7 @@ export function createEnvironment({
57
57
  case 'browser':
58
58
  case 'web-worker':
59
59
  case 'service-worker':
60
+ case 'tesseract':
60
61
  case 'electron-renderer':
61
62
  engines = {
62
63
  // @ts-expect-error TS2322
@@ -78,6 +79,7 @@ export function createEnvironment({
78
79
  case 'browser':
79
80
  case 'web-worker':
80
81
  case 'service-worker':
82
+ case 'tesseract':
81
83
  default:
82
84
  includeNodeModules = true;
83
85
  break;
@@ -35,6 +35,7 @@ export const PACKAGE_DESCRIPTOR_SCHEMA: SchemaObject = {
35
35
  'electron-main',
36
36
  'electron-renderer',
37
37
  'service-worker',
38
+ 'tesseract',
38
39
  ],
39
40
  },
40
41
  includeNodeModules: {
@@ -50,6 +50,7 @@ export class Environment implements IEnvironment {
50
50
  return (
51
51
  this.context === 'browser' ||
52
52
  this.isWorker() ||
53
+ this.isTesseract() ||
53
54
  this.isWorklet() ||
54
55
  this.context === 'electron-renderer'
55
56
  );
@@ -73,8 +74,12 @@ export class Environment implements IEnvironment {
73
74
  return this.context === 'worklet';
74
75
  }
75
76
 
77
+ isTesseract(): boolean {
78
+ return this.context === 'tesseract';
79
+ }
80
+
76
81
  isIsolated(): boolean {
77
- return this.isWorker() || this.isWorklet();
82
+ return this.isWorker() || this.isTesseract() || this.isWorklet();
78
83
  }
79
84
 
80
85
  // TODO
@@ -26,12 +26,17 @@ export const BROWSER_ENVS: Set<string> = new Set<string>([
26
26
  'web-worker',
27
27
  'service-worker',
28
28
  'worklet',
29
+ 'tesseract',
29
30
  'electron-renderer',
30
31
  ]);
31
32
  const ELECTRON_ENVS = new Set(['electron-main', 'electron-renderer']);
32
33
  const NODE_ENVS = new Set(['node', ...ELECTRON_ENVS]);
33
34
  const WORKER_ENVS = new Set(['web-worker', 'service-worker']);
34
- export const ISOLATED_ENVS: Set<string> = new Set([...WORKER_ENVS, 'worklet']);
35
+ export const ISOLATED_ENVS: Set<string> = new Set([
36
+ ...WORKER_ENVS,
37
+ 'worklet',
38
+ 'tesseract',
39
+ ]);
35
40
 
36
41
  const ALL_BROWSERS = [
37
42
  'chrome',
@@ -255,6 +260,10 @@ export default class Environment implements IEnvironment {
255
260
  return this.#environment.context === 'worklet';
256
261
  }
257
262
 
263
+ isTesseract(): boolean {
264
+ return this.#environment.context === 'tesseract';
265
+ }
266
+
258
267
  matchesEngines(
259
268
  minVersions: VersionMap,
260
269
  defaultValue: boolean = false,
@@ -110,6 +110,28 @@ describe('Environment', () => {
110
110
  },
111
111
  );
112
112
  });
113
+
114
+ it('assigns default engines for tesseract (same as web-worker)', () => {
115
+ assert.deepEqual(
116
+ fromEnvironmentId(createEnvironment({context: 'tesseract'})),
117
+ {
118
+ id: '9917be65326c5de9',
119
+ context: 'tesseract',
120
+ engines: {
121
+ browsers: ['> 0.25%'],
122
+ },
123
+ includeNodeModules: true,
124
+ outputFormat: 'global',
125
+ isLibrary: false,
126
+ shouldOptimize: false,
127
+ shouldScopeHoist: false,
128
+ sourceMap: undefined,
129
+ loc: undefined,
130
+ sourceType: 'module',
131
+ unstableSingleFileOutput: false,
132
+ },
133
+ );
134
+ });
113
135
  });
114
136
 
115
137
  describe('createEnvironment', function () {
@@ -25,4 +25,25 @@ describe('Public Environment', () => {
25
25
  assert(env.supports('import-meta-url'));
26
26
  assert(env.supports('arrow-functions'));
27
27
  });
28
+
29
+ it('correctly identifies tesseract context', () => {
30
+ let env = new PublicEnvironment(
31
+ fromEnvironmentId(
32
+ createEnvironment({
33
+ context: 'tesseract',
34
+ engines: {
35
+ browsers: ['last 1 Chrome version'],
36
+ },
37
+ }),
38
+ ),
39
+ DEFAULT_OPTIONS,
40
+ );
41
+
42
+ assert(env.isTesseract());
43
+ assert(env.isBrowser());
44
+ assert(env.isIsolated());
45
+ assert(!env.isNode());
46
+ assert(!env.isElectron());
47
+ assert(!env.isWorklet());
48
+ });
28
49
  });
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes