@atlaspack/package-manager 2.14.21-typescript-bc4459c37.0 → 2.14.21

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 (44) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/index.d.ts +40 -0
  3. package/lib/JSONParseStream.js +2 -1
  4. package/lib/NodePackageManager.js +24 -44
  5. package/lib/Npm.js +1 -2
  6. package/lib/Pnpm.js +4 -18
  7. package/lib/Yarn.js +3 -17
  8. package/lib/getCurrentPackageManager.js +1 -3
  9. package/lib/index.d.ts +8 -8
  10. package/lib/installPackage.js +0 -1
  11. package/lib/nodejsConditions.js +0 -6
  12. package/lib/promiseFromProcess.js +0 -2
  13. package/package.json +17 -17
  14. package/src/{JSONParseStream.ts → JSONParseStream.js} +7 -8
  15. package/src/{MockPackageInstaller.ts → MockPackageInstaller.js} +6 -4
  16. package/src/{NodePackageManager.ts → NodePackageManager.js} +51 -72
  17. package/src/{Npm.ts → Npm.js} +9 -9
  18. package/src/{Pnpm.ts → Pnpm.js} +50 -68
  19. package/src/{Yarn.ts → Yarn.js} +25 -38
  20. package/src/{getCurrentPackageManager.ts → getCurrentPackageManager.js} +4 -9
  21. package/src/{index.ts → index.js} +2 -0
  22. package/src/{installPackage.ts → installPackage.js} +6 -5
  23. package/src/{nodejsConditions.ts → nodejsConditions.js} +3 -6
  24. package/src/promiseFromProcess.js +19 -0
  25. package/src/{utils.ts → utils.js} +11 -21
  26. package/src/{validateModuleSpecifier.ts → validateModuleSpecifier.js} +2 -0
  27. package/test/{NodePackageManager.test.ts → NodePackageManager.test.js} +15 -13
  28. package/test/{getCurrentPackageManager.test.ts → getCurrentPackageManager.test.js} +1 -0
  29. package/test/{validateModuleSpecifiers.test.ts → validateModuleSpecifiers.test.js} +3 -2
  30. package/LICENSE +0 -201
  31. package/lib/JSONParseStream.d.ts +0 -6
  32. package/lib/MockPackageInstaller.d.ts +0 -14
  33. package/lib/NodePackageManager.d.ts +0 -36
  34. package/lib/Npm.d.ts +0 -4
  35. package/lib/Pnpm.d.ts +0 -5
  36. package/lib/Yarn.d.ts +0 -5
  37. package/lib/getCurrentPackageManager.d.ts +0 -4
  38. package/lib/installPackage.d.ts +0 -5
  39. package/lib/nodejsConditions.d.ts +0 -3
  40. package/lib/promiseFromProcess.d.ts +0 -2
  41. package/lib/utils.d.ts +0 -15
  42. package/lib/validateModuleSpecifier.d.ts +0 -1
  43. package/src/promiseFromProcess.ts +0 -23
  44. package/tsconfig.json +0 -4
@@ -1,49 +1,41 @@
1
+ // @flow strict-local
2
+
1
3
  import type {PackageInstaller, InstallerOptions} from '@atlaspack/types';
2
4
 
3
- // @ts-expect-error TS7016
4
5
  import commandExists from 'command-exists';
5
- // @ts-expect-error TS7016
6
6
  import spawn from 'cross-spawn';
7
7
  import {registerSerializableClass} from '@atlaspack/build-cache';
8
8
  import logger from '@atlaspack/logger';
9
- // @ts-expect-error TS7016
10
9
  import split from 'split2';
11
10
  import JSONParseStream from './JSONParseStream';
12
11
  import promiseFromProcess from './promiseFromProcess';
13
12
  import {exec, npmSpecifierFromModuleRequest} from './utils';
14
13
 
14
+ // $FlowFixMe
15
15
  import pkg from '../package.json';
16
16
 
17
17
  const YARN_CMD = 'yarn';
18
18
 
19
19
  type YarnStdOutMessage =
20
- | {
21
- readonly type: 'step';
22
- data: {
23
- message: string;
24
- current: number;
25
- total: number;
26
- };
27
- }
28
- | {
29
- readonly type: 'success';
30
- data: string;
31
- }
32
- | {
33
- readonly type: 'info';
34
- data: string;
35
- }
36
- | {
37
- readonly type: 'tree' | 'progressStart' | 'progressTick';
38
- };
39
-
40
- type YarnStdErrMessage = {
41
- readonly type: 'error' | 'warning';
42
- data: string;
43
- };
44
-
45
- let hasYarn: boolean | null | undefined;
46
- let yarnVersion: number | null | undefined;
20
+ | {|
21
+ +type: 'step',
22
+ data: {|
23
+ message: string,
24
+ current: number,
25
+ total: number,
26
+ |},
27
+ |}
28
+ | {|+type: 'success', data: string|}
29
+ | {|+type: 'info', data: string|}
30
+ | {|+type: 'tree' | 'progressStart' | 'progressTick'|};
31
+
32
+ type YarnStdErrMessage = {|
33
+ +type: 'error' | 'warning',
34
+ data: string,
35
+ |};
36
+
37
+ let hasYarn: ?boolean;
38
+ let yarnVersion: ?number;
47
39
 
48
40
  export class Yarn implements PackageInstaller {
49
41
  static async exists(): Promise<boolean> {
@@ -53,7 +45,7 @@ export class Yarn implements PackageInstaller {
53
45
 
54
46
  try {
55
47
  hasYarn = Boolean(await commandExists('yarn'));
56
- } catch (err: any) {
48
+ } catch (err) {
57
49
  hasYarn = false;
58
50
  }
59
51
 
@@ -67,7 +59,6 @@ export class Yarn implements PackageInstaller {
67
59
  }: InstallerOptions): Promise<void> {
68
60
  if (yarnVersion == null) {
69
61
  let version = await exec('yarn --version');
70
- // @ts-expect-error TS2345
71
62
  yarnVersion = parseInt(version.stdout, 10);
72
63
  }
73
64
 
@@ -85,7 +76,7 @@ export class Yarn implements PackageInstaller {
85
76
  // When Parcel is run by Yarn (e.g. via package.json scripts), several environment variables are
86
77
  // added. When parcel in turn calls Yarn again, these can cause Yarn to behave stragely, so we
87
78
  // filter them out when installing packages.
88
- let env: Record<string, any> = {};
79
+ let env = {};
89
80
  for (let key in process.env) {
90
81
  if (
91
82
  !key.startsWith('npm_') &&
@@ -101,9 +92,7 @@ export class Yarn implements PackageInstaller {
101
92
  installProcess.stdout
102
93
  // Invoking yarn with --json provides streaming, newline-delimited JSON output.
103
94
  .pipe(split())
104
- // @ts-expect-error TS2554
105
95
  .pipe(new JSONParseStream())
106
- // @ts-expect-error TS7006
107
96
  .on('error', (e) => {
108
97
  logger.error(e, '@atlaspack/package-manager');
109
98
  })
@@ -130,9 +119,7 @@ export class Yarn implements PackageInstaller {
130
119
 
131
120
  installProcess.stderr
132
121
  .pipe(split())
133
- // @ts-expect-error TS2554
134
122
  .pipe(new JSONParseStream())
135
- // @ts-expect-error TS7006
136
123
  .on('error', (e) => {
137
124
  logger.error(e, '@atlaspack/package-manager');
138
125
  })
@@ -157,7 +144,7 @@ export class Yarn implements PackageInstaller {
157
144
 
158
145
  try {
159
146
  return await promiseFromProcess(installProcess);
160
- } catch (e: any) {
147
+ } catch (e) {
161
148
  throw new Error('Yarn failed to install modules:' + e.message);
162
149
  }
163
150
  }
@@ -1,13 +1,8 @@
1
+ // @flow
2
+
1
3
  export default function getCurrentPackageManager(
2
- // @ts-expect-error TS2322
3
- userAgent: string | null = process.env.npm_config_user_agent,
4
- ):
5
- | {
6
- name: string;
7
- version: string;
8
- }
9
- | null
10
- | undefined {
4
+ userAgent: ?string = process.env.npm_config_user_agent,
5
+ ): ?{|name: string, version: string|} {
11
6
  if (!userAgent) {
12
7
  return undefined;
13
8
  }
@@ -1,3 +1,5 @@
1
+ // @flow
2
+
1
3
  import type {PackageManagerResolveResult} from '@atlaspack/types';
2
4
 
3
5
  export type {
@@ -1,3 +1,5 @@
1
+ // @flow
2
+
1
3
  import type {FilePath, PackageJSON} from '@atlaspack/types';
2
4
  import type {
3
5
  ModuleRequest,
@@ -60,7 +62,7 @@ async function install(
60
62
  packagePath: fromPkgPath,
61
63
  fs,
62
64
  });
63
- } catch (err: any) {
65
+ } catch (err) {
64
66
  throw new Error(`Failed to install ${moduleNames}: ${err.message}`);
65
67
  }
66
68
 
@@ -86,7 +88,7 @@ async function installPeerDependencies(
86
88
  module: ModuleRequest,
87
89
  from: FilePath,
88
90
  projectRoot: FilePath,
89
- options: InstallOptions,
91
+ options,
90
92
  ) {
91
93
  const {resolved} = await packageManager.resolve(module.name, from);
92
94
  const modulePkg: PackageJSON = nullthrows(
@@ -110,7 +112,6 @@ async function installPeerDependencies(
110
112
  if (!semver.satisfies(pkg.version, range)) {
111
113
  throw new ThrowableDiagnostic({
112
114
  diagnostic: {
113
- // @ts-expect-error TS2345
114
115
  message: md`Could not install the peer dependency "${name}" for "${module.name}", installed version ${pkg.version} is incompatible with ${range}`,
115
116
  origin: '@atlaspack/package-manager',
116
117
  codeFrames: [
@@ -204,7 +205,7 @@ export function _addToInstallQueue(
204
205
  filePath: FilePath,
205
206
  projectRoot: FilePath,
206
207
  options?: InstallOptions,
207
- ): Promise<unknown> {
208
+ ): Promise<mixed> {
208
209
  modules = modules.map((request) => ({
209
210
  name: validateModuleSpecifier(request.name),
210
211
  range: request.range,
@@ -247,7 +248,7 @@ export function installPackage(
247
248
  filePath: FilePath,
248
249
  projectRoot: FilePath,
249
250
  options?: InstallOptions,
250
- ): Promise<unknown> {
251
+ ): Promise<mixed> {
251
252
  if (WorkerFarm.isWorker()) {
252
253
  let workerApi = WorkerFarm.getWorkerApi();
253
254
  // TODO this should really be `__filename` but without the rewriting.
@@ -1,8 +1,8 @@
1
+ // @flow
1
2
  import process from 'process';
2
3
 
3
4
  // https://nodejs.org/api/packages.html#conditional-exports
4
5
  // TODO We don't support { "type": "module" }
5
- // @ts-expect-error TS4104
6
6
  export const defaultNodejsConditions: Array<string> = Object.freeze([
7
7
  'node-addons',
8
8
  'node',
@@ -12,27 +12,24 @@ export const defaultNodejsConditions: Array<string> = Object.freeze([
12
12
  'default',
13
13
  ]);
14
14
 
15
- let envConditions: undefined | Array<string> = undefined;
15
+ let envConditions: void | Array<string> = undefined;
16
16
 
17
17
  /** @description Gets the export conditions from NODE_OPTIONS and node arguments */
18
18
  export function getConditionsFromEnv(): Array<string> {
19
19
  if (!envConditions) {
20
- const conditions: Array<never> = [];
20
+ const conditions = [];
21
21
 
22
22
  for (const arg of [
23
23
  ...process.execArgv,
24
24
  ...(process.env.NODE_OPTIONS || '').split(' '),
25
25
  ]) {
26
26
  if (arg.startsWith('--conditions=')) {
27
- // @ts-expect-error TS2345
28
27
  conditions.push(arg.substring(13));
29
28
  }
30
29
  }
31
30
 
32
- // @ts-expect-error TS4104
33
31
  envConditions = Object.freeze([...conditions, ...defaultNodejsConditions]);
34
32
  }
35
33
 
36
- // @ts-expect-error TS2322
37
34
  return envConditions;
38
35
  }
@@ -0,0 +1,19 @@
1
+ // @flow strict-local
2
+
3
+ import type {ChildProcess} from 'child_process';
4
+
5
+ export default function promiseFromProcess(
6
+ childProcess: ChildProcess,
7
+ ): Promise<void> {
8
+ return new Promise((resolve, reject) => {
9
+ childProcess.on('error', reject);
10
+ childProcess.on('close', (code) => {
11
+ if (code !== 0) {
12
+ reject(new Error('Child process failed'));
13
+ return;
14
+ }
15
+
16
+ resolve();
17
+ });
18
+ });
19
+ }
@@ -1,3 +1,5 @@
1
+ // @flow strict-local
2
+
1
3
  import type {FilePath, ModuleRequest} from '@atlaspack/types';
2
4
  import type {FileSystem} from '@atlaspack/fs';
3
5
 
@@ -9,12 +11,8 @@ import {promisify} from 'util';
9
11
 
10
12
  export const exec: (
11
13
  command: string,
12
- // @ts-expect-error TS2503
13
- options?: child_process.execOpts,
14
- ) => Promise<{
15
- stdout: string | Buffer;
16
- stderr: string | Buffer;
17
- }> = _exec
14
+ options?: child_process$execOpts,
15
+ ) => Promise<{|stdout: string | Buffer, stderr: string | Buffer|}> = _exec
18
16
  ? promisify(_exec)
19
17
  : // _exec is undefined in browser builds
20
18
  _exec;
@@ -27,10 +25,10 @@ export function npmSpecifierFromModuleRequest(
27
25
  : moduleRequest.name;
28
26
  }
29
27
 
30
- export function moduleRequestsFromDependencyMap(dependencyMap: {
31
- [key: string]: string;
32
- }): Array<ModuleRequest> {
33
- return Object.entries(dependencyMap).map(([name, range]: [any, any]) => {
28
+ export function moduleRequestsFromDependencyMap(dependencyMap: {|
29
+ [string]: string,
30
+ |}): Array<ModuleRequest> {
31
+ return Object.entries(dependencyMap).map(([name, range]) => {
34
32
  invariant(typeof range === 'string');
35
33
  return {
36
34
  name,
@@ -44,15 +42,7 @@ export async function getConflictingLocalDependencies(
44
42
  name: string,
45
43
  local: FilePath,
46
44
  projectRoot: FilePath,
47
- ): Promise<
48
- | {
49
- json: string;
50
- filePath: FilePath;
51
- fields: Array<string>;
52
- }
53
- | null
54
- | undefined
55
- > {
45
+ ): Promise<?{|json: string, filePath: FilePath, fields: Array<string>|}> {
56
46
  let pkgPath = await resolveConfig(fs, local, ['package.json'], projectRoot);
57
47
  if (pkgPath == null) {
58
48
  return;
@@ -62,7 +52,7 @@ export async function getConflictingLocalDependencies(
62
52
  let pkg;
63
53
  try {
64
54
  pkg = JSON.parse(pkgStr);
65
- } catch (e: any) {
55
+ } catch (e) {
66
56
  // TODO: codeframe
67
57
  throw new ThrowableDiagnostic({
68
58
  diagnostic: {
@@ -82,7 +72,7 @@ export async function getConflictingLocalDependencies(
82
72
  });
83
73
  }
84
74
 
85
- let fields: Array<string> = [];
75
+ let fields = [];
86
76
  for (let field of ['dependencies', 'devDependencies', 'peerDependencies']) {
87
77
  if (
88
78
  typeof pkg[field] === 'object' &&
@@ -1,3 +1,5 @@
1
+ // @flow
2
+
1
3
  const MODULE_REGEX = /^((@[^/\s]+\/){0,1}([^/\s.~]+[^/\s]*)){1}(@[^/\s]+){0,1}/;
2
4
 
3
5
  export default function validateModuleSpecifier(moduleName: string): string {
@@ -1,3 +1,5 @@
1
+ // @flow strict-local
2
+
1
3
  import {MemoryFS, NodeFS, OverlayFS} from '@atlaspack/fs';
2
4
  import assert from 'assert';
3
5
  import invariant from 'assert';
@@ -12,11 +14,11 @@ import {MockPackageInstaller, NodePackageManager} from '../src';
12
14
  const FIXTURES_DIR = path.join(__dirname, 'fixtures');
13
15
  const ROOT_DIR = path.normalize(path.join(__dirname, '..', '..', '..', '..'));
14
16
 
15
- function normalize(res: any) {
17
+ function normalize(res) {
16
18
  return {
17
19
  ...res,
18
20
  invalidateOnFileCreate:
19
- res?.invalidateOnFileCreate?.sort((a: any, b: any) => {
21
+ res?.invalidateOnFileCreate?.sort((a, b) => {
20
22
  let ax =
21
23
  a.filePath ??
22
24
  a.glob ??
@@ -34,15 +36,15 @@ function normalize(res: any) {
34
36
  };
35
37
  }
36
38
 
37
- function check(resolved: any, expected: any) {
39
+ function check(resolved, expected) {
38
40
  assert.deepEqual(normalize(resolved), normalize(expected));
39
41
  }
40
42
 
41
43
  describe('NodePackageManager', function () {
42
- let fs: any;
43
- let packageManager: any;
44
- let packageInstaller: any;
45
- let workerFarm: any;
44
+ let fs;
45
+ let packageManager;
46
+ let packageInstaller;
47
+ let workerFarm;
46
48
 
47
49
  // These can sometimes take a lil while
48
50
  this.timeout(20000);
@@ -75,7 +77,6 @@ describe('NodePackageManager', function () {
75
77
  type: 1,
76
78
  invalidateOnFileChange: new Set([
77
79
  path.join(FIXTURES_DIR, 'has-foo/node_modules/foo/package.json'),
78
- path.join(ROOT_DIR, '/packages/core/package-manager/tsconfig.json'),
79
80
  path.join(ROOT_DIR, 'tsconfig.json'),
80
81
  ]),
81
82
  invalidateOnFileCreate: [
@@ -131,7 +132,6 @@ describe('NodePackageManager', function () {
131
132
  type: 1,
132
133
  invalidateOnFileChange: new Set([
133
134
  path.join(FIXTURES_DIR, 'has-foo/node_modules/a/package.json'),
134
- path.join(ROOT_DIR, '/packages/core/package-manager/tsconfig.json'),
135
135
  path.join(ROOT_DIR, 'tsconfig.json'),
136
136
  ]),
137
137
  invalidateOnFileCreate: [
@@ -163,6 +163,7 @@ describe('NodePackageManager', function () {
163
163
  it('does not autoinstall packages that are already listed in package.json', async () => {
164
164
  packageInstaller.register('a', fs, path.join(FIXTURES_DIR, 'packages/a'));
165
165
 
166
+ // $FlowFixMe assert.rejects is Node 10+
166
167
  await assert.rejects(
167
168
  () =>
168
169
  packageManager.resolve(
@@ -170,7 +171,7 @@ describe('NodePackageManager', function () {
170
171
  path.join(FIXTURES_DIR, 'has-a-not-yet-installed/index.js'),
171
172
  {shouldAutoInstall: true},
172
173
  ),
173
- (err: any) => {
174
+ (err) => {
174
175
  invariant(err instanceof ThrowableDiagnostic);
175
176
  assert(err.message.includes('Run your package manager'));
176
177
  return true;
@@ -251,6 +252,7 @@ describe('NodePackageManager', function () {
251
252
  path.join(FIXTURES_DIR, 'has-foo/index.js'),
252
253
  );
253
254
 
255
+ // $FlowFixMe assert.rejects is Node 10+
254
256
  await assert.rejects(
255
257
  () =>
256
258
  packageManager.resolve(
@@ -260,7 +262,7 @@ describe('NodePackageManager', function () {
260
262
  range: '^2.0.0',
261
263
  },
262
264
  ),
263
- (err: any) => {
265
+ (err) => {
264
266
  invariant(err instanceof ThrowableDiagnostic);
265
267
  assert.equal(
266
268
  err.message,
@@ -303,7 +305,6 @@ describe('NodePackageManager', function () {
303
305
  FIXTURES_DIR,
304
306
  'has-foo/subpackage/node_modules/foo/package.json',
305
307
  ),
306
- path.join(ROOT_DIR, '/packages/core/package-manager/tsconfig.json'),
307
308
  path.join(ROOT_DIR, 'tsconfig.json'),
308
309
  ]),
309
310
  invalidateOnFileCreate: [
@@ -363,6 +364,7 @@ describe('NodePackageManager', function () {
363
364
  path.join(FIXTURES_DIR, 'packages/peers-2.0'),
364
365
  );
365
366
 
367
+ // $FlowFixMe assert.rejects is Node 10+
366
368
  await assert.rejects(
367
369
  () =>
368
370
  packageManager.resolve(
@@ -373,7 +375,7 @@ describe('NodePackageManager', function () {
373
375
  shouldAutoInstall: true,
374
376
  },
375
377
  ),
376
- (err: any) => {
378
+ (err) => {
377
379
  assert(err instanceof ThrowableDiagnostic);
378
380
  assert.equal(
379
381
  err.message,
@@ -1,3 +1,4 @@
1
+ // @flow
1
2
  import assert from 'assert';
2
3
  import getCurrentPackageManager from '../src/getCurrentPackageManager';
3
4
 
@@ -1,3 +1,4 @@
1
+ // @flow
1
2
  import assert from 'assert';
2
3
 
3
4
  import validateModuleSpecifier from '../src/validateModuleSpecifier';
@@ -14,7 +15,7 @@ describe('Validate Module Specifiers', () => {
14
15
  ];
15
16
 
16
17
  assert.deepEqual(
17
- modules.map((module: any) => validateModuleSpecifier(module)),
18
+ modules.map((module) => validateModuleSpecifier(module)),
18
19
  [
19
20
  '@atlaspack/transformer-posthtml',
20
21
  '@some-org/package@v1.0.0',
@@ -30,7 +31,7 @@ describe('Validate Module Specifiers', () => {
30
31
  let modules = ['./somewhere.js', './hello/world.js', '~/hello/world.js'];
31
32
 
32
33
  assert.deepEqual(
33
- modules.map((module: any) => validateModuleSpecifier(module)),
34
+ modules.map((module) => validateModuleSpecifier(module)),
34
35
  ['', '', ''],
35
36
  );
36
37
  });
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.