@atlaspack/transformer-typescript-types 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.
- package/CHANGELOG.md +8 -0
- package/lib/TSModuleGraph.js +0 -13
- package/lib/TSTypesTransformer.js +4 -6
- package/lib/collect.js +4 -28
- package/lib/shake.js +6 -24
- package/lib/utils.js +0 -4
- package/lib/wrappers.js +0 -1
- package/package.json +9 -14
- package/src/{TSModule.ts → TSModule.js} +6 -13
- package/src/{TSModuleGraph.ts → TSModuleGraph.js} +9 -48
- package/src/{TSTypesTransformer.ts → TSTypesTransformer.js} +10 -10
- package/src/{collect.ts → collect.js} +5 -22
- package/src/{shake.ts → shake.js} +6 -19
- package/src/{utils.ts → utils.js} +2 -3
- package/src/{wrappers.ts → wrappers.js} +58 -95
- package/LICENSE +0 -201
- package/lib/TSModule.d.ts +0 -25
- package/lib/TSModuleGraph.d.ts +0 -33
- package/lib/TSTypesTransformer.d.ts +0 -3
- package/lib/collect.d.ts +0 -2
- package/lib/shake.d.ts +0 -2
- package/lib/utils.d.ts +0 -2
- package/lib/wrappers.d.ts +0 -8
- package/tsconfig.json +0 -4
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
// @flow
|
|
1
2
|
import type {TSModuleGraph} from './TSModuleGraph';
|
|
2
3
|
|
|
3
4
|
import nullthrows from 'nullthrows';
|
|
4
|
-
import ts, {EntityName} from 'typescript';
|
|
5
|
+
import ts, {type EntityName} from 'typescript';
|
|
5
6
|
import {TSModule} from './TSModule';
|
|
6
7
|
import {getExportedName, isDeclaration} from './utils';
|
|
7
8
|
|
|
@@ -15,11 +16,10 @@ export function collect(
|
|
|
15
16
|
|
|
16
17
|
// When module definitions are nested inside each other (e.g with module augmentation),
|
|
17
18
|
// we want to keep track of the hierarchy so we can associated nodes with the right module.
|
|
18
|
-
const moduleStack: Array
|
|
19
|
-
let _currentModule: TSModule
|
|
19
|
+
const moduleStack: Array<?TSModule> = [];
|
|
20
|
+
let _currentModule: ?TSModule;
|
|
20
21
|
let visit = (node: any): any => {
|
|
21
22
|
if (ts.isBundle(node)) {
|
|
22
|
-
// @ts-expect-error TS2345
|
|
23
23
|
return factory.updateBundle(node, ts.visitNodes(node.sourceFiles, visit));
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -36,23 +36,17 @@ export function collect(
|
|
|
36
36
|
let currentModule = nullthrows(_currentModule);
|
|
37
37
|
if (ts.isImportDeclaration(node) && node.importClause) {
|
|
38
38
|
if (node.importClause.namedBindings) {
|
|
39
|
-
// @ts-expect-error TS2339
|
|
40
39
|
if (node.importClause.namedBindings.elements) {
|
|
41
|
-
// @ts-expect-error TS2339
|
|
42
40
|
for (let element of node.importClause.namedBindings.elements) {
|
|
43
41
|
currentModule.addImport(
|
|
44
42
|
element.name.text,
|
|
45
|
-
// @ts-expect-error TS2339
|
|
46
43
|
node.moduleSpecifier.text,
|
|
47
44
|
(element.propertyName ?? element.name).text,
|
|
48
45
|
);
|
|
49
46
|
}
|
|
50
|
-
// @ts-expect-error TS2339
|
|
51
47
|
} else if (node.importClause.namedBindings.name) {
|
|
52
48
|
currentModule.addImport(
|
|
53
|
-
// @ts-expect-error TS2339
|
|
54
49
|
node.importClause.namedBindings.name.text,
|
|
55
|
-
// @ts-expect-error TS2339
|
|
56
50
|
node.moduleSpecifier.text,
|
|
57
51
|
'*',
|
|
58
52
|
);
|
|
@@ -62,7 +56,6 @@ export function collect(
|
|
|
62
56
|
if (node.importClause.name) {
|
|
63
57
|
currentModule.addImport(
|
|
64
58
|
node.importClause.name.text,
|
|
65
|
-
// @ts-expect-error TS2339
|
|
66
59
|
node.moduleSpecifier.text,
|
|
67
60
|
'default',
|
|
68
61
|
);
|
|
@@ -71,13 +64,11 @@ export function collect(
|
|
|
71
64
|
|
|
72
65
|
if (ts.isExportDeclaration(node)) {
|
|
73
66
|
if (node.exportClause) {
|
|
74
|
-
// @ts-expect-error TS2339
|
|
75
67
|
for (let element of node.exportClause.elements) {
|
|
76
68
|
if (node.moduleSpecifier) {
|
|
77
69
|
currentModule.addExport(
|
|
78
70
|
element.name.text,
|
|
79
71
|
(element.propertyName ?? element.name).text,
|
|
80
|
-
// @ts-expect-error TS2339
|
|
81
72
|
node.moduleSpecifier.text,
|
|
82
73
|
);
|
|
83
74
|
} else {
|
|
@@ -88,7 +79,6 @@ export function collect(
|
|
|
88
79
|
}
|
|
89
80
|
}
|
|
90
81
|
} else {
|
|
91
|
-
// @ts-expect-error TS18048
|
|
92
82
|
currentModule.addWildcardExport(node.moduleSpecifier.text);
|
|
93
83
|
}
|
|
94
84
|
}
|
|
@@ -128,10 +118,8 @@ export function collect(
|
|
|
128
118
|
(m) => m.kind === ts.SyntaxKind.ExportKeyword,
|
|
129
119
|
);
|
|
130
120
|
for (let v of node.declarationList.declarations) {
|
|
131
|
-
// @ts-expect-error TS2339
|
|
132
121
|
currentModule.addLocal(v.name.text, v);
|
|
133
122
|
if (isExported) {
|
|
134
|
-
// @ts-expect-error TS2339
|
|
135
123
|
currentModule.addExport(v.name.text, v.name.text);
|
|
136
124
|
}
|
|
137
125
|
}
|
|
@@ -151,24 +139,19 @@ export function collect(
|
|
|
151
139
|
// Traverse down an EntityName to the root identifier. Return that to use as the named import specifier,
|
|
152
140
|
// and collect the remaining parts into a new QualifiedName with the local replacement at the root.
|
|
153
141
|
// import('react').JSX.Element => import {JSX} from 'react'; JSX.Element
|
|
154
|
-
// @ts-expect-error TS7023
|
|
155
142
|
function getImportName(
|
|
156
|
-
qualifier: EntityName
|
|
143
|
+
qualifier: ?EntityName,
|
|
157
144
|
local: string,
|
|
158
145
|
factory: typeof ts,
|
|
159
146
|
) {
|
|
160
147
|
if (!qualifier) {
|
|
161
|
-
// @ts-expect-error TS2339
|
|
162
148
|
return ['*', factory.createIdentifier(local)];
|
|
163
149
|
}
|
|
164
150
|
|
|
165
151
|
if (qualifier.kind === ts.SyntaxKind.Identifier) {
|
|
166
|
-
// @ts-expect-error TS2339
|
|
167
152
|
return [qualifier.text, factory.createIdentifier(local)];
|
|
168
153
|
}
|
|
169
154
|
|
|
170
|
-
// @ts-expect-error TS7022
|
|
171
155
|
let [name, entity] = getImportName(qualifier.left, local, factory);
|
|
172
|
-
// @ts-expect-error TS2339
|
|
173
156
|
return [name, factory.createQualifiedName(entity, qualifier.right)];
|
|
174
157
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @flow
|
|
1
2
|
import {TSModule} from './TSModule';
|
|
2
3
|
import type {TSModuleGraph} from './TSModuleGraph';
|
|
3
4
|
|
|
@@ -29,14 +30,13 @@ export function shake(
|
|
|
29
30
|
|
|
30
31
|
// When module definitions are nested inside each other (e.g with module augmentation),
|
|
31
32
|
// we want to keep track of the hierarchy so we can associated nodes with the right module.
|
|
32
|
-
const moduleStack: Array
|
|
33
|
+
const moduleStack: Array<?TSModule> = [];
|
|
33
34
|
|
|
34
35
|
let addedGeneratedImports = false;
|
|
35
36
|
|
|
36
|
-
let _currentModule: TSModule
|
|
37
|
+
let _currentModule: ?TSModule;
|
|
37
38
|
let visit = (node: any): any => {
|
|
38
39
|
if (ts.isBundle(node)) {
|
|
39
|
-
// @ts-expect-error TS2345
|
|
40
40
|
return factory.updateBundle(node, ts.visitNodes(node.sourceFiles, visit));
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -46,12 +46,9 @@ export function shake(
|
|
|
46
46
|
if (moduleStack.length >= 1) {
|
|
47
47
|
// Since we are hoisting them to the top-level scope, we need to add a "declare" keyword to make them ambient.
|
|
48
48
|
// we also want the declare keyword to come after the export keyword to guarantee a valid typings file.
|
|
49
|
-
// @ts-expect-error TS2540
|
|
50
49
|
node.modifiers ??= [];
|
|
51
50
|
const index =
|
|
52
|
-
// @ts-expect-error TS18048
|
|
53
51
|
node.modifiers[0]?.kind === ts.SyntaxKind.ExportKeyword ? 1 : 0;
|
|
54
|
-
// @ts-expect-error TS18048
|
|
55
52
|
node.modifiers.splice(
|
|
56
53
|
index,
|
|
57
54
|
0,
|
|
@@ -63,7 +60,6 @@ export function shake(
|
|
|
63
60
|
moduleStack.push(_currentModule);
|
|
64
61
|
let isFirstModule = !_currentModule;
|
|
65
62
|
_currentModule = moduleGraph.getModule(node.name.text);
|
|
66
|
-
// @ts-expect-error TS2532
|
|
67
63
|
let statements = ts.visitEachChild(node, visit, context).body.statements;
|
|
68
64
|
_currentModule = moduleStack.pop();
|
|
69
65
|
|
|
@@ -89,13 +85,11 @@ export function shake(
|
|
|
89
85
|
if (ts.isExportDeclaration(node)) {
|
|
90
86
|
if (
|
|
91
87
|
!node.moduleSpecifier ||
|
|
92
|
-
// @ts-expect-error TS2339
|
|
93
88
|
moduleGraph.getModule(node.moduleSpecifier.text)
|
|
94
89
|
) {
|
|
95
90
|
if (!node.moduleSpecifier && node.exportClause) {
|
|
96
91
|
// Filter exported elements to only external re-exports
|
|
97
|
-
let exported
|
|
98
|
-
// @ts-expect-error TS2339
|
|
92
|
+
let exported = [];
|
|
99
93
|
for (let element of node.exportClause.elements) {
|
|
100
94
|
let name = (element.propertyName ?? element.name).text;
|
|
101
95
|
if (
|
|
@@ -141,7 +135,6 @@ export function shake(
|
|
|
141
135
|
|
|
142
136
|
// Remove original export modifiers
|
|
143
137
|
node.modifiers = (node.modifiers || []).filter(
|
|
144
|
-
// @ts-expect-error TS7006
|
|
145
138
|
(m) =>
|
|
146
139
|
m.kind !== ts.SyntaxKind.ExportKeyword &&
|
|
147
140
|
m.kind !== ts.SyntaxKind.DefaultKeyword,
|
|
@@ -168,7 +161,6 @@ export function shake(
|
|
|
168
161
|
ts.isFunctionDeclaration(node) ||
|
|
169
162
|
ts.isClassDeclaration(node)
|
|
170
163
|
) {
|
|
171
|
-
// @ts-expect-error TS18048
|
|
172
164
|
node.modifiers.unshift(
|
|
173
165
|
factory.createModifier(ts.SyntaxKind.DeclareKeyword),
|
|
174
166
|
);
|
|
@@ -185,7 +177,6 @@ export function shake(
|
|
|
185
177
|
|
|
186
178
|
// Remove original export modifiers
|
|
187
179
|
node.modifiers = (node.modifiers || []).filter(
|
|
188
|
-
// @ts-expect-error TS7006
|
|
189
180
|
(m) =>
|
|
190
181
|
m.kind !== ts.SyntaxKind.ExportKeyword &&
|
|
191
182
|
m.kind !== ts.SyntaxKind.DeclareKeyword,
|
|
@@ -193,7 +184,6 @@ export function shake(
|
|
|
193
184
|
|
|
194
185
|
// Add export modifier if all declarations are exported.
|
|
195
186
|
let isExported = node.declarationList.declarations.every(
|
|
196
|
-
// @ts-expect-error TS7006
|
|
197
187
|
(d) => exportedNames.get(d.name.text) === currentModule,
|
|
198
188
|
);
|
|
199
189
|
if (isExported) {
|
|
@@ -212,7 +202,6 @@ export function shake(
|
|
|
212
202
|
|
|
213
203
|
if (ts.isVariableDeclaration(node)) {
|
|
214
204
|
// Remove unused variables
|
|
215
|
-
// @ts-expect-error TS2339
|
|
216
205
|
if (!currentModule.used.has(node.name.text)) {
|
|
217
206
|
return null;
|
|
218
207
|
}
|
|
@@ -261,13 +250,11 @@ export function shake(
|
|
|
261
250
|
}
|
|
262
251
|
|
|
263
252
|
function generateImports(factory: any, moduleGraph: TSModuleGraph) {
|
|
264
|
-
|
|
265
|
-
let importStatements: Array<ImportDeclaration | any> = [];
|
|
253
|
+
let importStatements = [];
|
|
266
254
|
for (let [specifier, names] of moduleGraph.getAllImports()) {
|
|
267
255
|
let defaultSpecifier;
|
|
268
256
|
let namespaceSpecifier;
|
|
269
|
-
|
|
270
|
-
let namedSpecifiers: Array<ImportSpecifier | any> = [];
|
|
257
|
+
let namedSpecifiers = [];
|
|
271
258
|
for (let [name, imported] of names) {
|
|
272
259
|
if (imported === 'default') {
|
|
273
260
|
defaultSpecifier = factory.createIdentifier(name);
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
+
// @flow
|
|
1
2
|
import ts from 'typescript';
|
|
2
3
|
|
|
3
|
-
export function getExportedName(node: any): string
|
|
4
|
+
export function getExportedName(node: any): ?string {
|
|
4
5
|
if (!node.modifiers) {
|
|
5
6
|
return null;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
|
-
// @ts-expect-error TS7006
|
|
9
9
|
if (!node.modifiers.some((m) => m.kind === ts.SyntaxKind.ExportKeyword)) {
|
|
10
10
|
return null;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
// @ts-expect-error TS7006
|
|
14
13
|
if (node.modifiers.some((m) => m.kind === ts.SyntaxKind.DefaultKeyword)) {
|
|
15
14
|
return 'default';
|
|
16
15
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @flow
|
|
1
2
|
/* eslint-disable no-unused-vars */
|
|
2
3
|
import type {
|
|
3
4
|
ExportDeclaration,
|
|
@@ -25,30 +26,18 @@ const [majorVersion, minorVersion] = ts.versionMajorMinor
|
|
|
25
26
|
export const createImportClause: (
|
|
26
27
|
factory: any,
|
|
27
28
|
isTypeOnly: boolean,
|
|
28
|
-
name: Identifier |
|
|
29
|
-
namedBindings: NamedImportBindings |
|
|
29
|
+
name: Identifier | void,
|
|
30
|
+
namedBindings: NamedImportBindings | void,
|
|
30
31
|
) => ImportClause = (() => {
|
|
31
32
|
if (majorVersion > 4 || (majorVersion === 4 && minorVersion >= 0)) {
|
|
32
|
-
return (
|
|
33
|
-
factory
|
|
34
|
-
isTypeOnly: boolean,
|
|
35
|
-
name: undefined | Identifier,
|
|
36
|
-
namedBindings: undefined | NamedImportBindings,
|
|
37
|
-
) => factory.createImportClause(isTypeOnly, name, namedBindings);
|
|
33
|
+
return (factory, isTypeOnly, name, namedBindings) =>
|
|
34
|
+
factory.createImportClause(isTypeOnly, name, namedBindings);
|
|
38
35
|
} else if (majorVersion > 3 || (majorVersion === 3 && minorVersion >= 8)) {
|
|
39
|
-
return (
|
|
40
|
-
factory
|
|
41
|
-
isTypeOnly: boolean,
|
|
42
|
-
name: undefined | Identifier,
|
|
43
|
-
namedBindings: undefined | NamedImportBindings,
|
|
44
|
-
) => factory.createImportClause(name, namedBindings, isTypeOnly);
|
|
36
|
+
return (factory, isTypeOnly, name, namedBindings) =>
|
|
37
|
+
factory.createImportClause(name, namedBindings, isTypeOnly);
|
|
45
38
|
} else if (majorVersion > 3 || (majorVersion === 3 && minorVersion >= 0)) {
|
|
46
|
-
return (
|
|
47
|
-
factory
|
|
48
|
-
isTypeOnly: boolean,
|
|
49
|
-
name: undefined | Identifier,
|
|
50
|
-
namedBindings: undefined | NamedImportBindings,
|
|
51
|
-
) => factory.createImportClause(name, namedBindings);
|
|
39
|
+
return (factory, isTypeOnly, name, namedBindings) =>
|
|
40
|
+
factory.createImportClause(name, namedBindings);
|
|
52
41
|
} else {
|
|
53
42
|
invariant(false);
|
|
54
43
|
}
|
|
@@ -56,19 +45,13 @@ export const createImportClause: (
|
|
|
56
45
|
|
|
57
46
|
export const createImportDeclaration: (
|
|
58
47
|
factory: any,
|
|
59
|
-
modifiers: Modifier[] |
|
|
60
|
-
importClause: ImportClause |
|
|
48
|
+
modifiers: Modifier[] | void,
|
|
49
|
+
importClause: ImportClause | void,
|
|
61
50
|
moduleSpecifier: Expression,
|
|
62
51
|
assertClause: AssertClause,
|
|
63
52
|
) => ImportDeclaration = (() => {
|
|
64
53
|
if (majorVersion > 4 || (majorVersion === 4 && minorVersion >= 8)) {
|
|
65
|
-
return (
|
|
66
|
-
factory: any,
|
|
67
|
-
modifiers: undefined | Array<Modifier>,
|
|
68
|
-
importClause: undefined | ImportClause,
|
|
69
|
-
moduleSpecifier: Expression,
|
|
70
|
-
assertClause: AssertClause,
|
|
71
|
-
) =>
|
|
54
|
+
return (factory, modifiers, importClause, moduleSpecifier, assertClause) =>
|
|
72
55
|
factory.createImportDeclaration(
|
|
73
56
|
modifiers,
|
|
74
57
|
importClause,
|
|
@@ -76,13 +59,7 @@ export const createImportDeclaration: (
|
|
|
76
59
|
assertClause,
|
|
77
60
|
);
|
|
78
61
|
} else if (majorVersion > 4 || (majorVersion === 4 && minorVersion >= 5)) {
|
|
79
|
-
return (
|
|
80
|
-
factory: any,
|
|
81
|
-
modifiers: undefined | Array<Modifier>,
|
|
82
|
-
importClause: undefined | ImportClause,
|
|
83
|
-
moduleSpecifier: Expression,
|
|
84
|
-
assertClause: AssertClause,
|
|
85
|
-
) =>
|
|
62
|
+
return (factory, modifiers, importClause, moduleSpecifier, assertClause) =>
|
|
86
63
|
factory.createImportDeclaration(
|
|
87
64
|
undefined /* decorators */,
|
|
88
65
|
modifiers,
|
|
@@ -91,13 +68,7 @@ export const createImportDeclaration: (
|
|
|
91
68
|
assertClause,
|
|
92
69
|
);
|
|
93
70
|
} else if (majorVersion > 3 || (majorVersion === 3 && minorVersion >= 0)) {
|
|
94
|
-
return (
|
|
95
|
-
factory: any,
|
|
96
|
-
modifiers: undefined | Array<Modifier>,
|
|
97
|
-
importClause: undefined | ImportClause,
|
|
98
|
-
moduleSpecifier: Expression,
|
|
99
|
-
assertClause: AssertClause,
|
|
100
|
-
) =>
|
|
71
|
+
return (factory, modifiers, importClause, moduleSpecifier, assertClause) =>
|
|
101
72
|
factory.createImportDeclaration(
|
|
102
73
|
undefined /* decorators */,
|
|
103
74
|
modifiers,
|
|
@@ -112,23 +83,15 @@ export const createImportDeclaration: (
|
|
|
112
83
|
export const createImportSpecifier: (
|
|
113
84
|
factory: any,
|
|
114
85
|
isTypeOnly: boolean,
|
|
115
|
-
propertyName: Identifier |
|
|
86
|
+
propertyName: Identifier | void,
|
|
116
87
|
name: Identifier,
|
|
117
88
|
) => ImportSpecifier = (() => {
|
|
118
89
|
if (majorVersion > 4 || (majorVersion === 4 && minorVersion >= 5)) {
|
|
119
|
-
return (
|
|
120
|
-
factory
|
|
121
|
-
isTypeOnly: boolean,
|
|
122
|
-
propertyName: undefined | Identifier,
|
|
123
|
-
name: Identifier,
|
|
124
|
-
) => factory.createImportSpecifier(isTypeOnly, propertyName, name);
|
|
90
|
+
return (factory, isTypeOnly, propertyName, name) =>
|
|
91
|
+
factory.createImportSpecifier(isTypeOnly, propertyName, name);
|
|
125
92
|
} else if (majorVersion > 3 || (majorVersion === 3 && minorVersion >= 0)) {
|
|
126
|
-
return (
|
|
127
|
-
factory
|
|
128
|
-
isTypeOnly: boolean,
|
|
129
|
-
propertyName: undefined | Identifier,
|
|
130
|
-
name: Identifier,
|
|
131
|
-
) => factory.createImportSpecifier(propertyName, name);
|
|
93
|
+
return (factory, isTypeOnly, propertyName, name) =>
|
|
94
|
+
factory.createImportSpecifier(propertyName, name);
|
|
132
95
|
} else {
|
|
133
96
|
invariant(false);
|
|
134
97
|
}
|
|
@@ -137,21 +100,21 @@ export const createImportSpecifier: (
|
|
|
137
100
|
export const updateExportDeclaration: (
|
|
138
101
|
factory: any,
|
|
139
102
|
node: ExportDeclaration,
|
|
140
|
-
modifiers: Modifier[] |
|
|
103
|
+
modifiers: Modifier[] | void,
|
|
141
104
|
isTypeOnly: boolean,
|
|
142
|
-
exportClause: NamedExportBindings |
|
|
143
|
-
moduleSpecifier: Expression |
|
|
144
|
-
assertClause: AssertClause |
|
|
105
|
+
exportClause: NamedExportBindings | void,
|
|
106
|
+
moduleSpecifier: Expression | void,
|
|
107
|
+
assertClause: AssertClause | void,
|
|
145
108
|
) => ExportDeclaration = (() => {
|
|
146
109
|
if (majorVersion > 4 || (majorVersion === 4 && minorVersion >= 8)) {
|
|
147
110
|
return (
|
|
148
|
-
factory
|
|
149
|
-
node
|
|
150
|
-
modifiers
|
|
151
|
-
isTypeOnly
|
|
152
|
-
exportClause
|
|
153
|
-
moduleSpecifier
|
|
154
|
-
assertClause
|
|
111
|
+
factory,
|
|
112
|
+
node,
|
|
113
|
+
modifiers,
|
|
114
|
+
isTypeOnly,
|
|
115
|
+
exportClause,
|
|
116
|
+
moduleSpecifier,
|
|
117
|
+
assertClause,
|
|
155
118
|
) =>
|
|
156
119
|
factory.updateExportDeclaration(
|
|
157
120
|
node,
|
|
@@ -163,13 +126,13 @@ export const updateExportDeclaration: (
|
|
|
163
126
|
);
|
|
164
127
|
} else if (majorVersion > 4 || (majorVersion === 4 && minorVersion >= 5)) {
|
|
165
128
|
return (
|
|
166
|
-
factory
|
|
167
|
-
node
|
|
168
|
-
modifiers
|
|
169
|
-
isTypeOnly
|
|
170
|
-
exportClause
|
|
171
|
-
moduleSpecifier
|
|
172
|
-
assertClause
|
|
129
|
+
factory,
|
|
130
|
+
node,
|
|
131
|
+
modifiers,
|
|
132
|
+
isTypeOnly,
|
|
133
|
+
exportClause,
|
|
134
|
+
moduleSpecifier,
|
|
135
|
+
assertClause,
|
|
173
136
|
) =>
|
|
174
137
|
factory.updateExportDeclaration(
|
|
175
138
|
node,
|
|
@@ -182,13 +145,13 @@ export const updateExportDeclaration: (
|
|
|
182
145
|
);
|
|
183
146
|
} else if (majorVersion > 4 || (majorVersion === 4 && minorVersion >= 0)) {
|
|
184
147
|
return (
|
|
185
|
-
factory
|
|
186
|
-
node
|
|
187
|
-
modifiers
|
|
188
|
-
isTypeOnly
|
|
189
|
-
exportClause
|
|
190
|
-
moduleSpecifier
|
|
191
|
-
assertClause
|
|
148
|
+
factory,
|
|
149
|
+
node,
|
|
150
|
+
modifiers,
|
|
151
|
+
isTypeOnly,
|
|
152
|
+
exportClause,
|
|
153
|
+
moduleSpecifier,
|
|
154
|
+
assertClause,
|
|
192
155
|
) =>
|
|
193
156
|
factory.updateExportDeclaration(
|
|
194
157
|
node,
|
|
@@ -200,13 +163,13 @@ export const updateExportDeclaration: (
|
|
|
200
163
|
);
|
|
201
164
|
} else if (majorVersion > 3 || (majorVersion === 3 && minorVersion >= 8)) {
|
|
202
165
|
return (
|
|
203
|
-
factory
|
|
204
|
-
node
|
|
205
|
-
modifiers
|
|
206
|
-
isTypeOnly
|
|
207
|
-
exportClause
|
|
208
|
-
moduleSpecifier
|
|
209
|
-
assertClause
|
|
166
|
+
factory,
|
|
167
|
+
node,
|
|
168
|
+
modifiers,
|
|
169
|
+
isTypeOnly,
|
|
170
|
+
exportClause,
|
|
171
|
+
moduleSpecifier,
|
|
172
|
+
assertClause,
|
|
210
173
|
) =>
|
|
211
174
|
factory.updateExportDeclaration(
|
|
212
175
|
node,
|
|
@@ -218,13 +181,13 @@ export const updateExportDeclaration: (
|
|
|
218
181
|
);
|
|
219
182
|
} else if (majorVersion > 3 || (majorVersion === 3 && minorVersion >= 0)) {
|
|
220
183
|
return (
|
|
221
|
-
factory
|
|
222
|
-
node
|
|
223
|
-
modifiers
|
|
224
|
-
isTypeOnly
|
|
225
|
-
exportClause
|
|
226
|
-
moduleSpecifier
|
|
227
|
-
assertClause
|
|
184
|
+
factory,
|
|
185
|
+
node,
|
|
186
|
+
modifiers,
|
|
187
|
+
isTypeOnly,
|
|
188
|
+
exportClause,
|
|
189
|
+
moduleSpecifier,
|
|
190
|
+
assertClause,
|
|
228
191
|
) =>
|
|
229
192
|
factory.updateExportDeclaration(
|
|
230
193
|
node,
|
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.
|