@atlaspack/packager-js 2.22.3-dev-export-func-opt-67f87c28a.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaspack/packager-js
2
2
 
3
+ ## 2.23.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#774](https://github.com/atlassian-labs/atlaspack/pull/774) [`602f8ed`](https://github.com/atlassian-labs/atlaspack/commit/602f8ed9d8381301df8b2cc82c1d5cf6f2f94fec) Thanks [@JakeLane](https://github.com/JakeLane)! - Add feature flag exportsRebindingOptimisation which detects cases where we don't need the rebinding helper for esm exports
8
+
9
+ ### Patch Changes
10
+
11
+ - [#780](https://github.com/atlassian-labs/atlaspack/pull/780) [`eedcbc4`](https://github.com/atlassian-labs/atlaspack/commit/eedcbc408fc1e86a2a8e25f1a41c57146d8529e1) Thanks [@JakeLane](https://github.com/JakeLane)! - Fix isStaticBindingSafe in v3
12
+
13
+ - Updated dependencies [[`7a52bab`](https://github.com/atlassian-labs/atlaspack/commit/7a52bab6281e8edbfa66af248eb6f872c6b4b7bd), [`eedcbc4`](https://github.com/atlassian-labs/atlaspack/commit/eedcbc408fc1e86a2a8e25f1a41c57146d8529e1), [`5a0363f`](https://github.com/atlassian-labs/atlaspack/commit/5a0363f1086e81068959b87e92064bed5a11a9b4), [`038e87a`](https://github.com/atlassian-labs/atlaspack/commit/038e87a7858d39556d59d3a2d17db534d45f62c6), [`f6532d7`](https://github.com/atlassian-labs/atlaspack/commit/f6532d7a4f7f007bd4e5e36af04dd466f0b9f572), [`0684997`](https://github.com/atlassian-labs/atlaspack/commit/0684997c127a6204af1376b36e556fddd1ba5557), [`602f8ed`](https://github.com/atlassian-labs/atlaspack/commit/602f8ed9d8381301df8b2cc82c1d5cf6f2f94fec)]:
14
+ - @atlaspack/feature-flags@2.25.0
15
+ - @atlaspack/rust@3.8.0
16
+ - @atlaspack/utils@2.19.2
17
+ - @atlaspack/plugin@2.14.30
18
+ - @atlaspack/types@2.15.20
19
+
3
20
  ## 2.22.2
4
21
 
5
22
  ### Patch Changes
@@ -220,14 +220,9 @@ class ScopeHoistingPackager {
220
220
  if (this.wrappedAssets.has(entry.id) && !this.isScriptEntry(entry)) {
221
221
  var _entry$symbols$get;
222
222
  let parcelRequire = `parcelRequire(${JSON.stringify(this.bundleGraph.getAssetPublicId(entry))});\n`;
223
-
224
- // @ts-expect-error TS2345
225
223
  let entryExports = (_entry$symbols$get = entry.symbols.get('*')) === null || _entry$symbols$get === void 0 ? void 0 : _entry$symbols$get.local;
226
- if (entryExports && entry === mainEntry &&
227
- // @ts-expect-error TS2345
228
- this.exportedSymbols.has(entryExports)) {
224
+ if (entryExports && entry === mainEntry && this.exportedSymbols.has(entryExports)) {
229
225
  (0, _assert().default)(!needsBundleQueue, 'Entry exports are not yet compaitble with async bundles');
230
- // @ts-expect-error TS2731
231
226
  res += `\nvar ${entryExports} = ${parcelRequire}`;
232
227
  } else {
233
228
  if (needsBundleQueue) {
@@ -415,7 +410,6 @@ class ScopeHoistingPackager {
415
410
  // TODO: handle ESM exports of wrapped entry assets...
416
411
  let entry = this.bundle.getMainEntry();
417
412
  if (entry && !this.wrappedAssets.has(entry.id)) {
418
- // @ts-expect-error TS2345
419
413
  let hasNamespace = entry.symbols.hasExportSymbol('*');
420
414
  for (let {
421
415
  asset,
@@ -431,14 +425,11 @@ class ScopeHoistingPackager {
431
425
  if (hasNamespace && this.isAsyncBundle && exportAs !== '*') {
432
426
  continue;
433
427
  }
434
- let symbols = (_this$exportedSymbols = this.exportedSymbols.get(
435
- // @ts-expect-error TS2345
436
- symbol === '*' ? (0, _nullthrows().default)((_entry$symbols$get2 = entry.symbols.get('*')) === null || _entry$symbols$get2 === void 0 ? void 0 : _entry$symbols$get2.local) : symbol)) === null || _this$exportedSymbols === void 0 ? void 0 : _this$exportedSymbols.exportAs;
428
+ let symbols = (_this$exportedSymbols = this.exportedSymbols.get(symbol === '*' ? (0, _nullthrows().default)((_entry$symbols$get2 = entry.symbols.get('*')) === null || _entry$symbols$get2 === void 0 ? void 0 : _entry$symbols$get2.local) : symbol)) === null || _this$exportedSymbols === void 0 ? void 0 : _this$exportedSymbols.exportAs;
437
429
  if (!symbols) {
438
430
  symbols = [];
439
431
  this.exportedSymbols.set(symbol, {
440
432
  asset,
441
- // @ts-expect-error TS2322
442
433
  exportSymbol,
443
434
  local: symbol,
444
435
  exportAs: symbols
@@ -447,8 +438,6 @@ class ScopeHoistingPackager {
447
438
  if (exportAs === '*') {
448
439
  exportAs = 'default';
449
440
  }
450
-
451
- // @ts-expect-error TS2345
452
441
  symbols.push(exportAs);
453
442
  } else if (symbol === null) {
454
443
  // TODO `meta.exportsIdentifier[exportSymbol]` should be exported
@@ -736,12 +725,9 @@ ${code}
736
725
  for (let [imported, {
737
726
  local
738
727
  }] of dep.symbols) {
739
- // @ts-expect-error TS2367
740
728
  if (local === '*') {
741
729
  continue;
742
730
  }
743
-
744
- // @ts-expect-error TS2345
745
731
  let symbol = this.getSymbolResolution(asset, resolved, imported, dep);
746
732
  replacements.set(local,
747
733
  // If this was an internalized async asset, wrap in a Promise.resolve.
@@ -763,7 +749,6 @@ ${code}
763
749
  // which will be provided to us by the wrapper.
764
750
  if (this.wrappedAssets.has(asset.id) || this.bundle.env.outputFormat === 'commonjs' && asset === this.bundle.getMainEntry()) {
765
751
  var _asset$symbols$get;
766
- // @ts-expect-error TS2345
767
752
  let exportsName = ((_asset$symbols$get = asset.symbols.get('*')) === null || _asset$symbols$get === void 0 ? void 0 : _asset$symbols$get.local) || `$${assetId}$exports`;
768
753
  replacements.set(exportsName, 'module.exports');
769
754
  }
@@ -796,11 +781,9 @@ ${code}
796
781
  local
797
782
  }] of dep.symbols) {
798
783
  // If already imported, just add the already renamed variable to the mapping.
799
- // @ts-expect-error TS2345
784
+
800
785
  let renamed = external.get(imported);
801
- // @ts-expect-error TS2367
802
786
  if (renamed && local !== '*' && replacements) {
803
- // @ts-expect-error TS2345
804
787
  replacements.set(local, renamed);
805
788
  continue;
806
789
  }
@@ -813,25 +796,16 @@ ${code}
813
796
  if (referencedBundle) {
814
797
  var _entry$symbols$get3;
815
798
  let entry = (0, _nullthrows().default)(referencedBundle.getMainEntry());
816
- // @ts-expect-error TS2322
817
- renamed =
818
- // @ts-expect-error TS2345
819
- ((_entry$symbols$get3 = entry.symbols.get('*')) === null || _entry$symbols$get3 === void 0 ? void 0 : _entry$symbols$get3.local) ?? `$${String(entry.meta.id)}$exports`;
799
+ renamed = ((_entry$symbols$get3 = entry.symbols.get('*')) === null || _entry$symbols$get3 === void 0 ? void 0 : _entry$symbols$get3.local) ?? `$${String(entry.meta.id)}$exports`;
820
800
  } else {
821
801
  renamed = this.getTopLevelName(`$${this.bundle.publicId}$${specifier}`);
822
802
  }
823
-
824
- // @ts-expect-error TS2345
825
803
  external.set('*', renamed);
826
804
  }
827
-
828
- // @ts-expect-error TS2367
829
805
  if (local !== '*' && replacements) {
830
806
  let replacement;
831
- // @ts-expect-error TS2367
832
807
  if (imported === '*') {
833
808
  replacement = renamed;
834
- // @ts-expect-error TS2367
835
809
  } else if (imported === 'default') {
836
810
  let needsDefaultInterop = true;
837
811
  if (referencedBundle) {
@@ -845,40 +819,33 @@ ${code}
845
819
  replacement = `${renamed}.default`;
846
820
  }
847
821
  } else {
848
- // @ts-expect-error TS2345
849
822
  replacement = this.getPropertyAccess(renamed, imported);
850
823
  }
851
-
852
- // @ts-expect-error TS2345
853
824
  replacements.set(local, replacement);
854
825
  }
855
826
  } else {
856
827
  let property;
857
828
  if (referencedBundle) {
858
829
  let entry = (0, _nullthrows().default)(referencedBundle.getMainEntry());
859
- // @ts-expect-error TS2345
860
830
  if (entry.symbols.hasExportSymbol('*')) {
861
831
  // If importing * and the referenced module has a * export (e.g. CJS), use default instead.
862
832
  // This mirrors the logic in buildExportedSymbols.
863
833
  property = imported;
864
- // @ts-expect-error TS2322
865
834
  imported = (referencedBundle === null || referencedBundle === void 0 ? void 0 : referencedBundle.env.outputFormat) === 'esmodule' ? 'default' : '*';
866
835
  } else {
867
- // @ts-expect-error TS2367
868
836
  if (imported === '*') {
869
837
  let exportedSymbols = this.bundleGraph.getExportedSymbols(entry);
870
- // @ts-expect-error TS2367
871
838
  if (local === '*') {
872
839
  // Re-export all symbols.
873
840
  for (let exported of exportedSymbols) {
874
841
  if (exported.symbol) {
875
- // @ts-expect-error TS2345
876
842
  external.set(exported.exportSymbol, exported.symbol);
877
843
  }
878
844
  }
879
845
  continue;
880
846
  }
881
847
  }
848
+
882
849
  // @ts-expect-error TS2322
883
850
  renamed = this.bundleGraph.getSymbolResolution(entry, imported, this.bundle).symbol;
884
851
  }
@@ -888,37 +855,25 @@ ${code}
888
855
  // are deduplicated. We have to prefix the imported name with the bundle id so that
889
856
  // local variables do not shadow it.
890
857
  if (!renamed) {
891
- // @ts-expect-error TS2345
892
858
  if (this.exportedSymbols.has(local)) {
893
- // @ts-expect-error TS2322
894
859
  renamed = local;
895
- // @ts-expect-error TS2367
896
860
  } else if (imported === 'default' || imported === '*') {
897
861
  renamed = this.getTopLevelName(`$${this.bundle.publicId}$${specifier}`);
898
862
  } else {
899
- renamed = this.getTopLevelName(
900
- // @ts-expect-error TS2731
901
- `$${this.bundle.publicId}$${imported}`);
863
+ renamed = this.getTopLevelName(`$${this.bundle.publicId}$${imported}`);
902
864
  }
903
865
  }
904
-
905
- // @ts-expect-error TS2345
906
866
  external.set(imported, renamed);
907
- // @ts-expect-error TS2367
908
867
  if (local !== '*' && replacements) {
909
868
  let replacement = renamed;
910
- // @ts-expect-error TS2367
911
869
  if (property === '*') {
912
870
  replacement = renamed;
913
- // @ts-expect-error TS2367
914
871
  } else if (property === 'default') {
915
872
  replacement = `($parcel$interopDefault(${renamed}))`;
916
873
  this.usedHelpers.add('$parcel$interopDefault');
917
874
  } else if (property) {
918
- // @ts-expect-error TS2345
919
875
  replacement = this.getPropertyAccess(renamed, property);
920
876
  }
921
- // @ts-expect-error TS2345
922
877
  replacements.set(local, replacement);
923
878
  }
924
879
  }
@@ -940,7 +895,6 @@ ${code}
940
895
  asset: resolvedAsset,
941
896
  exportSymbol,
942
897
  symbol
943
- // @ts-expect-error TS2345
944
898
  } = this.bundleGraph.getSymbolResolution(resolved, imported, this.bundle);
945
899
  if (resolvedAsset.type !== 'js' || dep && this.bundleGraph.isDependencySkipped(dep)) {
946
900
  // Graceful fallback for non-js imports or when trying to resolve a symbol
@@ -974,13 +928,7 @@ ${code}
974
928
 
975
929
  // If this is an ESM default import of a CJS module with a `default` symbol,
976
930
  // and no __esModule flag, we need to resolve to the namespace instead.
977
- let isDefaultInterop = exportSymbol === 'default' && staticExports && !isWrapped && ((dep === null || dep === void 0 ? void 0 : dep.meta.kind) === 'Import' || (dep === null || dep === void 0 ? void 0 : dep.meta.kind) === 'Export') &&
978
- // @ts-expect-error TS2345
979
- resolvedAsset.symbols.hasExportSymbol('*') &&
980
- // @ts-expect-error TS2345
981
- resolvedAsset.symbols.hasExportSymbol('default') &&
982
- // @ts-expect-error TS2345
983
- !resolvedAsset.symbols.hasExportSymbol('__esModule');
931
+ let isDefaultInterop = exportSymbol === 'default' && staticExports && !isWrapped && ((dep === null || dep === void 0 ? void 0 : dep.meta.kind) === 'Import' || (dep === null || dep === void 0 ? void 0 : dep.meta.kind) === 'Export') && resolvedAsset.symbols.hasExportSymbol('*') && resolvedAsset.symbols.hasExportSymbol('default') && !resolvedAsset.symbols.hasExportSymbol('__esModule');
984
932
 
985
933
  // Find the namespace object for the resolved module. If wrapped and this
986
934
  // is an inline require (not top-level), use a parcelRequire call, otherwise
@@ -996,9 +944,7 @@ ${code}
996
944
  obj = `$${publicId}`;
997
945
  } else {
998
946
  var _resolvedAsset$symbol;
999
- // @ts-expect-error TS2345
1000
947
  obj = ((_resolvedAsset$symbol = resolvedAsset.symbols.get('*')) === null || _resolvedAsset$symbol === void 0 ? void 0 : _resolvedAsset$symbol.local) || `$${assetId}$exports`;
1001
- // @ts-expect-error TS2345
1002
948
  obj = (replacements === null || replacements === void 0 ? void 0 : replacements.get(obj)) || obj;
1003
949
  }
1004
950
  if (imported === '*' || exportSymbol === '*' || isDefaultInterop) {
@@ -1007,7 +953,6 @@ ${code}
1007
953
  // Directly use module.exports for wrapped assets importing themselves.
1008
954
  return 'module.exports';
1009
955
  } else {
1010
- // @ts-expect-error TS2322
1011
956
  return obj;
1012
957
  }
1013
958
  } else if ((!staticExports || isWrapped || !symbol || isExternalCommonJS) && resolvedAsset !== parentAsset) {
@@ -1016,20 +961,15 @@ ${code}
1016
961
  // than a direct reference. If importing default from a CJS module,
1017
962
  // use a helper to check the __esModule flag at runtime.
1018
963
  let kind = dep === null || dep === void 0 ? void 0 : dep.meta.kind;
1019
- if ((!dep || kind === 'Import' || kind === 'Export') && exportSymbol === 'default' &&
1020
- // @ts-expect-error TS2345
1021
- resolvedAsset.symbols.hasExportSymbol('*') && this.needsDefaultInterop(resolvedAsset)) {
964
+ if ((!dep || kind === 'Import' || kind === 'Export') && exportSymbol === 'default' && resolvedAsset.symbols.hasExportSymbol('*') && this.needsDefaultInterop(resolvedAsset)) {
1022
965
  this.usedHelpers.add('$parcel$interopDefault');
1023
- // @ts-expect-error TS2731
1024
966
  return `(/*@__PURE__*/$parcel$interopDefault(${obj}))`;
1025
967
  } else {
1026
- // @ts-expect-error TS2345
1027
968
  return this.getPropertyAccess(obj, exportSymbol);
1028
969
  }
1029
970
  } else if (!symbol) {
1030
971
  (0, _assert().default)(false, 'Asset was skipped or not found.');
1031
972
  } else {
1032
- // @ts-expect-error TS2322
1033
973
  return (replacements === null || replacements === void 0 ? void 0 : replacements.get(symbol)) || symbol;
1034
974
  }
1035
975
  }
@@ -1078,32 +1018,22 @@ ${code}
1078
1018
  // If the asset has a namespace export symbol, it is CommonJS.
1079
1019
  // If there's no __esModule flag, and default is a used symbol, we need
1080
1020
  // to insert an interop helper.
1081
- let defaultInterop =
1082
- // @ts-expect-error TS2345
1083
- asset.symbols.hasExportSymbol('*') &&
1084
- // @ts-expect-error TS2345
1085
- usedSymbols.has('default') &&
1086
- // @ts-expect-error TS2345
1087
- !asset.symbols.hasExportSymbol('__esModule');
1021
+ let defaultInterop = asset.symbols.hasExportSymbol('*') && usedSymbols.has('default') && !asset.symbols.hasExportSymbol('__esModule');
1088
1022
  let usedNamespace;
1089
1023
  if ((0, _featureFlags().getFeatureFlag)('inlineConstOptimisationFix') && asset.meta.isConstantModule) {
1090
1024
  // Only set usedNamespace if there is an incoming dependency in the current bundle that uses '*'
1091
- usedNamespace = this.bundleGraph.getIncomingDependencies(asset).some(dep => this.bundle.hasDependency(dep) &&
1092
- // @ts-expect-error TS2345
1093
- (0, _nullthrows().default)(this.bundleGraph.getUsedSymbols(dep)).has('*'));
1025
+ usedNamespace = this.bundleGraph.getIncomingDependencies(asset).some(dep => this.bundle.hasDependency(dep) && (0, _nullthrows().default)(this.bundleGraph.getUsedSymbols(dep)).has('*'));
1094
1026
  } else {
1095
1027
  usedNamespace =
1096
1028
  // If the asset has * in its used symbols, we might need the exports namespace.
1097
1029
  // The one case where this isn't true is in ESM library entries, where the only
1098
1030
  // dependency on * is the entry dependency. In this case, we will use ESM exports
1099
1031
  // instead of the namespace object.
1100
- // @ts-expect-error TS2345
1101
- usedSymbols.has('*') && (this.bundle.env.outputFormat !== 'esmodule' || !this.bundle.env.isLibrary || asset !== this.bundle.getMainEntry() || this.bundleGraph.getIncomingDependencies(asset).some(dep => !dep.isEntry && this.bundle.hasDependency(dep) &&
1102
- // @ts-expect-error TS2345
1103
- (0, _nullthrows().default)(this.bundleGraph.getUsedSymbols(dep)).has('*'))) ||
1032
+
1033
+ usedSymbols.has('*') && (this.bundle.env.outputFormat !== 'esmodule' || !this.bundle.env.isLibrary || asset !== this.bundle.getMainEntry() || this.bundleGraph.getIncomingDependencies(asset).some(dep => !dep.isEntry && this.bundle.hasDependency(dep) && (0, _nullthrows().default)(this.bundleGraph.getUsedSymbols(dep)).has('*'))) ||
1104
1034
  // If a symbol is imported (used) from a CJS asset but isn't listed in the symbols,
1105
1035
  // we fallback on the namespace object.
1106
- // @ts-expect-error TS2345
1036
+
1107
1037
  asset.symbols.hasExportSymbol('*') && [...usedSymbols].some(s => !asset.symbols.hasExportSymbol(s)) ||
1108
1038
  // If the exports has this asset's namespace (e.g. ESM output from CJS input),
1109
1039
  // include the namespace object for the default export.
@@ -1128,7 +1058,7 @@ ${code}
1128
1058
  // Insert the __esModule interop flag for this module if it has a `default` export
1129
1059
  // and the namespace symbol is used.
1130
1060
  // TODO: only if required by CJS?
1131
- // @ts-expect-error TS2345
1061
+
1132
1062
  if (asset.symbols.hasExportSymbol('default') && usedSymbols.has('*')) {
1133
1063
  prepend += `\n$parcel$defineInteropFlag($${assetId}$exports);\n`;
1134
1064
  prependLineCount += 2;
@@ -1147,7 +1077,6 @@ ${code}
1147
1077
  for (let [imported, {
1148
1078
  local
1149
1079
  }] of dep.symbols) {
1150
- // @ts-expect-error TS2367
1151
1080
  if (imported === '*' && local === '*') {
1152
1081
  if (!resolved) {
1153
1082
  // Re-exporting an external module. This should have already been handled in buildReplacements.
@@ -1160,29 +1089,20 @@ ${code}
1160
1089
  // If the resolved asset has an exports object, use the $parcel$exportWildcard helper
1161
1090
  // to re-export all symbols. Otherwise, if there's no namespace object available, add
1162
1091
  // $parcel$export calls for each used symbol of the dependency.
1163
- if (isWrapped || resolved.meta.staticExports === false ||
1164
- // @ts-expect-error TS2345
1165
- (0, _nullthrows().default)(this.bundleGraph.getUsedSymbols(resolved)).has('*') ||
1092
+ if (isWrapped || resolved.meta.staticExports === false || (0, _nullthrows().default)(this.bundleGraph.getUsedSymbols(resolved)).has('*') ||
1166
1093
  // an empty asset
1167
- !resolved.meta.hasCJSExports &&
1168
- // @ts-expect-error TS2345
1169
- resolved.symbols.hasExportSymbol('*')) {
1094
+ !resolved.meta.hasCJSExports && resolved.symbols.hasExportSymbol('*')) {
1170
1095
  let obj = this.getSymbolResolution(asset, resolved, '*', dep, replacements);
1171
1096
  append += `$parcel$exportWildcard($${assetId}$exports, ${obj});\n`;
1172
1097
  this.usedHelpers.add('$parcel$exportWildcard');
1173
1098
  } else {
1174
1099
  for (let symbol of (0, _nullthrows().default)(this.bundleGraph.getUsedSymbols(dep))) {
1175
- if (
1176
- // @ts-expect-error TS2367
1177
- symbol === 'default' ||
1100
+ if (symbol === 'default' ||
1178
1101
  // `export * as ...` does not include the default export
1179
- // @ts-expect-error TS2367
1180
1102
  symbol === '__esModule') {
1181
1103
  continue;
1182
1104
  }
1183
- let resolvedSymbol = this.getSymbolResolution(asset, resolved,
1184
- // @ts-expect-error TS2345
1185
- symbol, undefined, replacements);
1105
+ let resolvedSymbol = this.getSymbolResolution(asset, resolved, symbol, undefined, replacements);
1186
1106
  let get = this.buildFunctionExpression([], resolvedSymbol);
1187
1107
  let set = asset.meta.hasCJSExports ? ', ' + this.buildFunctionExpression(['v'], `${resolvedSymbol} = v`) : '';
1188
1108
  prepend += `$parcel$export($${assetId}$exports, ${JSON.stringify(symbol)}, ${get}${set});\n`;
@@ -1199,7 +1119,6 @@ ${code}
1199
1119
  // re-exported symbols rather than only symbols declared in this asset.
1200
1120
  let incomingDeps = this.bundleGraph.getIncomingDependencies(asset);
1201
1121
  let usedExports = [...asset.symbols.exportSymbols()].filter(symbol => {
1202
- // @ts-expect-error TS2367
1203
1122
  if (symbol === '*') {
1204
1123
  return false;
1205
1124
  }
@@ -1214,8 +1133,6 @@ ${code}
1214
1133
 
1215
1134
  // No used symbols available for the asset, make sure we keep all of them
1216
1135
  if (!symbols) return false;
1217
-
1218
- // @ts-expect-error TS2345
1219
1136
  return !symbols.has(symbol) && !symbols.has('*');
1220
1137
  });
1221
1138
  return !unused;
@@ -1227,9 +1144,7 @@ ${code}
1227
1144
  // additional assignments after each mutation of the original binding.
1228
1145
  for (let exp of usedExports) {
1229
1146
  var _asset$symbols$get2;
1230
- let resolved = this.getSymbolResolution(asset, asset,
1231
- // @ts-expect-error TS2345
1232
- exp, undefined, replacements);
1147
+ let resolved = this.getSymbolResolution(asset, asset, exp, undefined, replacements);
1233
1148
  const meta = (_asset$symbols$get2 = asset.symbols.get(exp)) === null || _asset$symbols$get2 === void 0 ? void 0 : _asset$symbols$get2.meta;
1234
1149
  if ((0, _featureFlags().getFeatureFlag)('exportsRebindingOptimisation') && meta !== null && meta !== void 0 && meta.isStaticBindingSafe) {
1235
1150
  append += `$${assetId}$exports[${JSON.stringify(exp)}] = ${resolved};\n`;
@@ -1332,11 +1247,7 @@ ${code}
1332
1247
  return [res, lines];
1333
1248
  }
1334
1249
  needsDefaultInterop(asset) {
1335
- if (
1336
- // @ts-expect-error TS2345
1337
- asset.symbols.hasExportSymbol('*') &&
1338
- // @ts-expect-error TS2345
1339
- !asset.symbols.hasExportSymbol('default')) {
1250
+ if (asset.symbols.hasExportSymbol('*') && !asset.symbols.hasExportSymbol('default')) {
1340
1251
  return true;
1341
1252
  }
1342
1253
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/packager-js",
3
- "version": "2.22.3-dev-export-func-opt-67f87c28a.0",
3
+ "version": "2.23.0",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -16,13 +16,13 @@
16
16
  "node": ">= 16.0.0"
17
17
  },
18
18
  "dependencies": {
19
- "@atlaspack/diagnostic": "2.14.4-dev-export-func-opt-67f87c28a.0",
20
- "@atlaspack/feature-flags": "2.24.2-dev-export-func-opt-67f87c28a.0",
21
- "@atlaspack/plugin": "2.14.30-dev-export-func-opt-67f87c28a.0",
22
- "@atlaspack/rust": "3.7.1-dev-export-func-opt-67f87c28a.0",
23
- "@atlaspack/types": "2.15.20-dev-export-func-opt-67f87c28a.0",
24
- "@atlaspack/utils": "2.19.2-dev-export-func-opt-67f87c28a.0",
19
+ "@atlaspack/diagnostic": "2.14.3",
20
+ "@atlaspack/feature-flags": "2.25.0",
21
+ "@atlaspack/plugin": "2.14.30",
22
+ "@atlaspack/rust": "3.8.0",
25
23
  "@parcel/source-map": "^2.1.1",
24
+ "@atlaspack/types": "2.15.20",
25
+ "@atlaspack/utils": "2.19.2",
26
26
  "globals": "^13.2.0",
27
27
  "nullthrows": "^1.1.1",
28
28
  "outdent": "^0.8.0"
@@ -31,6 +31,5 @@
31
31
  "scripts": {
32
32
  "check-ts": "tsc --emitDeclarationOnly --rootDir src",
33
33
  "build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
34
- },
35
- "gitHead": "67f87c28a23fcf285d88a1c969de4e35956cb500"
34
+ }
36
35
  }
@@ -260,20 +260,17 @@ export class ScopeHoistingPackager {
260
260
  this.bundleGraph.getAssetPublicId(entry),
261
261
  )});\n`;
262
262
 
263
- // @ts-expect-error TS2345
264
263
  let entryExports = entry.symbols.get('*')?.local;
265
264
 
266
265
  if (
267
266
  entryExports &&
268
267
  entry === mainEntry &&
269
- // @ts-expect-error TS2345
270
268
  this.exportedSymbols.has(entryExports)
271
269
  ) {
272
270
  invariant(
273
271
  !needsBundleQueue,
274
272
  'Entry exports are not yet compaitble with async bundles',
275
273
  );
276
- // @ts-expect-error TS2731
277
274
  res += `\nvar ${entryExports} = ${parcelRequire}`;
278
275
  } else {
279
276
  if (needsBundleQueue) {
@@ -559,7 +556,6 @@ export class ScopeHoistingPackager {
559
556
  // TODO: handle ESM exports of wrapped entry assets...
560
557
  let entry = this.bundle.getMainEntry();
561
558
  if (entry && !this.wrappedAssets.has(entry.id)) {
562
- // @ts-expect-error TS2345
563
559
  let hasNamespace = entry.symbols.hasExportSymbol('*');
564
560
 
565
561
  for (let {
@@ -577,7 +573,6 @@ export class ScopeHoistingPackager {
577
573
  }
578
574
 
579
575
  let symbols = this.exportedSymbols.get(
580
- // @ts-expect-error TS2345
581
576
  symbol === '*' ? nullthrows(entry.symbols.get('*')?.local) : symbol,
582
577
  )?.exportAs;
583
578
 
@@ -585,7 +580,7 @@ export class ScopeHoistingPackager {
585
580
  symbols = [];
586
581
  this.exportedSymbols.set(symbol, {
587
582
  asset,
588
- // @ts-expect-error TS2322
583
+
589
584
  exportSymbol,
590
585
  local: symbol,
591
586
  exportAs: symbols,
@@ -596,7 +591,6 @@ export class ScopeHoistingPackager {
596
591
  exportAs = 'default';
597
592
  }
598
593
 
599
- // @ts-expect-error TS2345
600
594
  symbols.push(exportAs);
601
595
  } else if (symbol === null) {
602
596
  // TODO `meta.exportsIdentifier[exportSymbol]` should be exported
@@ -990,12 +984,10 @@ ${code}
990
984
  }
991
985
 
992
986
  for (let [imported, {local}] of dep.symbols) {
993
- // @ts-expect-error TS2367
994
987
  if (local === '*') {
995
988
  continue;
996
989
  }
997
990
 
998
- // @ts-expect-error TS2345
999
991
  let symbol = this.getSymbolResolution(asset, resolved, imported, dep);
1000
992
  replacements.set(
1001
993
  local,
@@ -1032,7 +1024,6 @@ ${code}
1032
1024
  (this.bundle.env.outputFormat === 'commonjs' &&
1033
1025
  asset === this.bundle.getMainEntry())
1034
1026
  ) {
1035
- // @ts-expect-error TS2345
1036
1027
  let exportsName = asset.symbols.get('*')?.local || `$${assetId}$exports`;
1037
1028
  replacements.set(exportsName, 'module.exports');
1038
1029
  }
@@ -1076,11 +1067,10 @@ ${code}
1076
1067
 
1077
1068
  for (let [imported, {local}] of dep.symbols) {
1078
1069
  // If already imported, just add the already renamed variable to the mapping.
1079
- // @ts-expect-error TS2345
1070
+
1080
1071
  let renamed = external.get(imported);
1081
- // @ts-expect-error TS2367
1072
+
1082
1073
  if (renamed && local !== '*' && replacements) {
1083
- // @ts-expect-error TS2345
1084
1074
  replacements.set(local, renamed);
1085
1075
  continue;
1086
1076
  }
@@ -1092,9 +1082,8 @@ ${code}
1092
1082
  if (!renamed) {
1093
1083
  if (referencedBundle) {
1094
1084
  let entry = nullthrows(referencedBundle.getMainEntry());
1095
- // @ts-expect-error TS2322
1085
+
1096
1086
  renamed =
1097
- // @ts-expect-error TS2345
1098
1087
  entry.symbols.get('*')?.local ??
1099
1088
  `$${String(entry.meta.id)}$exports`;
1100
1089
  } else {
@@ -1103,17 +1092,14 @@ ${code}
1103
1092
  );
1104
1093
  }
1105
1094
 
1106
- // @ts-expect-error TS2345
1107
1095
  external.set('*', renamed);
1108
1096
  }
1109
1097
 
1110
- // @ts-expect-error TS2367
1111
1098
  if (local !== '*' && replacements) {
1112
1099
  let replacement;
1113
- // @ts-expect-error TS2367
1100
+
1114
1101
  if (imported === '*') {
1115
1102
  replacement = renamed;
1116
- // @ts-expect-error TS2367
1117
1103
  } else if (imported === 'default') {
1118
1104
  let needsDefaultInterop = true;
1119
1105
  if (referencedBundle) {
@@ -1127,43 +1113,40 @@ ${code}
1127
1113
  replacement = `${renamed}.default`;
1128
1114
  }
1129
1115
  } else {
1130
- // @ts-expect-error TS2345
1131
1116
  replacement = this.getPropertyAccess(renamed, imported);
1132
1117
  }
1133
1118
 
1134
- // @ts-expect-error TS2345
1135
1119
  replacements.set(local, replacement);
1136
1120
  }
1137
1121
  } else {
1138
1122
  let property;
1139
1123
  if (referencedBundle) {
1140
1124
  let entry = nullthrows(referencedBundle.getMainEntry());
1141
- // @ts-expect-error TS2345
1125
+
1142
1126
  if (entry.symbols.hasExportSymbol('*')) {
1143
1127
  // If importing * and the referenced module has a * export (e.g. CJS), use default instead.
1144
1128
  // This mirrors the logic in buildExportedSymbols.
1145
1129
  property = imported;
1146
- // @ts-expect-error TS2322
1130
+
1147
1131
  imported =
1148
1132
  referencedBundle?.env.outputFormat === 'esmodule'
1149
1133
  ? 'default'
1150
1134
  : '*';
1151
1135
  } else {
1152
- // @ts-expect-error TS2367
1153
1136
  if (imported === '*') {
1154
1137
  let exportedSymbols = this.bundleGraph.getExportedSymbols(entry);
1155
- // @ts-expect-error TS2367
1138
+
1156
1139
  if (local === '*') {
1157
1140
  // Re-export all symbols.
1158
1141
  for (let exported of exportedSymbols) {
1159
1142
  if (exported.symbol) {
1160
- // @ts-expect-error TS2345
1161
1143
  external.set(exported.exportSymbol, exported.symbol);
1162
1144
  }
1163
1145
  }
1164
1146
  continue;
1165
1147
  }
1166
1148
  }
1149
+
1167
1150
  // @ts-expect-error TS2322
1168
1151
  renamed = this.bundleGraph.getSymbolResolution(
1169
1152
  entry,
@@ -1177,40 +1160,33 @@ ${code}
1177
1160
  // are deduplicated. We have to prefix the imported name with the bundle id so that
1178
1161
  // local variables do not shadow it.
1179
1162
  if (!renamed) {
1180
- // @ts-expect-error TS2345
1181
1163
  if (this.exportedSymbols.has(local)) {
1182
- // @ts-expect-error TS2322
1183
1164
  renamed = local;
1184
- // @ts-expect-error TS2367
1185
1165
  } else if (imported === 'default' || imported === '*') {
1186
1166
  renamed = this.getTopLevelName(
1187
1167
  `$${this.bundle.publicId}$${specifier}`,
1188
1168
  );
1189
1169
  } else {
1190
1170
  renamed = this.getTopLevelName(
1191
- // @ts-expect-error TS2731
1192
1171
  `$${this.bundle.publicId}$${imported}`,
1193
1172
  );
1194
1173
  }
1195
1174
  }
1196
1175
 
1197
- // @ts-expect-error TS2345
1198
1176
  external.set(imported, renamed);
1199
- // @ts-expect-error TS2367
1177
+
1200
1178
  if (local !== '*' && replacements) {
1201
1179
  let replacement = renamed;
1202
- // @ts-expect-error TS2367
1180
+
1203
1181
  if (property === '*') {
1204
1182
  replacement = renamed;
1205
- // @ts-expect-error TS2367
1206
1183
  } else if (property === 'default') {
1207
1184
  replacement = `($parcel$interopDefault(${renamed}))`;
1208
1185
  this.usedHelpers.add('$parcel$interopDefault');
1209
1186
  } else if (property) {
1210
- // @ts-expect-error TS2345
1211
1187
  replacement = this.getPropertyAccess(renamed, property);
1212
1188
  }
1213
- // @ts-expect-error TS2345
1189
+
1214
1190
  replacements.set(local, replacement);
1215
1191
  }
1216
1192
  }
@@ -1249,7 +1225,6 @@ ${code}
1249
1225
  asset: resolvedAsset,
1250
1226
  exportSymbol,
1251
1227
  symbol,
1252
- // @ts-expect-error TS2345
1253
1228
  } = this.bundleGraph.getSymbolResolution(resolved, imported, this.bundle);
1254
1229
 
1255
1230
  if (
@@ -1308,11 +1283,8 @@ ${code}
1308
1283
  staticExports &&
1309
1284
  !isWrapped &&
1310
1285
  (dep?.meta.kind === 'Import' || dep?.meta.kind === 'Export') &&
1311
- // @ts-expect-error TS2345
1312
1286
  resolvedAsset.symbols.hasExportSymbol('*') &&
1313
- // @ts-expect-error TS2345
1314
1287
  resolvedAsset.symbols.hasExportSymbol('default') &&
1315
- // @ts-expect-error TS2345
1316
1288
  !resolvedAsset.symbols.hasExportSymbol('__esModule');
1317
1289
 
1318
1290
  // Find the namespace object for the resolved module. If wrapped and this
@@ -1328,9 +1300,8 @@ ${code}
1328
1300
  } else if (isWrapped && dep) {
1329
1301
  obj = `$${publicId}`;
1330
1302
  } else {
1331
- // @ts-expect-error TS2345
1332
1303
  obj = resolvedAsset.symbols.get('*')?.local || `$${assetId}$exports`;
1333
- // @ts-expect-error TS2345
1304
+
1334
1305
  obj = replacements?.get(obj) || obj;
1335
1306
  }
1336
1307
 
@@ -1343,7 +1314,6 @@ ${code}
1343
1314
  // Directly use module.exports for wrapped assets importing themselves.
1344
1315
  return 'module.exports';
1345
1316
  } else {
1346
- // @ts-expect-error TS2322
1347
1317
  return obj;
1348
1318
  }
1349
1319
  } else if (
@@ -1358,21 +1328,17 @@ ${code}
1358
1328
  if (
1359
1329
  (!dep || kind === 'Import' || kind === 'Export') &&
1360
1330
  exportSymbol === 'default' &&
1361
- // @ts-expect-error TS2345
1362
1331
  resolvedAsset.symbols.hasExportSymbol('*') &&
1363
1332
  this.needsDefaultInterop(resolvedAsset)
1364
1333
  ) {
1365
1334
  this.usedHelpers.add('$parcel$interopDefault');
1366
- // @ts-expect-error TS2731
1367
1335
  return `(/*@__PURE__*/$parcel$interopDefault(${obj}))`;
1368
1336
  } else {
1369
- // @ts-expect-error TS2345
1370
1337
  return this.getPropertyAccess(obj, exportSymbol);
1371
1338
  }
1372
1339
  } else if (!symbol) {
1373
1340
  invariant(false, 'Asset was skipped or not found.');
1374
1341
  } else {
1375
- // @ts-expect-error TS2322
1376
1342
  return replacements?.get(symbol) || symbol;
1377
1343
  }
1378
1344
  }
@@ -1449,11 +1415,8 @@ ${code}
1449
1415
  // If there's no __esModule flag, and default is a used symbol, we need
1450
1416
  // to insert an interop helper.
1451
1417
  let defaultInterop =
1452
- // @ts-expect-error TS2345
1453
1418
  asset.symbols.hasExportSymbol('*') &&
1454
- // @ts-expect-error TS2345
1455
1419
  usedSymbols.has('default') &&
1456
- // @ts-expect-error TS2345
1457
1420
  !asset.symbols.hasExportSymbol('__esModule');
1458
1421
 
1459
1422
  let usedNamespace;
@@ -1462,33 +1425,35 @@ ${code}
1462
1425
  asset.meta.isConstantModule
1463
1426
  ) {
1464
1427
  // Only set usedNamespace if there is an incoming dependency in the current bundle that uses '*'
1465
- usedNamespace = this.bundleGraph.getIncomingDependencies(asset).some(
1466
- (dep) =>
1467
- this.bundle.hasDependency(dep) &&
1468
- // @ts-expect-error TS2345
1469
- nullthrows(this.bundleGraph.getUsedSymbols(dep)).has('*'),
1470
- );
1428
+ usedNamespace = this.bundleGraph
1429
+ .getIncomingDependencies(asset)
1430
+ .some(
1431
+ (dep) =>
1432
+ this.bundle.hasDependency(dep) &&
1433
+ nullthrows(this.bundleGraph.getUsedSymbols(dep)).has('*'),
1434
+ );
1471
1435
  } else {
1472
1436
  usedNamespace =
1473
1437
  // If the asset has * in its used symbols, we might need the exports namespace.
1474
1438
  // The one case where this isn't true is in ESM library entries, where the only
1475
1439
  // dependency on * is the entry dependency. In this case, we will use ESM exports
1476
1440
  // instead of the namespace object.
1477
- // @ts-expect-error TS2345
1441
+
1478
1442
  (usedSymbols.has('*') &&
1479
1443
  (this.bundle.env.outputFormat !== 'esmodule' ||
1480
1444
  !this.bundle.env.isLibrary ||
1481
1445
  asset !== this.bundle.getMainEntry() ||
1482
- this.bundleGraph.getIncomingDependencies(asset).some(
1483
- (dep) =>
1484
- !dep.isEntry &&
1485
- this.bundle.hasDependency(dep) &&
1486
- // @ts-expect-error TS2345
1487
- nullthrows(this.bundleGraph.getUsedSymbols(dep)).has('*'),
1488
- ))) ||
1446
+ this.bundleGraph
1447
+ .getIncomingDependencies(asset)
1448
+ .some(
1449
+ (dep) =>
1450
+ !dep.isEntry &&
1451
+ this.bundle.hasDependency(dep) &&
1452
+ nullthrows(this.bundleGraph.getUsedSymbols(dep)).has('*'),
1453
+ ))) ||
1489
1454
  // If a symbol is imported (used) from a CJS asset but isn't listed in the symbols,
1490
1455
  // we fallback on the namespace object.
1491
- // @ts-expect-error TS2345
1456
+
1492
1457
  (asset.symbols.hasExportSymbol('*') &&
1493
1458
  [...usedSymbols].some((s) => !asset.symbols.hasExportSymbol(s))) ||
1494
1459
  // If the exports has this asset's namespace (e.g. ESM output from CJS input),
@@ -1525,7 +1490,7 @@ ${code}
1525
1490
  // Insert the __esModule interop flag for this module if it has a `default` export
1526
1491
  // and the namespace symbol is used.
1527
1492
  // TODO: only if required by CJS?
1528
- // @ts-expect-error TS2345
1493
+
1529
1494
  if (asset.symbols.hasExportSymbol('default') && usedSymbols.has('*')) {
1530
1495
  prepend += `\n$parcel$defineInteropFlag($${assetId}$exports);\n`;
1531
1496
  prependLineCount += 2;
@@ -1544,7 +1509,6 @@ ${code}
1544
1509
  let isWrapped = resolved && resolved.meta.shouldWrap;
1545
1510
 
1546
1511
  for (let [imported, {local}] of dep.symbols) {
1547
- // @ts-expect-error TS2367
1548
1512
  if (imported === '*' && local === '*') {
1549
1513
  if (!resolved) {
1550
1514
  // Re-exporting an external module. This should have already been handled in buildReplacements.
@@ -1562,11 +1526,9 @@ ${code}
1562
1526
  if (
1563
1527
  isWrapped ||
1564
1528
  resolved.meta.staticExports === false ||
1565
- // @ts-expect-error TS2345
1566
1529
  nullthrows(this.bundleGraph.getUsedSymbols(resolved)).has('*') ||
1567
1530
  // an empty asset
1568
1531
  (!resolved.meta.hasCJSExports &&
1569
- // @ts-expect-error TS2345
1570
1532
  resolved.symbols.hasExportSymbol('*'))
1571
1533
  ) {
1572
1534
  let obj = this.getSymbolResolution(
@@ -1583,9 +1545,7 @@ ${code}
1583
1545
  this.bundleGraph.getUsedSymbols(dep),
1584
1546
  )) {
1585
1547
  if (
1586
- // @ts-expect-error TS2367
1587
1548
  symbol === 'default' || // `export * as ...` does not include the default export
1588
- // @ts-expect-error TS2367
1589
1549
  symbol === '__esModule'
1590
1550
  ) {
1591
1551
  continue;
@@ -1594,7 +1554,7 @@ ${code}
1594
1554
  let resolvedSymbol = this.getSymbolResolution(
1595
1555
  asset,
1596
1556
  resolved,
1597
- // @ts-expect-error TS2345
1557
+
1598
1558
  symbol,
1599
1559
  undefined,
1600
1560
  replacements,
@@ -1620,7 +1580,6 @@ ${code}
1620
1580
  // re-exported symbols rather than only symbols declared in this asset.
1621
1581
  let incomingDeps = this.bundleGraph.getIncomingDependencies(asset);
1622
1582
  let usedExports = [...asset.symbols.exportSymbols()].filter((symbol) => {
1623
- // @ts-expect-error TS2367
1624
1583
  if (symbol === '*') {
1625
1584
  return false;
1626
1585
  }
@@ -1637,7 +1596,6 @@ ${code}
1637
1596
  // No used symbols available for the asset, make sure we keep all of them
1638
1597
  if (!symbols) return false;
1639
1598
 
1640
- // @ts-expect-error TS2345
1641
1599
  return !symbols.has(symbol) && !symbols.has('*');
1642
1600
  });
1643
1601
  return !unused;
@@ -1652,7 +1610,6 @@ ${code}
1652
1610
  let resolved = this.getSymbolResolution(
1653
1611
  asset,
1654
1612
  asset,
1655
- // @ts-expect-error TS2345
1656
1613
  exp,
1657
1614
  undefined,
1658
1615
  replacements,
@@ -1800,9 +1757,7 @@ ${code}
1800
1757
 
1801
1758
  needsDefaultInterop(asset: Asset): boolean {
1802
1759
  if (
1803
- // @ts-expect-error TS2345
1804
1760
  asset.symbols.hasExportSymbol('*') &&
1805
- // @ts-expect-error TS2345
1806
1761
  !asset.symbols.hasExportSymbol('default')
1807
1762
  ) {
1808
1763
  return true;
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.