@suseejs/check 0.1.1 → 0.1.3
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/dist/index.cjs +204 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +30 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +203 -0
- package/dist/index.js.map +1 -0
- package/package.json +1 -1
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// cSpell:disable
|
|
3
|
+
const path = require("node:path");
|
|
4
|
+
const ts = require("typescript");
|
|
5
|
+
const jsesm_exts = [".js", ".mjs"];
|
|
6
|
+
const jscjs_exts = [".cjs"];
|
|
7
|
+
const tsesm_exts = [".ts", ".mts"];
|
|
8
|
+
const tscjs_exts = [".cts"];
|
|
9
|
+
const jsx_exts = [".jsx", ".tsx"];
|
|
10
|
+
const all_exts = [
|
|
11
|
+
...jscjs_exts,
|
|
12
|
+
...jsesm_exts,
|
|
13
|
+
...tscjs_exts,
|
|
14
|
+
...tsesm_exts,
|
|
15
|
+
...jsx_exts,
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* Check types of given files and exit process if any errors are found.
|
|
19
|
+
* @param deps List of files to check, where each file is an object with
|
|
20
|
+
* `file` and `content` properties.
|
|
21
|
+
* @param compilerOptions TypeScript compiler options.
|
|
22
|
+
* @returns True if no errors are found, false otherwise.
|
|
23
|
+
*/
|
|
24
|
+
function checkTypes(deps, compilerOptions) {
|
|
25
|
+
if (!compilerOptions.noCheck) {
|
|
26
|
+
console.time("types checked");
|
|
27
|
+
const filePaths = deps.map((i) => i.file);
|
|
28
|
+
let _err = false;
|
|
29
|
+
// Create program
|
|
30
|
+
const program = ts.createProgram(filePaths, compilerOptions);
|
|
31
|
+
// Check each file individually for immediate feedback
|
|
32
|
+
for (const filePath of filePaths) {
|
|
33
|
+
const sourceFile = program.getSourceFile(filePath);
|
|
34
|
+
if (!sourceFile) {
|
|
35
|
+
console.error(`File not found: ${path.relative(process.cwd(), filePath)}`);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
const diagnostics = [
|
|
39
|
+
...program.getSyntacticDiagnostics(sourceFile),
|
|
40
|
+
...program.getSemanticDiagnostics(sourceFile),
|
|
41
|
+
...program.getDeclarationDiagnostics(sourceFile),
|
|
42
|
+
];
|
|
43
|
+
if (diagnostics.length > 0) {
|
|
44
|
+
const formatHost = {
|
|
45
|
+
getCurrentDirectory: () => process.cwd(),
|
|
46
|
+
getCanonicalFileName: (fileName) => fileName,
|
|
47
|
+
getNewLine: () => ts.sys.newLine,
|
|
48
|
+
};
|
|
49
|
+
console.error(ts.formatDiagnosticsWithColorAndContext(diagnostics, formatHost));
|
|
50
|
+
_err = true;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (_err) {
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
console.timeEnd("types checked");
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function checkJSX(deps) {
|
|
63
|
+
const exts = deps.map((dep) => {
|
|
64
|
+
return path.extname(dep.file);
|
|
65
|
+
});
|
|
66
|
+
const jsxSet = new Set(jsx_exts);
|
|
67
|
+
return exts.every((i) => jsxSet.has(i));
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Check the file extensions of given dependencies.
|
|
71
|
+
* @param deps List of files to check, where each file is an object with
|
|
72
|
+
* `file` and `content` properties.
|
|
73
|
+
* @returns True if no unsupported file extensions are found, false otherwise.
|
|
74
|
+
* @throws If unsupported file extensions are found, the function will throw an error and exit the process.
|
|
75
|
+
*/
|
|
76
|
+
function checkExtGroup(deps) {
|
|
77
|
+
const exts = deps.map((dep) => {
|
|
78
|
+
return path.extname(dep.file);
|
|
79
|
+
});
|
|
80
|
+
const jsesmSet = new Set(jsesm_exts);
|
|
81
|
+
const jscjsSet = new Set(jscjs_exts);
|
|
82
|
+
const tsesmSet = new Set(tsesm_exts);
|
|
83
|
+
const tscjsSet = new Set(tscjs_exts);
|
|
84
|
+
const allSet = new Set(all_exts);
|
|
85
|
+
const isCjs = exts.every((i) => jscjsSet.has(i)) || exts.every((i) => tscjsSet.has(i));
|
|
86
|
+
const isJs = exts.every((i) => jsesmSet.has(i));
|
|
87
|
+
const isTs = exts.every((i) => tsesmSet.has(i));
|
|
88
|
+
const isBoth = isJs && isTs;
|
|
89
|
+
const isNone = !exts.every((i) => allSet.has(i));
|
|
90
|
+
if (isNone) {
|
|
91
|
+
console.warn("Bundler detects none Javascript or Typescript extensions in the dependencies tree.");
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
94
|
+
if (isCjs) {
|
|
95
|
+
console.warn("The package detects commonjs extensions (.cjd or .cts) in the dependencies tree, which is currently unsupported.");
|
|
96
|
+
process.exit(1);
|
|
97
|
+
}
|
|
98
|
+
if (isBoth) {
|
|
99
|
+
console.warn("The package detects both Javascript or Typescript extensions in the dependencies tree, currently unsupported.");
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Check the module format of all the given files.
|
|
106
|
+
* @param deps List of files to check, where each file is an object with
|
|
107
|
+
* `file` and `content` properties.
|
|
108
|
+
* @returns True if the function finishes without errors, false otherwise.
|
|
109
|
+
*/
|
|
110
|
+
function checkModuleFormat(deps) {
|
|
111
|
+
let _esmCount = 0;
|
|
112
|
+
let cjsCount = 0;
|
|
113
|
+
let unknowCount = 0;
|
|
114
|
+
for (const dep of deps) {
|
|
115
|
+
try {
|
|
116
|
+
// Create a TypeScript source file
|
|
117
|
+
const sourceFile = ts.createSourceFile(dep.file, dep.content, ts.ScriptTarget.Latest, true);
|
|
118
|
+
let hasESMImports = false;
|
|
119
|
+
let hasCommonJS = false;
|
|
120
|
+
// Walk through the AST to detect module syntax
|
|
121
|
+
function walk(node) {
|
|
122
|
+
// Check for ESM import/export syntax
|
|
123
|
+
if (ts.isImportDeclaration(node) ||
|
|
124
|
+
ts.isImportEqualsDeclaration(node) ||
|
|
125
|
+
ts.isExportDeclaration(node) ||
|
|
126
|
+
ts.isExportSpecifier(node) ||
|
|
127
|
+
ts.isExportAssignment(node)) {
|
|
128
|
+
hasESMImports = true;
|
|
129
|
+
}
|
|
130
|
+
// Check for export modifier on declarations
|
|
131
|
+
if ((ts.isVariableStatement(node) ||
|
|
132
|
+
ts.isFunctionDeclaration(node) ||
|
|
133
|
+
ts.isInterfaceDeclaration(node) ||
|
|
134
|
+
ts.isTypeAliasDeclaration(node) ||
|
|
135
|
+
ts.isEnumDeclaration(node) ||
|
|
136
|
+
ts.isClassDeclaration(node)) &&
|
|
137
|
+
node.modifiers?.some((mod) => mod.kind === ts.SyntaxKind.ExportKeyword)) {
|
|
138
|
+
hasESMImports = true;
|
|
139
|
+
}
|
|
140
|
+
// Check for CommonJS require/exports
|
|
141
|
+
if (ts.isCallExpression(node)) {
|
|
142
|
+
if (ts.isIdentifier(node.expression) &&
|
|
143
|
+
node.expression.text === "require" &&
|
|
144
|
+
node.arguments.length > 0) {
|
|
145
|
+
hasCommonJS = true;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
// Check for module.exports or exports.xxx
|
|
149
|
+
if (ts.isPropertyAccessExpression(node)) {
|
|
150
|
+
const text = node.getText(sourceFile);
|
|
151
|
+
if (text.startsWith("module.exports") ||
|
|
152
|
+
text.startsWith("exports.")) {
|
|
153
|
+
hasCommonJS = true;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
// Continue walking the AST
|
|
157
|
+
ts.forEachChild(node, walk);
|
|
158
|
+
}
|
|
159
|
+
walk(sourceFile);
|
|
160
|
+
// Determine the module format based on what we found
|
|
161
|
+
if (hasESMImports && !hasCommonJS) {
|
|
162
|
+
_esmCount++;
|
|
163
|
+
}
|
|
164
|
+
else if (hasCommonJS && !hasESMImports) {
|
|
165
|
+
cjsCount++;
|
|
166
|
+
}
|
|
167
|
+
else if (hasESMImports && hasCommonJS) {
|
|
168
|
+
// Mixed - probably ESM with dynamic imports or similar
|
|
169
|
+
_esmCount++;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
console.error(`Error checking module format for ${dep.file} : \n ${error}`);
|
|
174
|
+
unknowCount++;
|
|
175
|
+
}
|
|
176
|
+
} // loop
|
|
177
|
+
if (unknowCount) {
|
|
178
|
+
console.warn("Unknown error when checking module types in the dependencies tree.");
|
|
179
|
+
process.exit(1);
|
|
180
|
+
}
|
|
181
|
+
if (cjsCount) {
|
|
182
|
+
console.warn("The package detects CommonJs format in the dependencies tree, currently unsupported.");
|
|
183
|
+
process.exit(1);
|
|
184
|
+
}
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Check if all files in the given list have the same file extension and
|
|
189
|
+
* the same module format.
|
|
190
|
+
* @param deps List of files to check, where each file is an object with
|
|
191
|
+
* `file` and `content` properties.
|
|
192
|
+
* @returns True if all files have the same file extension and module format,
|
|
193
|
+
* false otherwise.
|
|
194
|
+
*/
|
|
195
|
+
function fileExtensionAndFormat(deps) {
|
|
196
|
+
console.time("checked extension and module");
|
|
197
|
+
const ce = checkExtGroup(deps);
|
|
198
|
+
const cm = checkModuleFormat(deps);
|
|
199
|
+
console.timeEnd("checked extension and module");
|
|
200
|
+
return ce && cm;
|
|
201
|
+
}
|
|
202
|
+
const check = { checkTypes, fileExtensionAndFormat, checkJSX };
|
|
203
|
+
module.exports = check;
|
|
204
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.cts"],"names":[],"mappings":";AAAA,iBAAiB;AACjB,kCAAmC;AACnC,iCAAkC;AAOlC,M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**
|
|
7
|
+
* Check types of given files and exit process if any errors are found.
|
|
8
|
+
* @param deps List of files to check, where each file is an object with
|
|
9
|
+
* `file` and `content` properties.
|
|
10
|
+
* @param compilerOptions TypeScript compiler options.
|
|
11
|
+
* @returns True if no errors are found, false otherwise.
|
|
12
|
+
*/
|
|
13
|
+
declare function checkTypes(deps: DepsFile[], compilerOptions: ts.CompilerOptions): true | undefined;
|
|
14
|
+
declare function checkJSX(deps: DepsFile[]): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Check if all files in the given list have the same file extension and
|
|
17
|
+
* the same module format.
|
|
18
|
+
* @param deps List of files to check, where each file is an object with
|
|
19
|
+
* `file` and `content` properties.
|
|
20
|
+
* @returns True if all files have the same file extension and module format,
|
|
21
|
+
* false otherwise.
|
|
22
|
+
*/
|
|
23
|
+
declare function fileExtensionAndFormat(deps: DepsFile[]): boolean;
|
|
24
|
+
declare const check: {
|
|
25
|
+
checkTypes: typeof checkTypes;
|
|
26
|
+
fileExtensionAndFormat: typeof fileExtensionAndFormat;
|
|
27
|
+
checkJSX: typeof checkJSX;
|
|
28
|
+
};
|
|
29
|
+
export = check;
|
|
30
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.cts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,QAAQ,YAAY,CAAC,CAAC;AAElC,UAAU,QAAQ;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAeD;;;;;;GAMG;AACH,iBAAS,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,eAAe,EAAE,EAAE,CAAC,eAAe,oBA0CxE;AACD,iBAAS,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,WAMjC;AAyJD;;;;;;;GAOG;AACH,iBAAS,sBAAsB,CAAC,IAAI,EAAE,QAAQ,EAAE,WAM/C;AAED,QAAA,MAAM,KAAK;;;;CAAmD,CAAC;AAE/D,SAAS,KAAK,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
interface DepsFile {
|
|
3
|
+
file: string;
|
|
4
|
+
content: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Check types of given files and exit process if any errors are found.
|
|
8
|
+
* @param deps List of files to check, where each file is an object with
|
|
9
|
+
* `file` and `content` properties.
|
|
10
|
+
* @param compilerOptions TypeScript compiler options.
|
|
11
|
+
* @returns True if no errors are found, false otherwise.
|
|
12
|
+
*/
|
|
13
|
+
declare function checkTypes(deps: DepsFile[], compilerOptions: ts.CompilerOptions): true | undefined;
|
|
14
|
+
declare function checkJSX(deps: DepsFile[]): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Check if all files in the given list have the same file extension and
|
|
17
|
+
* the same module format.
|
|
18
|
+
* @param deps List of files to check, where each file is an object with
|
|
19
|
+
* `file` and `content` properties.
|
|
20
|
+
* @returns True if all files have the same file extension and module format,
|
|
21
|
+
* false otherwise.
|
|
22
|
+
*/
|
|
23
|
+
declare function fileExtensionAndFormat(deps: DepsFile[]): boolean;
|
|
24
|
+
declare const check: {
|
|
25
|
+
checkTypes: typeof checkTypes;
|
|
26
|
+
fileExtensionAndFormat: typeof fileExtensionAndFormat;
|
|
27
|
+
checkJSX: typeof checkJSX;
|
|
28
|
+
};
|
|
29
|
+
export default check;
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,UAAU,QAAQ;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAeD;;;;;;GAMG;AACH,iBAAS,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,eAAe,EAAE,EAAE,CAAC,eAAe,oBA0CxE;AAED,iBAAS,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,WAMjC;AA0JD;;;;;;;GAOG;AACH,iBAAS,sBAAsB,CAAC,IAAI,EAAE,QAAQ,EAAE,WAM/C;AAED,QAAA,MAAM,KAAK;;;;CAAmD,CAAC;AAE/D,eAAe,KAAK,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
// cSpell:disable
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import ts from "typescript";
|
|
4
|
+
const jsesm_exts = [".js", ".mjs"];
|
|
5
|
+
const jscjs_exts = [".cjs"];
|
|
6
|
+
const tsesm_exts = [".ts", ".mts"];
|
|
7
|
+
const tscjs_exts = [".cts"];
|
|
8
|
+
const jsx_exts = [".jsx", ".tsx"];
|
|
9
|
+
const all_exts = [
|
|
10
|
+
...jscjs_exts,
|
|
11
|
+
...jsesm_exts,
|
|
12
|
+
...tscjs_exts,
|
|
13
|
+
...tsesm_exts,
|
|
14
|
+
...jsx_exts,
|
|
15
|
+
];
|
|
16
|
+
/**
|
|
17
|
+
* Check types of given files and exit process if any errors are found.
|
|
18
|
+
* @param deps List of files to check, where each file is an object with
|
|
19
|
+
* `file` and `content` properties.
|
|
20
|
+
* @param compilerOptions TypeScript compiler options.
|
|
21
|
+
* @returns True if no errors are found, false otherwise.
|
|
22
|
+
*/
|
|
23
|
+
function checkTypes(deps, compilerOptions) {
|
|
24
|
+
if (!compilerOptions.noCheck) {
|
|
25
|
+
console.time("types checked");
|
|
26
|
+
const filePaths = deps.map((i) => i.file);
|
|
27
|
+
let _err = false;
|
|
28
|
+
// Create program
|
|
29
|
+
const program = ts.createProgram(filePaths, compilerOptions);
|
|
30
|
+
// Check each file individually for immediate feedback
|
|
31
|
+
for (const filePath of filePaths) {
|
|
32
|
+
const sourceFile = program.getSourceFile(filePath);
|
|
33
|
+
if (!sourceFile) {
|
|
34
|
+
console.error(`File not found: ${path.relative(process.cwd(), filePath)}`);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
const diagnostics = [
|
|
38
|
+
...program.getSyntacticDiagnostics(sourceFile),
|
|
39
|
+
...program.getSemanticDiagnostics(sourceFile),
|
|
40
|
+
...program.getDeclarationDiagnostics(sourceFile),
|
|
41
|
+
];
|
|
42
|
+
if (diagnostics.length > 0) {
|
|
43
|
+
const formatHost = {
|
|
44
|
+
getCurrentDirectory: () => process.cwd(),
|
|
45
|
+
getCanonicalFileName: (fileName) => fileName,
|
|
46
|
+
getNewLine: () => ts.sys.newLine,
|
|
47
|
+
};
|
|
48
|
+
console.error(ts.formatDiagnosticsWithColorAndContext(diagnostics, formatHost));
|
|
49
|
+
_err = true;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (_err) {
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
console.timeEnd("types checked");
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function checkJSX(deps) {
|
|
62
|
+
const exts = deps.map((dep) => {
|
|
63
|
+
return path.extname(dep.file);
|
|
64
|
+
});
|
|
65
|
+
const jsxSet = new Set(jsx_exts);
|
|
66
|
+
return exts.every((i) => jsxSet.has(i));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Check the file extensions of given dependencies.
|
|
70
|
+
* @param deps List of files to check, where each file is an object with
|
|
71
|
+
* `file` and `content` properties.
|
|
72
|
+
* @returns True if no unsupported file extensions are found, false otherwise.
|
|
73
|
+
* @throws If unsupported file extensions are found, the function will throw an error and exit the process.
|
|
74
|
+
*/
|
|
75
|
+
function checkExtGroup(deps) {
|
|
76
|
+
const exts = deps.map((dep) => {
|
|
77
|
+
return path.extname(dep.file);
|
|
78
|
+
});
|
|
79
|
+
const jsesmSet = new Set(jsesm_exts);
|
|
80
|
+
const jscjsSet = new Set(jscjs_exts);
|
|
81
|
+
const tsesmSet = new Set(tsesm_exts);
|
|
82
|
+
const tscjsSet = new Set(tscjs_exts);
|
|
83
|
+
const allSet = new Set(all_exts);
|
|
84
|
+
const isCjs = exts.every((i) => jscjsSet.has(i)) || exts.every((i) => tscjsSet.has(i));
|
|
85
|
+
const isJs = exts.every((i) => jsesmSet.has(i));
|
|
86
|
+
const isTs = exts.every((i) => tsesmSet.has(i));
|
|
87
|
+
const isBoth = isJs && isTs;
|
|
88
|
+
const isNone = !exts.every((i) => allSet.has(i));
|
|
89
|
+
if (isNone) {
|
|
90
|
+
console.warn("Bundler detects none Javascript or Typescript extensions in the dependencies tree.");
|
|
91
|
+
process.exit(1);
|
|
92
|
+
}
|
|
93
|
+
if (isCjs) {
|
|
94
|
+
console.warn("The package detects commonjs extensions (.cjd or .cts) in the dependencies tree, which is currently unsupported.");
|
|
95
|
+
process.exit(1);
|
|
96
|
+
}
|
|
97
|
+
if (isBoth) {
|
|
98
|
+
console.warn("The package detects both Javascript or Typescript extensions in the dependencies tree, currently unsupported.");
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Check the module format of all the given files.
|
|
105
|
+
* @param deps List of files to check, where each file is an object with
|
|
106
|
+
* `file` and `content` properties.
|
|
107
|
+
* @returns True if the function finishes without errors, false otherwise.
|
|
108
|
+
*/
|
|
109
|
+
function checkModuleFormat(deps) {
|
|
110
|
+
let _esmCount = 0;
|
|
111
|
+
let cjsCount = 0;
|
|
112
|
+
let unknowCount = 0;
|
|
113
|
+
for (const dep of deps) {
|
|
114
|
+
try {
|
|
115
|
+
// Create a TypeScript source file
|
|
116
|
+
const sourceFile = ts.createSourceFile(dep.file, dep.content, ts.ScriptTarget.Latest, true);
|
|
117
|
+
let hasESMImports = false;
|
|
118
|
+
let hasCommonJS = false;
|
|
119
|
+
// Walk through the AST to detect module syntax
|
|
120
|
+
function walk(node) {
|
|
121
|
+
// Check for ESM import/export syntax
|
|
122
|
+
if (ts.isImportDeclaration(node) ||
|
|
123
|
+
ts.isImportEqualsDeclaration(node) ||
|
|
124
|
+
ts.isExportDeclaration(node) ||
|
|
125
|
+
ts.isExportSpecifier(node) ||
|
|
126
|
+
ts.isExportAssignment(node)) {
|
|
127
|
+
hasESMImports = true;
|
|
128
|
+
}
|
|
129
|
+
// Check for export modifier on declarations
|
|
130
|
+
if ((ts.isVariableStatement(node) ||
|
|
131
|
+
ts.isFunctionDeclaration(node) ||
|
|
132
|
+
ts.isInterfaceDeclaration(node) ||
|
|
133
|
+
ts.isTypeAliasDeclaration(node) ||
|
|
134
|
+
ts.isEnumDeclaration(node) ||
|
|
135
|
+
ts.isClassDeclaration(node)) &&
|
|
136
|
+
node.modifiers?.some((mod) => mod.kind === ts.SyntaxKind.ExportKeyword)) {
|
|
137
|
+
hasESMImports = true;
|
|
138
|
+
}
|
|
139
|
+
// Check for CommonJS require/exports
|
|
140
|
+
if (ts.isCallExpression(node)) {
|
|
141
|
+
if (ts.isIdentifier(node.expression) &&
|
|
142
|
+
node.expression.text === "require" &&
|
|
143
|
+
node.arguments.length > 0) {
|
|
144
|
+
hasCommonJS = true;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
// Check for module.exports or exports.xxx
|
|
148
|
+
if (ts.isPropertyAccessExpression(node)) {
|
|
149
|
+
const text = node.getText(sourceFile);
|
|
150
|
+
if (text.startsWith("module.exports") ||
|
|
151
|
+
text.startsWith("exports.")) {
|
|
152
|
+
hasCommonJS = true;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
// Continue walking the AST
|
|
156
|
+
ts.forEachChild(node, walk);
|
|
157
|
+
}
|
|
158
|
+
walk(sourceFile);
|
|
159
|
+
// Determine the module format based on what we found
|
|
160
|
+
if (hasESMImports && !hasCommonJS) {
|
|
161
|
+
_esmCount++;
|
|
162
|
+
}
|
|
163
|
+
else if (hasCommonJS && !hasESMImports) {
|
|
164
|
+
cjsCount++;
|
|
165
|
+
}
|
|
166
|
+
else if (hasESMImports && hasCommonJS) {
|
|
167
|
+
// Mixed - probably ESM with dynamic imports or similar
|
|
168
|
+
_esmCount++;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
console.error(`Error checking module format for ${dep.file} : \n ${error}`);
|
|
173
|
+
unknowCount++;
|
|
174
|
+
}
|
|
175
|
+
} // loop
|
|
176
|
+
if (unknowCount) {
|
|
177
|
+
console.warn("Unknown error when checking module types in the dependencies tree.");
|
|
178
|
+
process.exit(1);
|
|
179
|
+
}
|
|
180
|
+
if (cjsCount) {
|
|
181
|
+
console.warn("The package detects CommonJs format in the dependencies tree, currently unsupported.");
|
|
182
|
+
process.exit(1);
|
|
183
|
+
}
|
|
184
|
+
return true;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Check if all files in the given list have the same file extension and
|
|
188
|
+
* the same module format.
|
|
189
|
+
* @param deps List of files to check, where each file is an object with
|
|
190
|
+
* `file` and `content` properties.
|
|
191
|
+
* @returns True if all files have the same file extension and module format,
|
|
192
|
+
* false otherwise.
|
|
193
|
+
*/
|
|
194
|
+
function fileExtensionAndFormat(deps) {
|
|
195
|
+
console.time("checked extension and module");
|
|
196
|
+
const ce = checkExtGroup(deps);
|
|
197
|
+
const cm = checkModuleFormat(deps);
|
|
198
|
+
console.timeEnd("checked extension and module");
|
|
199
|
+
return ce && cm;
|
|
200
|
+
}
|
|
201
|
+
const check = { checkTypes, fileExtensionAndFormat, checkJSX };
|
|
202
|
+
export default check;
|
|
203
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iBAAiB;AACjB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,YAAY,CAAC;AAO5B,MAAM,UAAU,GAAG,CAAC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