react-native-builder-bob 0.21.3 → 0.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/lib/index.js +24 -98
- package/lib/index.js.map +1 -1
- package/lib/targets/commonjs.js +4 -7
- package/lib/targets/commonjs.js.map +1 -1
- package/lib/targets/module.js +4 -7
- package/lib/targets/module.js.map +1 -1
- package/lib/targets/typescript.js +36 -67
- package/lib/targets/typescript.js.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib/utils/androidAssemble.js +0 -9
- package/lib/utils/androidAssemble.js.map +1 -1
- package/lib/utils/compile.js +23 -31
- package/lib/utils/compile.js.map +1 -1
- package/lib/utils/logger.js +0 -6
- package/lib/utils/logger.js.map +1 -1
- package/lib/utils/prompts.js +0 -4
- package/lib/utils/prompts.js.map +1 -1
- package/package.json +4 -7
- package/lib/targets/aar.js +0 -89
- package/lib/targets/aar.js.map +0 -1
- package/lib/utils/jetifier.js +0 -38
- package/lib/utils/jetifier.js.map +0 -1
|
@@ -4,26 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = build;
|
|
7
|
-
|
|
8
7
|
var _kleur = _interopRequireDefault(require("kleur"));
|
|
9
|
-
|
|
10
8
|
var _path = _interopRequireDefault(require("path"));
|
|
11
|
-
|
|
12
9
|
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
13
|
-
|
|
14
10
|
var _which = _interopRequireDefault(require("which"));
|
|
15
|
-
|
|
16
11
|
var _crossSpawn = _interopRequireDefault(require("cross-spawn"));
|
|
17
|
-
|
|
18
12
|
var _del = _interopRequireDefault(require("del"));
|
|
19
|
-
|
|
20
13
|
var _json = _interopRequireDefault(require("json5"));
|
|
21
|
-
|
|
22
14
|
var _os = require("os");
|
|
23
|
-
|
|
24
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
|
|
26
16
|
async function build({
|
|
17
|
+
source,
|
|
27
18
|
root,
|
|
28
19
|
output,
|
|
29
20
|
report,
|
|
@@ -32,34 +23,26 @@ async function build({
|
|
|
32
23
|
report.info(`Cleaning up previous build at ${_kleur.default.blue(_path.default.relative(root, output))}`);
|
|
33
24
|
await (0, _del.default)([output]);
|
|
34
25
|
report.info(`Generating type definitions with ${_kleur.default.blue('tsc')}`);
|
|
35
|
-
const project = options
|
|
36
|
-
|
|
26
|
+
const project = options?.project ? options.project : 'tsconfig.json';
|
|
37
27
|
const tsconfig = _path.default.join(root, project);
|
|
38
|
-
|
|
39
28
|
try {
|
|
40
29
|
if (await _fsExtra.default.pathExists(tsconfig)) {
|
|
41
30
|
try {
|
|
42
31
|
const config = _json.default.parse(await _fsExtra.default.readFile(tsconfig, 'utf-8'));
|
|
43
|
-
|
|
44
32
|
if (config.compilerOptions) {
|
|
45
33
|
const conflicts = [];
|
|
46
|
-
|
|
47
34
|
if (config.compilerOptions.noEmit !== undefined) {
|
|
48
35
|
conflicts.push('compilerOptions.noEmit');
|
|
49
36
|
}
|
|
50
|
-
|
|
51
37
|
if (config.compilerOptions.emitDeclarationOnly !== undefined) {
|
|
52
38
|
conflicts.push('compilerOptions.emitDeclarationOnly');
|
|
53
39
|
}
|
|
54
|
-
|
|
55
40
|
if (config.compilerOptions.declarationDir) {
|
|
56
41
|
conflicts.push('compilerOptions.declarationDir');
|
|
57
42
|
}
|
|
58
|
-
|
|
59
43
|
if (config.compilerOptions.outDir && _path.default.join(root, config.compilerOptions.outDir) !== output) {
|
|
60
44
|
conflicts.push('compilerOptions.outDir');
|
|
61
45
|
}
|
|
62
|
-
|
|
63
46
|
if (conflicts.length) {
|
|
64
47
|
report.warn(`Found following options in the config file which can conflict with the CLI options. Please remove them from ${_kleur.default.blue(project)}:${conflicts.reduce((acc, curr) => acc + `\n${_kleur.default.gray('-')} ${_kleur.default.yellow(curr)}`, '')}`);
|
|
65
48
|
}
|
|
@@ -70,94 +53,81 @@ async function build({
|
|
|
70
53
|
} else {
|
|
71
54
|
throw new Error(`Couldn't find a ${_kleur.default.blue('tsconfig.json')} in the project root.`);
|
|
72
55
|
}
|
|
73
|
-
|
|
74
56
|
let tsc;
|
|
75
|
-
|
|
76
|
-
if (options !== null && options !== void 0 && options.tsc) {
|
|
57
|
+
if (options?.tsc) {
|
|
77
58
|
tsc = _path.default.resolve(root, options.tsc);
|
|
78
|
-
|
|
79
59
|
if (!(await _fsExtra.default.pathExists(tsc))) {
|
|
80
60
|
throw new Error(`The ${_kleur.default.blue('tsc')} binary doesn't seem to be installed at ${_kleur.default.blue(tsc)}. Please specify the correct path in options or remove it to use the workspace's version.`);
|
|
81
61
|
}
|
|
82
62
|
} else {
|
|
83
|
-
var _execpath$split$pop;
|
|
84
|
-
|
|
85
63
|
const execpath = process.env.npm_execpath;
|
|
86
|
-
const cli = execpath
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
tsc = result.stdout.trim();
|
|
97
|
-
} else {
|
|
98
|
-
const result = _crossSpawn.default.sync('npm', ['bin'], {
|
|
99
|
-
stdio: 'pipe',
|
|
100
|
-
encoding: 'utf-8',
|
|
101
|
-
cwd: root
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
tsc = _path.default.resolve(result.stdout.trim(), 'tsc');
|
|
105
|
-
}
|
|
106
|
-
} catch (e) {
|
|
64
|
+
const cli = execpath?.split('/').pop()?.includes('yarn') ? 'yarn' : 'npm';
|
|
65
|
+
if (cli === 'yarn') {
|
|
66
|
+
const result = _crossSpawn.default.sync('yarn', ['bin', 'tsc'], {
|
|
67
|
+
stdio: 'pipe',
|
|
68
|
+
encoding: 'utf-8',
|
|
69
|
+
cwd: root
|
|
70
|
+
});
|
|
71
|
+
tsc = result.stdout.trim();
|
|
72
|
+
} else {
|
|
107
73
|
tsc = _path.default.resolve(root, 'node_modules', '.bin', 'tsc');
|
|
108
74
|
}
|
|
109
|
-
|
|
110
75
|
if ((0, _os.platform)() === 'win32' && !tsc.endsWith('.cmd')) {
|
|
111
76
|
tsc += '.cmd';
|
|
112
77
|
}
|
|
113
78
|
}
|
|
114
|
-
|
|
115
79
|
if (!(await _fsExtra.default.pathExists(tsc))) {
|
|
116
80
|
try {
|
|
117
81
|
tsc = await (0, _which.default)('tsc');
|
|
118
|
-
|
|
119
82
|
if (await _fsExtra.default.pathExists(tsc)) {
|
|
120
|
-
report.warn(`Failed to locate 'tsc' in the workspace. Falling back to the
|
|
83
|
+
report.warn(`Failed to locate ${_kleur.default.blue('tsc')} in the workspace. Falling back to the binary found in ${_kleur.default.blue('PATH')} at ${_kleur.default.blue(tsc)}. Consider adding ${_kleur.default.blue('typescript')} to your ${_kleur.default.blue('devDependencies')} or specifying the ${_kleur.default.blue('tsc')} option for the typescript target.`);
|
|
121
84
|
}
|
|
122
|
-
} catch (e) {
|
|
85
|
+
} catch (e) {
|
|
86
|
+
// Ignore
|
|
123
87
|
}
|
|
124
88
|
}
|
|
125
|
-
|
|
126
89
|
if (tsc == null || !(await _fsExtra.default.pathExists(tsc))) {
|
|
127
90
|
throw new Error(`The ${_kleur.default.blue('tsc')} binary doesn't seem to be installed under ${_kleur.default.blue('node_modules')} or present in $PATH. Make sure you have added ${_kleur.default.blue('typescript')} to your ${_kleur.default.blue('devDependencies')} or specify the ${_kleur.default.blue('tsc')} option for typescript.`);
|
|
128
91
|
}
|
|
129
|
-
|
|
130
92
|
const tsbuildinfo = _path.default.join(output, project.replace(/\.json$/, '.tsbuildinfo'));
|
|
131
|
-
|
|
132
93
|
try {
|
|
133
94
|
await (0, _del.default)([tsbuildinfo]);
|
|
134
|
-
} catch (e) {
|
|
95
|
+
} catch (e) {
|
|
96
|
+
// Ignore
|
|
135
97
|
}
|
|
136
|
-
|
|
137
98
|
const result = _crossSpawn.default.sync(tsc, ['--pretty', '--declaration', '--declarationMap', '--emitDeclarationOnly', '--project', project, '--outDir', output], {
|
|
138
99
|
stdio: 'inherit',
|
|
139
100
|
cwd: root
|
|
140
101
|
});
|
|
141
|
-
|
|
142
102
|
if (result.status === 0) {
|
|
143
103
|
await (0, _del.default)([tsbuildinfo]);
|
|
144
104
|
report.success(`Wrote definition files to ${_kleur.default.blue(_path.default.relative(root, output))}`);
|
|
145
105
|
const pkg = JSON.parse(await _fsExtra.default.readFile(_path.default.join(root, 'package.json'), 'utf-8'));
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
106
|
+
const getGeneratedTypesPath = async () => {
|
|
107
|
+
if (pkg.source) {
|
|
108
|
+
const indexDTsName = _path.default.basename(pkg.source).replace(/\.(jsx?|tsx?)$/, '') + '.d.ts';
|
|
109
|
+
const potentialPaths = [_path.default.join(output, _path.default.dirname(pkg.source), indexDTsName), _path.default.join(output, _path.default.dirname(_path.default.relative(source, _path.default.join(root, pkg.source))), indexDTsName)];
|
|
110
|
+
for (const potentialPath of potentialPaths) {
|
|
111
|
+
if (await _fsExtra.default.pathExists(potentialPath)) {
|
|
112
|
+
return _path.default.relative(root, potentialPath);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
151
115
|
}
|
|
152
|
-
|
|
116
|
+
return null;
|
|
117
|
+
};
|
|
118
|
+
if ('types' in pkg) {
|
|
153
119
|
const typesPath = _path.default.join(root, pkg.types);
|
|
154
|
-
|
|
155
120
|
if (!(await _fsExtra.default.pathExists(typesPath))) {
|
|
156
|
-
|
|
121
|
+
const generatedTypesPath = await getGeneratedTypesPath();
|
|
122
|
+
if (!generatedTypesPath) {
|
|
123
|
+
report.warn(`Failed to detect the entry point for the generated types. Make sure you have a valid ${_kleur.default.blue('source')} field in your ${_kleur.default.blue('package.json')}.`);
|
|
124
|
+
}
|
|
125
|
+
report.error(`The ${_kleur.default.blue('types')} field in ${_kleur.default.blue('package.json')} points to a non-existent file: ${_kleur.default.blue(pkg.types)}.\nVerify the path points to the correct file under ${_kleur.default.blue(_path.default.relative(root, output))}${generatedTypesPath ? ` (found ${_kleur.default.blue(generatedTypesPath)}).` : '.'}`);
|
|
157
126
|
throw new Error("Found incorrect path in 'types' field.");
|
|
158
127
|
}
|
|
159
128
|
} else {
|
|
160
|
-
|
|
129
|
+
const generatedTypesPath = await getGeneratedTypesPath();
|
|
130
|
+
report.warn(`No ${_kleur.default.blue('types')} field found in ${_kleur.default.blue('package.json')}.\nConsider ${generatedTypesPath ? `pointing it to ${_kleur.default.blue(generatedTypesPath)}` : 'adding it'} so that consumers of your package can use the types.`);
|
|
161
131
|
}
|
|
162
132
|
} else {
|
|
163
133
|
throw new Error('Failed to build definition files.');
|
|
@@ -174,7 +144,6 @@ async function build({
|
|
|
174
144
|
} else {
|
|
175
145
|
throw e;
|
|
176
146
|
}
|
|
177
|
-
|
|
178
147
|
throw new Error('Failed to build definition files.');
|
|
179
148
|
}
|
|
180
149
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.js","names":["build","root","output","report","options","info","kleur","blue","path","relative","del","project","tsconfig","join","fs","pathExists","config","JSON5","parse","readFile","compilerOptions","conflicts","noEmit","undefined","push","emitDeclarationOnly","declarationDir","outDir","length","warn","reduce","acc","curr","gray","yellow","e","Error","tsc","resolve","execpath","process","env","npm_execpath","cli","split","pop","includes","result","spawn","sync","stdio","encoding","cwd","stdout","trim","platform","endsWith","which","tsbuildinfo","replace","status","success","pkg","JSON","types","error","typesPath","toString","message"],"sources":["../../src/targets/typescript.ts"],"sourcesContent":["import kleur from 'kleur';\nimport path from 'path';\nimport fs from 'fs-extra';\nimport which from 'which';\nimport spawn from 'cross-spawn';\nimport del from 'del';\nimport JSON5 from 'json5';\nimport { platform } from 'os';\nimport type { Input } from '../types';\n\ntype Options = Input & {\n options?: { project?: string; tsc?: string };\n};\n\nexport default async function build({\n root,\n output,\n report,\n options,\n}: Options) {\n report.info(\n `Cleaning up previous build at ${kleur.blue(path.relative(root, output))}`\n );\n\n await del([output]);\n\n report.info(`Generating type definitions with ${kleur.blue('tsc')}`);\n\n const project = options?.project ? options.project : 'tsconfig.json';\n const tsconfig = path.join(root, project);\n\n try {\n if (await fs.pathExists(tsconfig)) {\n try {\n const config = JSON5.parse(await fs.readFile(tsconfig, 'utf-8'));\n\n if (config.compilerOptions) {\n const conflicts: string[] = [];\n\n if (config.compilerOptions.noEmit !== undefined) {\n conflicts.push('compilerOptions.noEmit');\n }\n\n if (config.compilerOptions.emitDeclarationOnly !== undefined) {\n conflicts.push('compilerOptions.emitDeclarationOnly');\n }\n\n if (config.compilerOptions.declarationDir) {\n conflicts.push('compilerOptions.declarationDir');\n }\n\n if (\n config.compilerOptions.outDir &&\n path.join(root, config.compilerOptions.outDir) !== output\n ) {\n conflicts.push('compilerOptions.outDir');\n }\n\n if (conflicts.length) {\n report.warn(\n `Found following options in the config file which can conflict with the CLI options. Please remove them from ${kleur.blue(\n project\n )}:${conflicts.reduce(\n (acc, curr) =>\n acc + `\\n${kleur.gray('-')} ${kleur.yellow(curr)}`,\n ''\n )}`\n );\n }\n }\n } catch (e) {\n report.warn(\n `Couldn't parse '${project}'. There might be validation errors.`\n );\n }\n } else {\n throw new Error(\n `Couldn't find a ${kleur.blue('tsconfig.json')} in the project root.`\n );\n }\n\n let tsc;\n\n if (options?.tsc) {\n tsc = path.resolve(root, options.tsc);\n\n if (!(await fs.pathExists(tsc))) {\n throw new Error(\n `The ${kleur.blue(\n 'tsc'\n )} binary doesn't seem to be installed at ${kleur.blue(\n tsc\n )}. Please specify the correct path in options or remove it to use the workspace's version.`\n );\n }\n } else {\n const execpath = process.env.npm_execpath;\n const cli = execpath?.split('/').pop()?.includes('yarn') ? 'yarn' : 'npm';\n\n try {\n if (cli === 'yarn') {\n const result = spawn.sync('yarn', ['bin', 'tsc'], {\n stdio: 'pipe',\n encoding: 'utf-8',\n cwd: root,\n });\n\n tsc = result.stdout.trim();\n } else {\n const result = spawn.sync('npm', ['bin'], {\n stdio: 'pipe',\n encoding: 'utf-8',\n cwd: root,\n });\n\n tsc = path.resolve(result.stdout.trim(), 'tsc');\n }\n } catch (e) {\n tsc = path.resolve(root, 'node_modules', '.bin', 'tsc');\n }\n\n if (platform() === 'win32' && !tsc.endsWith('.cmd')) {\n tsc += '.cmd';\n }\n }\n\n if (!(await fs.pathExists(tsc))) {\n try {\n tsc = await which('tsc');\n\n if (await fs.pathExists(tsc)) {\n report.warn(\n `Failed to locate 'tsc' in the workspace. Falling back to the globally installed version. Consider adding ${kleur.blue(\n 'typescript'\n )} to your ${kleur.blue(\n 'devDependencies'\n )} or specifying the ${kleur.blue(\n 'tsc'\n )} option for the typescript target.`\n );\n }\n } catch (e) {\n // Ignore\n }\n }\n\n if (tsc == null || !(await fs.pathExists(tsc))) {\n throw new Error(\n `The ${kleur.blue(\n 'tsc'\n )} binary doesn't seem to be installed under ${kleur.blue(\n 'node_modules'\n )} or present in $PATH. Make sure you have added ${kleur.blue(\n 'typescript'\n )} to your ${kleur.blue('devDependencies')} or specify the ${kleur.blue(\n 'tsc'\n )} option for typescript.`\n );\n }\n\n const tsbuildinfo = path.join(\n output,\n project.replace(/\\.json$/, '.tsbuildinfo')\n );\n\n try {\n await del([tsbuildinfo]);\n } catch (e) {\n // Ignore\n }\n\n const result = spawn.sync(\n tsc,\n [\n '--pretty',\n '--declaration',\n '--declarationMap',\n '--emitDeclarationOnly',\n '--project',\n project,\n '--outDir',\n output,\n ],\n {\n stdio: 'inherit',\n cwd: root,\n }\n );\n\n if (result.status === 0) {\n await del([tsbuildinfo]);\n\n report.success(\n `Wrote definition files to ${kleur.blue(path.relative(root, output))}`\n );\n\n const pkg = JSON.parse(\n await fs.readFile(path.join(root, 'package.json'), 'utf-8')\n );\n\n if ('types' in pkg) {\n if (!pkg.types.endsWith('.d.ts')) {\n report.error(\n `The ${kleur.blue('types')} field in ${kleur.blue(\n 'package.json'\n )} doesn't point to a definition file. Verify the path points to the correct file under ${kleur.blue(\n path.relative(root, output)\n )}.`\n );\n\n throw new Error(\"Found incorrect path in 'types' field.\");\n }\n\n const typesPath = path.join(root, pkg.types);\n\n if (!(await fs.pathExists(typesPath))) {\n report.error(\n `The ${kleur.blue('types')} field in ${kleur.blue(\n 'package.json'\n )} points to a non-existent file: ${kleur.blue(\n pkg.types\n )}.\\nVerify the path points to the correct file under ${kleur.blue(\n path.relative(root, output)\n )}.`\n );\n\n throw new Error(\"Found incorrect path in 'types' field.\");\n }\n } else {\n report.warn(\n `No ${kleur.blue('types')} field found in ${kleur.blue(\n 'package.json'\n )}.\\nConsider adding it so consumers can use the types.`\n );\n }\n } else {\n throw new Error('Failed to build definition files.');\n }\n } catch (e: unknown) {\n if (e != null && typeof e === 'object') {\n if ('stdout' in e && e.stdout != null) {\n report.error(\n `Errors found when building definition files:\\n${e.stdout.toString()}`\n );\n } else if ('message' in e && typeof e.message === 'string') {\n report.error(e.message);\n } else {\n throw e;\n }\n } else {\n throw e;\n }\n\n throw new Error('Failed to build definition files.');\n }\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAOe,eAAeA,KAAf,CAAqB;EAClCC,IADkC;EAElCC,MAFkC;EAGlCC,MAHkC;EAIlCC;AAJkC,CAArB,EAKH;EACVD,MAAM,CAACE,IAAP,CACG,iCAAgCC,cAAA,CAAMC,IAAN,CAAWC,aAAA,CAAKC,QAAL,CAAcR,IAAd,EAAoBC,MAApB,CAAX,CAAwC,EAD3E;EAIA,MAAM,IAAAQ,YAAA,EAAI,CAACR,MAAD,CAAJ,CAAN;EAEAC,MAAM,CAACE,IAAP,CAAa,oCAAmCC,cAAA,CAAMC,IAAN,CAAW,KAAX,CAAkB,EAAlE;EAEA,MAAMI,OAAO,GAAGP,OAAO,SAAP,IAAAA,OAAO,WAAP,IAAAA,OAAO,CAAEO,OAAT,GAAmBP,OAAO,CAACO,OAA3B,GAAqC,eAArD;;EACA,MAAMC,QAAQ,GAAGJ,aAAA,CAAKK,IAAL,CAAUZ,IAAV,EAA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;MAGD,CAJD,MAIO,IAAI,aAAahC,CAAb,IAAkB,OAAOA,CAAC,CAACiC,OAAT,KAAqB,QAA3C,EAAqD;QAC1DjE,MAAM,CAAC8D,KAAP,CAAa9B,CAAC,CAACiC,OAAf;MACD,CAFM,MAEA;QACL,MAAMjC,CAAN;MACD;IACF,CAVD,MAUO;MACL,MAAMA,CAAN;IACD;;IAED,MAAM,IAAIC,KAAJ,CAAU,mCAAV,CAAN;EACD;AACF"}
|
|
1
|
+
{"version":3,"file":"typescript.js","names":["_kleur","_interopRequireDefault","require","_path","_fsExtra","_which","_crossSpawn","_del","_json","_os","obj","__esModule","default","build","source","root","output","report","options","info","kleur","blue","path","relative","del","project","tsconfig","join","fs","pathExists","config","JSON5","parse","readFile","compilerOptions","conflicts","noEmit","undefined","push","emitDeclarationOnly","declarationDir","outDir","length","warn","reduce","acc","curr","gray","yellow","e","Error","tsc","resolve","execpath","process","env","npm_execpath","cli","split","pop","includes","result","spawn","sync","stdio","encoding","cwd","stdout","trim","platform","endsWith","which","tsbuildinfo","replace","status","success","pkg","JSON","getGeneratedTypesPath","indexDTsName","basename","potentialPaths","dirname","potentialPath","typesPath","types","generatedTypesPath","error","toString","message"],"sources":["../../src/targets/typescript.ts"],"sourcesContent":["import kleur from 'kleur';\nimport path from 'path';\nimport fs from 'fs-extra';\nimport which from 'which';\nimport spawn from 'cross-spawn';\nimport del from 'del';\nimport JSON5 from 'json5';\nimport { platform } from 'os';\nimport type { Input } from '../types';\n\ntype Options = Input & {\n options?: { project?: string; tsc?: string };\n};\n\nexport default async function build({\n source,\n root,\n output,\n report,\n options,\n}: Options) {\n report.info(\n `Cleaning up previous build at ${kleur.blue(path.relative(root, output))}`\n );\n\n await del([output]);\n\n report.info(`Generating type definitions with ${kleur.blue('tsc')}`);\n\n const project = options?.project ? options.project : 'tsconfig.json';\n const tsconfig = path.join(root, project);\n\n try {\n if (await fs.pathExists(tsconfig)) {\n try {\n const config = JSON5.parse(await fs.readFile(tsconfig, 'utf-8'));\n\n if (config.compilerOptions) {\n const conflicts: string[] = [];\n\n if (config.compilerOptions.noEmit !== undefined) {\n conflicts.push('compilerOptions.noEmit');\n }\n\n if (config.compilerOptions.emitDeclarationOnly !== undefined) {\n conflicts.push('compilerOptions.emitDeclarationOnly');\n }\n\n if (config.compilerOptions.declarationDir) {\n conflicts.push('compilerOptions.declarationDir');\n }\n\n if (\n config.compilerOptions.outDir &&\n path.join(root, config.compilerOptions.outDir) !== output\n ) {\n conflicts.push('compilerOptions.outDir');\n }\n\n if (conflicts.length) {\n report.warn(\n `Found following options in the config file which can conflict with the CLI options. Please remove them from ${kleur.blue(\n project\n )}:${conflicts.reduce(\n (acc, curr) =>\n acc + `\\n${kleur.gray('-')} ${kleur.yellow(curr)}`,\n ''\n )}`\n );\n }\n }\n } catch (e) {\n report.warn(\n `Couldn't parse '${project}'. There might be validation errors.`\n );\n }\n } else {\n throw new Error(\n `Couldn't find a ${kleur.blue('tsconfig.json')} in the project root.`\n );\n }\n\n let tsc;\n\n if (options?.tsc) {\n tsc = path.resolve(root, options.tsc);\n\n if (!(await fs.pathExists(tsc))) {\n throw new Error(\n `The ${kleur.blue(\n 'tsc'\n )} binary doesn't seem to be installed at ${kleur.blue(\n tsc\n )}. Please specify the correct path in options or remove it to use the workspace's version.`\n );\n }\n } else {\n const execpath = process.env.npm_execpath;\n const cli = execpath?.split('/').pop()?.includes('yarn') ? 'yarn' : 'npm';\n\n if (cli === 'yarn') {\n const result = spawn.sync('yarn', ['bin', 'tsc'], {\n stdio: 'pipe',\n encoding: 'utf-8',\n cwd: root,\n });\n\n tsc = result.stdout.trim();\n } else {\n tsc = path.resolve(root, 'node_modules', '.bin', 'tsc');\n }\n\n if (platform() === 'win32' && !tsc.endsWith('.cmd')) {\n tsc += '.cmd';\n }\n }\n\n if (!(await fs.pathExists(tsc))) {\n try {\n tsc = await which('tsc');\n\n if (await fs.pathExists(tsc)) {\n report.warn(\n `Failed to locate ${kleur.blue(\n 'tsc'\n )} in the workspace. Falling back to the binary found in ${kleur.blue(\n 'PATH'\n )} at ${kleur.blue(tsc)}. Consider adding ${kleur.blue(\n 'typescript'\n )} to your ${kleur.blue(\n 'devDependencies'\n )} or specifying the ${kleur.blue(\n 'tsc'\n )} option for the typescript target.`\n );\n }\n } catch (e) {\n // Ignore\n }\n }\n\n if (tsc == null || !(await fs.pathExists(tsc))) {\n throw new Error(\n `The ${kleur.blue(\n 'tsc'\n )} binary doesn't seem to be installed under ${kleur.blue(\n 'node_modules'\n )} or present in $PATH. Make sure you have added ${kleur.blue(\n 'typescript'\n )} to your ${kleur.blue('devDependencies')} or specify the ${kleur.blue(\n 'tsc'\n )} option for typescript.`\n );\n }\n\n const tsbuildinfo = path.join(\n output,\n project.replace(/\\.json$/, '.tsbuildinfo')\n );\n\n try {\n await del([tsbuildinfo]);\n } catch (e) {\n // Ignore\n }\n\n const result = spawn.sync(\n tsc,\n [\n '--pretty',\n '--declaration',\n '--declarationMap',\n '--emitDeclarationOnly',\n '--project',\n project,\n '--outDir',\n output,\n ],\n {\n stdio: 'inherit',\n cwd: root,\n }\n );\n\n if (result.status === 0) {\n await del([tsbuildinfo]);\n\n report.success(\n `Wrote definition files to ${kleur.blue(path.relative(root, output))}`\n );\n\n const pkg = JSON.parse(\n await fs.readFile(path.join(root, 'package.json'), 'utf-8')\n );\n\n const getGeneratedTypesPath = async () => {\n if (pkg.source) {\n const indexDTsName =\n path.basename(pkg.source).replace(/\\.(jsx?|tsx?)$/, '') + '.d.ts';\n\n const potentialPaths = [\n path.join(output, path.dirname(pkg.source), indexDTsName),\n path.join(\n output,\n path.dirname(path.relative(source, path.join(root, pkg.source))),\n indexDTsName\n ),\n ];\n\n for (const potentialPath of potentialPaths) {\n if (await fs.pathExists(potentialPath)) {\n return path.relative(root, potentialPath);\n }\n }\n }\n\n return null;\n };\n\n if ('types' in pkg) {\n const typesPath = path.join(root, pkg.types);\n\n if (!(await fs.pathExists(typesPath))) {\n const generatedTypesPath = await getGeneratedTypesPath();\n\n if (!generatedTypesPath) {\n report.warn(\n `Failed to detect the entry point for the generated types. Make sure you have a valid ${kleur.blue(\n 'source'\n )} field in your ${kleur.blue('package.json')}.`\n );\n }\n\n report.error(\n `The ${kleur.blue('types')} field in ${kleur.blue(\n 'package.json'\n )} points to a non-existent file: ${kleur.blue(\n pkg.types\n )}.\\nVerify the path points to the correct file under ${kleur.blue(\n path.relative(root, output)\n )}${\n generatedTypesPath\n ? ` (found ${kleur.blue(generatedTypesPath)}).`\n : '.'\n }`\n );\n\n throw new Error(\"Found incorrect path in 'types' field.\");\n }\n } else {\n const generatedTypesPath = await getGeneratedTypesPath();\n\n report.warn(\n `No ${kleur.blue('types')} field found in ${kleur.blue(\n 'package.json'\n )}.\\nConsider ${\n generatedTypesPath\n ? `pointing it to ${kleur.blue(generatedTypesPath)}`\n : 'adding it'\n } so that consumers of your package can use the types.`\n );\n }\n } else {\n throw new Error('Failed to build definition files.');\n }\n } catch (e: unknown) {\n if (e != null && typeof e === 'object') {\n if ('stdout' in e && e.stdout != null) {\n report.error(\n `Errors found when building definition files:\\n${e.stdout.toString()}`\n );\n } else if ('message' in e && typeof e.message === 'string') {\n report.error(e.message);\n } else {\n throw e;\n }\n } else {\n throw e;\n }\n\n throw new Error('Failed to build definition files.');\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,WAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,IAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,KAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,GAAA,GAAAP,OAAA;AAA8B,SAAAD,uBAAAS,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAA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AC,CAACwC,OAAO,CAAC;MACzB,CAAC,MAAM;QACL,MAAMxC,CAAC;MACT;IACF,CAAC,MAAM;MACL,MAAMA,CAAC;IACT;IAEA,MAAM,IAAIC,KAAK,CAAC,mCAAmC,CAAC;EACtD;AACF"}
|
package/lib/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["export type Log = (message: string) => void;\nexport type Report = {\n info: Log;\n warn: Log;\n success: Log;\n error: Log;\n};\n\nexport type Input = {\n root: string;\n source: string;\n output: string;\n report: Report;\n};\n\nexport type Target = '
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["export type Log = (message: string) => void;\nexport type Report = {\n info: Log;\n warn: Log;\n success: Log;\n error: Log;\n};\n\nexport type Input = {\n root: string;\n source: string;\n output: string;\n report: Report;\n};\n\nexport type Target = 'commonjs' | 'module' | 'typescript';\n\nexport type Options = {\n source?: string;\n output?: string;\n targets?: (Target | [Target, object])[];\n exclude?: string;\n};\n"],"mappings":""}
|
|
@@ -4,29 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = androidAssemble;
|
|
7
|
-
|
|
8
7
|
var _path = _interopRequireDefault(require("path"));
|
|
9
|
-
|
|
10
8
|
var _kleur = _interopRequireDefault(require("kleur"));
|
|
11
|
-
|
|
12
9
|
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
13
|
-
|
|
14
10
|
var _child_process = require("child_process");
|
|
15
|
-
|
|
16
11
|
var _os = require("os");
|
|
17
|
-
|
|
18
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
13
|
async function androidAssemble({
|
|
21
14
|
root,
|
|
22
15
|
androidPath,
|
|
23
16
|
report
|
|
24
17
|
}) {
|
|
25
18
|
const cwd = _path.default.relative(root, androidPath);
|
|
26
|
-
|
|
27
19
|
report.info(`Assembling Android project in ${_kleur.default.blue(cwd)} with ${_kleur.default.blue('gradle')}`);
|
|
28
20
|
const gradleWrapper = (0, _os.platform)() === 'win32' ? 'gradlew.bat' : './gradlew';
|
|
29
|
-
|
|
30
21
|
if (await _fsExtra.default.pathExists(_path.default.join(androidPath, gradleWrapper))) {
|
|
31
22
|
(0, _child_process.execFileSync)(gradleWrapper, ['assemble'], {
|
|
32
23
|
cwd: androidPath
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"androidAssemble.js","names":["androidAssemble","root","androidPath","report","cwd","path","relative","info","kleur","blue","gradleWrapper","platform","fs","pathExists","join","execFileSync","Error"],"sources":["../../src/utils/androidAssemble.ts"],"sourcesContent":["import path from 'path';\nimport kleur from 'kleur';\nimport fs from 'fs-extra';\nimport { execFileSync } from 'child_process';\nimport { platform } from 'os';\nimport type { Report } from '../types';\n\ntype Options = {\n root: string;\n androidPath: string;\n report: Report;\n};\n\nexport default async function androidAssemble({\n root,\n androidPath,\n report,\n}: Options) {\n const cwd = path.relative(root, androidPath);\n\n report.info(\n `Assembling Android project in ${kleur.blue(cwd)} with ${kleur.blue(\n 'gradle'\n )}`\n );\n\n const gradleWrapper = platform() === 'win32' ? 'gradlew.bat' : './gradlew';\n if (await fs.pathExists(path.join(androidPath, gradleWrapper))) {\n execFileSync(gradleWrapper, ['assemble'], { cwd: androidPath });\n } else {\n throw new Error(\n `The ${kleur.blue(\n 'gradlew'\n )} script doesn't seem to present in ${kleur.blue(\n androidPath\n )}. Make sure you have added it by running ${kleur.blue(\n 'gradle wrapper'\n )} in that directory.`\n );\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"androidAssemble.js","names":["_path","_interopRequireDefault","require","_kleur","_fsExtra","_child_process","_os","obj","__esModule","default","androidAssemble","root","androidPath","report","cwd","path","relative","info","kleur","blue","gradleWrapper","platform","fs","pathExists","join","execFileSync","Error"],"sources":["../../src/utils/androidAssemble.ts"],"sourcesContent":["import path from 'path';\nimport kleur from 'kleur';\nimport fs from 'fs-extra';\nimport { execFileSync } from 'child_process';\nimport { platform } from 'os';\nimport type { Report } from '../types';\n\ntype Options = {\n root: string;\n androidPath: string;\n report: Report;\n};\n\nexport default async function androidAssemble({\n root,\n androidPath,\n report,\n}: Options) {\n const cwd = path.relative(root, androidPath);\n\n report.info(\n `Assembling Android project in ${kleur.blue(cwd)} with ${kleur.blue(\n 'gradle'\n )}`\n );\n\n const gradleWrapper = platform() === 'win32' ? 'gradlew.bat' : './gradlew';\n if (await fs.pathExists(path.join(androidPath, gradleWrapper))) {\n execFileSync(gradleWrapper, ['assemble'], { cwd: androidPath });\n } else {\n throw new Error(\n `The ${kleur.blue(\n 'gradlew'\n )} script doesn't seem to present in ${kleur.blue(\n androidPath\n )}. Make sure you have added it by running ${kleur.blue(\n 'gradle wrapper'\n )} in that directory.`\n );\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,GAAA,GAAAJ,OAAA;AAA8B,SAAAD,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AASf,eAAeG,eAAeA,CAAC;EAC5CC,IAAI;EACJC,WAAW;EACXC;AACO,CAAC,EAAE;EACV,MAAMC,GAAG,GAAGC,aAAI,CAACC,QAAQ,CAACL,IAAI,EAAEC,WAAW,CAAC;EAE5CC,MAAM,CAACI,IAAI,CACR,iCAAgCC,cAAK,CAACC,IAAI,CAACL,GAAG,CAAE,SAAQI,cAAK,CAACC,IAAI,CACjE,QACF,CAAE,EACJ,CAAC;EAED,MAAMC,aAAa,GAAG,IAAAC,YAAQ,EAAC,CAAC,KAAK,OAAO,GAAG,aAAa,GAAG,WAAW;EAC1E,IAAI,MAAMC,gBAAE,CAACC,UAAU,CAACR,aAAI,CAACS,IAAI,CAACZ,WAAW,EAAEQ,aAAa,CAAC,CAAC,EAAE;IAC9D,IAAAK,2BAAY,EAACL,aAAa,EAAE,CAAC,UAAU,CAAC,EAAE;MAAEN,GAAG,EAAEF;IAAY,CAAC,CAAC;EACjE,CAAC,MAAM;IACL,MAAM,IAAIc,KAAK,CACZ,OAAMR,cAAK,CAACC,IAAI,CACf,SACF,CAAE,sCAAqCD,cAAK,CAACC,IAAI,CAC/CP,WACF,CAAE,4CAA2CM,cAAK,CAACC,IAAI,CACrD,gBACF,CAAE,qBACJ,CAAC;EACH;AACF"}
|
package/lib/utils/compile.js
CHANGED
|
@@ -4,31 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = compile;
|
|
7
|
-
|
|
8
7
|
var _path = _interopRequireDefault(require("path"));
|
|
9
|
-
|
|
10
8
|
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
11
|
-
|
|
12
9
|
var _kleur = _interopRequireDefault(require("kleur"));
|
|
13
|
-
|
|
14
10
|
var babel = _interopRequireWildcard(require("@babel/core"));
|
|
15
|
-
|
|
16
11
|
var _browserslist = _interopRequireDefault(require("browserslist"));
|
|
17
|
-
|
|
18
12
|
var _glob = _interopRequireDefault(require("glob"));
|
|
19
|
-
|
|
20
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
-
|
|
22
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
-
|
|
24
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
|
|
26
16
|
async function compile({
|
|
27
17
|
root,
|
|
28
18
|
source,
|
|
29
19
|
output,
|
|
30
20
|
babelrc = false,
|
|
31
21
|
configFile = false,
|
|
22
|
+
exclude,
|
|
32
23
|
modules,
|
|
33
24
|
copyFlow,
|
|
34
25
|
sourceMaps = true,
|
|
@@ -39,30 +30,23 @@ async function compile({
|
|
|
39
30
|
cwd: source,
|
|
40
31
|
absolute: true,
|
|
41
32
|
nodir: true,
|
|
42
|
-
ignore:
|
|
33
|
+
ignore: exclude
|
|
43
34
|
});
|
|
44
|
-
|
|
45
35
|
report.info(`Compiling ${_kleur.default.blue(String(files.length))} files in ${_kleur.default.blue(_path.default.relative(root, source))} with ${_kleur.default.blue('babel')}`);
|
|
46
36
|
const pkg = JSON.parse(await _fsExtra.default.readFile(_path.default.join(root, 'package.json'), 'utf-8'));
|
|
47
|
-
|
|
48
37
|
if (copyFlow) {
|
|
49
38
|
if (!Object.keys(pkg.devDependencies || {}).includes('flow-bin')) {
|
|
50
39
|
report.warn(`The ${_kleur.default.blue('copyFlow')} option was specified, but couldn't find ${_kleur.default.blue('flow-bin')} in ${_kleur.default.blue('package.json')}.\nIf the project is using ${_kleur.default.blue('flow')}, then make sure you have added ${_kleur.default.blue('flow-bin')} to your ${_kleur.default.blue('devDependencies')}, otherwise remove the ${_kleur.default.blue('copyFlow')} option.`);
|
|
51
40
|
}
|
|
52
41
|
}
|
|
53
|
-
|
|
54
42
|
await Promise.all(files.map(async filepath => {
|
|
55
43
|
const outputFilename = _path.default.join(output, _path.default.relative(source, filepath)).replace(/\.(jsx?|tsx?)$/, '.js');
|
|
56
|
-
|
|
57
44
|
await _fsExtra.default.mkdirp(_path.default.dirname(outputFilename));
|
|
58
|
-
|
|
59
45
|
if (!/\.(jsx?|tsx?)$/.test(filepath)) {
|
|
60
46
|
// Copy files which aren't source code
|
|
61
47
|
_fsExtra.default.copy(filepath, outputFilename);
|
|
62
|
-
|
|
63
48
|
return;
|
|
64
49
|
}
|
|
65
|
-
|
|
66
50
|
const content = await _fsExtra.default.readFile(filepath, 'utf-8');
|
|
67
51
|
const result = await babel.transformAsync(content, {
|
|
68
52
|
cwd: root,
|
|
@@ -76,50 +60,58 @@ async function compile({
|
|
|
76
60
|
presets: [[require.resolve('@babel/preset-env'), {
|
|
77
61
|
targets: _browserslist.default.findConfig(root) ?? {
|
|
78
62
|
browsers: ['>1%', 'last 2 chrome versions', 'last 2 edge versions', 'last 2 firefox versions', 'last 2 safari versions', 'not dead', 'not ie <= 11', 'not op_mini all', 'not android <= 4.4', 'not samsung <= 4'],
|
|
79
|
-
node: '
|
|
63
|
+
node: '18'
|
|
80
64
|
},
|
|
81
65
|
useBuiltIns: false,
|
|
82
66
|
modules
|
|
83
67
|
}], require.resolve('@babel/preset-react'), require.resolve('@babel/preset-typescript'), require.resolve('@babel/preset-flow')]
|
|
84
68
|
})
|
|
85
69
|
});
|
|
86
|
-
|
|
87
70
|
if (result == null) {
|
|
88
71
|
throw new Error('Output code was null');
|
|
89
72
|
}
|
|
90
|
-
|
|
91
73
|
let code = result.code;
|
|
92
|
-
|
|
93
74
|
if (sourceMaps && result.map) {
|
|
94
75
|
const mapFilename = outputFilename + '.map';
|
|
95
|
-
code += '\n//# sourceMappingURL=' + _path.default.basename(mapFilename);
|
|
76
|
+
code += '\n//# sourceMappingURL=' + _path.default.basename(mapFilename);
|
|
96
77
|
|
|
78
|
+
// Don't inline the source code, it can be retrieved from the source file
|
|
97
79
|
result.map.sourcesContent = undefined;
|
|
98
|
-
|
|
99
|
-
_fsExtra.default.writeFileSync(mapFilename, JSON.stringify(result.map));
|
|
80
|
+
await _fsExtra.default.writeJSON(mapFilename, result.map);
|
|
100
81
|
}
|
|
101
|
-
|
|
102
82
|
await _fsExtra.default.writeFile(outputFilename, code);
|
|
103
|
-
|
|
104
83
|
if (copyFlow) {
|
|
105
84
|
_fsExtra.default.copy(filepath, outputFilename + '.flow');
|
|
106
85
|
}
|
|
107
86
|
}));
|
|
108
87
|
report.success(`Wrote files to ${_kleur.default.blue(_path.default.relative(root, output))}`);
|
|
109
|
-
|
|
88
|
+
const getGeneratedEntryPath = async () => {
|
|
89
|
+
if (pkg.source) {
|
|
90
|
+
const indexName = _path.default.basename(pkg.source).replace(/\.(jsx?|tsx?)$/, '') + '.js';
|
|
91
|
+
const potentialPath = _path.default.join(output, _path.default.dirname(_path.default.relative(source, _path.default.join(root, pkg.source))), indexName);
|
|
92
|
+
if (await _fsExtra.default.pathExists(potentialPath)) {
|
|
93
|
+
return _path.default.relative(root, potentialPath);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
};
|
|
110
98
|
if (field in pkg) {
|
|
111
99
|
try {
|
|
112
100
|
require.resolve(_path.default.join(root, pkg[field]));
|
|
113
101
|
} catch (e) {
|
|
114
102
|
if (e != null && typeof e === 'object' && 'code' in e && e.code === 'MODULE_NOT_FOUND') {
|
|
115
|
-
|
|
103
|
+
const generatedEntryPath = await getGeneratedEntryPath();
|
|
104
|
+
if (!generatedEntryPath) {
|
|
105
|
+
report.warn(`Failed to detect the entry point for the generated files. Make sure you have a valid ${_kleur.default.blue('source')} field in your ${_kleur.default.blue('package.json')}.`);
|
|
106
|
+
}
|
|
107
|
+
report.error(`The ${_kleur.default.blue(field)} field in ${_kleur.default.blue('package.json')} points to a non-existent file: ${_kleur.default.blue(pkg[field])}.\nVerify the path points to the correct file under ${_kleur.default.blue(_path.default.relative(root, output))}${generatedEntryPath ? ` (found ${_kleur.default.blue(generatedEntryPath)}).` : '.'}`);
|
|
116
108
|
throw new Error(`Found incorrect path in '${field}' field.`);
|
|
117
109
|
}
|
|
118
|
-
|
|
119
110
|
throw e;
|
|
120
111
|
}
|
|
121
112
|
} else {
|
|
122
|
-
|
|
113
|
+
const generatedEntryPath = await getGeneratedEntryPath();
|
|
114
|
+
report.warn(`No ${_kleur.default.blue(field)} field found in ${_kleur.default.blue('package.json')}. Consider ${generatedEntryPath ? `pointing it to ${_kleur.default.blue(generatedEntryPath)}` : 'adding it'} so that consumers of your package can use it.`);
|
|
123
115
|
}
|
|
124
116
|
}
|
|
125
117
|
//# sourceMappingURL=compile.js.map
|
package/lib/utils/compile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.js","names":["compile","root","source","output","babelrc","configFile","modules","copyFlow","sourceMaps","report","field","files","glob","sync","cwd","absolute","nodir","ignore","info","kleur","blue","String","length","path","relative","pkg","JSON","parse","fs","readFile","join","Object","keys","devDependencies","includes","warn","Promise","all","map","filepath","outputFilename","replace","mkdirp","dirname","test","copy","content","result","babel","transformAsync","sourceRoot","sourceFileName","filename","presets","require","resolve","targets","browserslist","findConfig","browsers","node","useBuiltIns","Error","code","mapFilename","basename","sourcesContent","undefined","writeFileSync","stringify","writeFile","success","e","error"],"sources":["../../src/utils/compile.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs-extra';\nimport kleur from 'kleur';\nimport * as babel from '@babel/core';\nimport browserslist from 'browserslist';\nimport glob from 'glob';\nimport type { Input } from '../types';\n\ntype Options = Input & {\n babelrc?: boolean | null;\n configFile?: string | false | null;\n sourceMaps?: boolean;\n copyFlow?: boolean;\n modules: 'commonjs' | false;\n field: 'main' | 'module';\n};\n\nexport default async function compile({\n root,\n source,\n output,\n babelrc = false,\n configFile = false,\n modules,\n copyFlow,\n sourceMaps = true,\n report,\n field,\n}: Options) {\n const files = glob.sync('**/*', {\n cwd: source,\n absolute: true,\n nodir: true,\n ignore: '**/{__tests__,__fixtures__,__mocks__}/**',\n });\n\n report.info(\n `Compiling ${kleur.blue(String(files.length))} files in ${kleur.blue(\n path.relative(root, source)\n )} with ${kleur.blue('babel')}`\n );\n\n const pkg = JSON.parse(\n await fs.readFile(path.join(root, 'package.json'), 'utf-8')\n );\n\n if (copyFlow) {\n if (!Object.keys(pkg.devDependencies || {}).includes('flow-bin')) {\n report.warn(\n `The ${kleur.blue(\n 'copyFlow'\n )} option was specified, but couldn't find ${kleur.blue(\n 'flow-bin'\n )} in ${kleur.blue(\n 'package.json'\n )}.\\nIf the project is using ${kleur.blue(\n 'flow'\n )}, then make sure you have added ${kleur.blue(\n 'flow-bin'\n )} to your ${kleur.blue(\n 'devDependencies'\n )}, otherwise remove the ${kleur.blue('copyFlow')} option.`\n );\n }\n }\n\n await Promise.all(\n files.map(async (filepath) => {\n const outputFilename = path\n .join(output, path.relative(source, filepath))\n .replace(/\\.(jsx?|tsx?)$/, '.js');\n\n await fs.mkdirp(path.dirname(outputFilename));\n\n if (!/\\.(jsx?|tsx?)$/.test(filepath)) {\n // Copy files which aren't source code\n fs.copy(filepath, outputFilename);\n return;\n }\n\n const content = await fs.readFile(filepath, 'utf-8');\n const result = await babel.transformAsync(content, {\n cwd: root,\n babelrc: babelrc,\n configFile: configFile,\n sourceMaps,\n sourceRoot: path.relative(path.dirname(outputFilename), source),\n sourceFileName: path.relative(source, filepath),\n filename: filepath,\n ...(babelrc || configFile\n ? null\n : {\n presets: [\n [\n require.resolve('@babel/preset-env'),\n {\n targets: browserslist.findConfig(root) ?? {\n browsers: [\n '>1%',\n 'last 2 chrome versions',\n 'last 2 edge versions',\n 'last 2 firefox versions',\n 'last 2 safari versions',\n 'not dead',\n 'not ie <= 11',\n 'not op_mini all',\n 'not android <= 4.4',\n 'not samsung <= 4',\n ],\n node: '16',\n },\n useBuiltIns: false,\n modules,\n },\n ],\n require.resolve('@babel/preset-react'),\n require.resolve('@babel/preset-typescript'),\n require.resolve('@babel/preset-flow'),\n ],\n }),\n });\n\n if (result == null) {\n throw new Error('Output code was null');\n }\n\n let code = result.code;\n\n if (sourceMaps && result.map) {\n const mapFilename = outputFilename + '.map';\n\n code += '\\n//# sourceMappingURL=' + path.basename(mapFilename);\n\n // Don't inline the source code, it can be retrieved from the source file\n result.map.sourcesContent = undefined;\n\n fs.writeFileSync(mapFilename, JSON.stringify(result.map));\n }\n\n await fs.writeFile(outputFilename, code);\n\n if (copyFlow) {\n fs.copy(filepath, outputFilename + '.flow');\n }\n })\n );\n\n report.success(`Wrote files to ${kleur.blue(path.relative(root, output))}`);\n\n if (field in pkg) {\n try {\n require.resolve(path.join(root, pkg[field]));\n } catch (e: unknown) {\n if (\n e != null &&\n typeof e === 'object' &&\n 'code' in e &&\n e.code === 'MODULE_NOT_FOUND'\n ) {\n report.error(\n `The ${kleur.blue(field)} field in ${kleur.blue(\n 'package.json'\n )} points to a non-existent file: ${kleur.blue(\n pkg[field]\n )}.\\nVerify the path points to the correct file under ${kleur.blue(\n path.relative(root, output)\n )}.`\n );\n\n throw new Error(`Found incorrect path in '${field}' field.`);\n }\n\n throw e;\n }\n } else {\n report.warn(\n `No ${kleur.blue(field)} field found in ${kleur.blue(\n 'package.json'\n )}. Add it to your ${kleur.blue(\n 'package.json'\n )} so that consumers of your package can use it.`\n );\n }\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAYe,eAAeA,OAAf,CAAuB;EACpCC,IADoC;EAEpCC,MAFoC;EAGpCC,MAHoC;EAIpCC,OAAO,GAAG,KAJ0B;EAKpCC,UAAU,GAAG,KALuB;EAMpCC,OANoC;EAOpCC,QAPoC;EAQpCC,UAAU,GAAG,IARuB;EASpCC,MAToC;EAUpCC;AAVoC,CAAvB,EAWH;EACV,MAAMC,KAAK,GAAGC,aAAA,CAAKC,IAA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;IACD,CAFD,CAEE,OAAO8D,CAAP,EAAmB;MACnB,IACEA,CAAC,IAAI,IAAL,IACA,OAAOA,CAAP,KAAa,QADb,IAEA,UAAUA,CAFV,IAGAA,CAAC,CAACT,IAAF,KAAW,kBAJb,EAKE;QACAtD,MAAM,CAACgE,KAAP,CACG,OAAMtD,cAAA,CAAMC,IAAN,CAAWV,KAAX,CAAkB,aAAYS,cAAA,CAAMC,IAAN,CACnC,cADmC,CAEnC,mCAAkCD,cAAA,CAAMC,IAAN,CAClCK,GAAG,CAACf,KAAD,CAD+B,CAElC,uDAAsDS,cAAA,CAAMC,IAAN,CACtDG,aAAA,CAAKC,QAAL,CAAcvB,IAAd,EAAoBE,MAApB,CADsD,CAEtD,GAPJ;QAUA,MAAM,IAAI2D,KAAJ,CAAW,4BAA2BpD,KAAM,UAA5C,CAAN;MACD;;MAED,MAAM8D,CAAN;IACD;EACF,CAzBD,MAyBO;IACL/D,MAAM,CAAC0B,IAAP,CACG,MAAKhB,cAAA,CAAMC,IAAN,CAAWV,KAAX,CAAkB,mBAAkBS,cAAA,CAAMC,IAAN,CACxC,cADwC,CAExC,oBAAmBD,cAAA,CAAMC,IAAN,CACnB,cADmB,CAEnB,gDALJ;EAOD;AACF"}
|
|
1
|
+
{"version":3,"file":"compile.js","names":["_path","_interopRequireDefault","require","_fsExtra","_kleur","babel","_interopRequireWildcard","_browserslist","_glob","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","compile","root","source","output","babelrc","configFile","exclude","modules","copyFlow","sourceMaps","report","field","files","glob","sync","cwd","absolute","nodir","ignore","info","kleur","blue","String","length","path","relative","pkg","JSON","parse","fs","readFile","join","keys","devDependencies","includes","warn","Promise","all","map","filepath","outputFilename","replace","mkdirp","dirname","test","copy","content","result","transformAsync","sourceRoot","sourceFileName","filename","presets","resolve","targets","browserslist","findConfig","browsers","node","useBuiltIns","Error","code","mapFilename","basename","sourcesContent","undefined","writeJSON","writeFile","success","getGeneratedEntryPath","indexName","potentialPath","pathExists","e","generatedEntryPath","error"],"sources":["../../src/utils/compile.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs-extra';\nimport kleur from 'kleur';\nimport * as babel from '@babel/core';\nimport browserslist from 'browserslist';\nimport glob from 'glob';\nimport type { Input } from '../types';\n\ntype Options = Input & {\n babelrc?: boolean | null;\n configFile?: string | false | null;\n sourceMaps?: boolean;\n copyFlow?: boolean;\n modules: 'commonjs' | false;\n field: 'main' | 'module';\n exclude: string;\n};\n\nexport default async function compile({\n root,\n source,\n output,\n babelrc = false,\n configFile = false,\n exclude,\n modules,\n copyFlow,\n sourceMaps = true,\n report,\n field,\n}: Options) {\n const files = glob.sync('**/*', {\n cwd: source,\n absolute: true,\n nodir: true,\n ignore: exclude,\n });\n\n report.info(\n `Compiling ${kleur.blue(String(files.length))} files in ${kleur.blue(\n path.relative(root, source)\n )} with ${kleur.blue('babel')}`\n );\n\n const pkg = JSON.parse(\n await fs.readFile(path.join(root, 'package.json'), 'utf-8')\n );\n\n if (copyFlow) {\n if (!Object.keys(pkg.devDependencies || {}).includes('flow-bin')) {\n report.warn(\n `The ${kleur.blue(\n 'copyFlow'\n )} option was specified, but couldn't find ${kleur.blue(\n 'flow-bin'\n )} in ${kleur.blue(\n 'package.json'\n )}.\\nIf the project is using ${kleur.blue(\n 'flow'\n )}, then make sure you have added ${kleur.blue(\n 'flow-bin'\n )} to your ${kleur.blue(\n 'devDependencies'\n )}, otherwise remove the ${kleur.blue('copyFlow')} option.`\n );\n }\n }\n\n await Promise.all(\n files.map(async (filepath) => {\n const outputFilename = path\n .join(output, path.relative(source, filepath))\n .replace(/\\.(jsx?|tsx?)$/, '.js');\n\n await fs.mkdirp(path.dirname(outputFilename));\n\n if (!/\\.(jsx?|tsx?)$/.test(filepath)) {\n // Copy files which aren't source code\n fs.copy(filepath, outputFilename);\n return;\n }\n\n const content = await fs.readFile(filepath, 'utf-8');\n const result = await babel.transformAsync(content, {\n cwd: root,\n babelrc: babelrc,\n configFile: configFile,\n sourceMaps,\n sourceRoot: path.relative(path.dirname(outputFilename), source),\n sourceFileName: path.relative(source, filepath),\n filename: filepath,\n ...(babelrc || configFile\n ? null\n : {\n presets: [\n [\n require.resolve('@babel/preset-env'),\n {\n targets: browserslist.findConfig(root) ?? {\n browsers: [\n '>1%',\n 'last 2 chrome versions',\n 'last 2 edge versions',\n 'last 2 firefox versions',\n 'last 2 safari versions',\n 'not dead',\n 'not ie <= 11',\n 'not op_mini all',\n 'not android <= 4.4',\n 'not samsung <= 4',\n ],\n node: '18',\n },\n useBuiltIns: false,\n modules,\n },\n ],\n require.resolve('@babel/preset-react'),\n require.resolve('@babel/preset-typescript'),\n require.resolve('@babel/preset-flow'),\n ],\n }),\n });\n\n if (result == null) {\n throw new Error('Output code was null');\n }\n\n let code = result.code;\n\n if (sourceMaps && result.map) {\n const mapFilename = outputFilename + '.map';\n\n code += '\\n//# sourceMappingURL=' + path.basename(mapFilename);\n\n // Don't inline the source code, it can be retrieved from the source file\n result.map.sourcesContent = undefined;\n\n await fs.writeJSON(mapFilename, result.map);\n }\n\n await fs.writeFile(outputFilename, code);\n\n if (copyFlow) {\n fs.copy(filepath, outputFilename + '.flow');\n }\n })\n );\n\n report.success(`Wrote files to ${kleur.blue(path.relative(root, output))}`);\n\n const getGeneratedEntryPath = async () => {\n if (pkg.source) {\n const indexName =\n path.basename(pkg.source).replace(/\\.(jsx?|tsx?)$/, '') + '.js';\n\n const potentialPath = path.join(\n output,\n path.dirname(path.relative(source, path.join(root, pkg.source))),\n indexName\n );\n\n if (await fs.pathExists(potentialPath)) {\n return path.relative(root, potentialPath);\n }\n }\n\n return null;\n };\n\n if (field in pkg) {\n try {\n require.resolve(path.join(root, pkg[field]));\n } catch (e: unknown) {\n if (\n e != null &&\n typeof e === 'object' &&\n 'code' in e &&\n e.code === 'MODULE_NOT_FOUND'\n ) {\n const generatedEntryPath = await getGeneratedEntryPath();\n\n if (!generatedEntryPath) {\n report.warn(\n `Failed to detect the entry point for the generated files. Make sure you have a valid ${kleur.blue(\n 'source'\n )} field in your ${kleur.blue('package.json')}.`\n );\n }\n\n report.error(\n `The ${kleur.blue(field)} field in ${kleur.blue(\n 'package.json'\n )} points to a non-existent file: ${kleur.blue(\n pkg[field]\n )}.\\nVerify the path points to the correct file under ${kleur.blue(\n path.relative(root, output)\n )}${\n generatedEntryPath\n ? ` (found ${kleur.blue(generatedEntryPath)}).`\n : '.'\n }`\n );\n\n throw new Error(`Found incorrect path in '${field}' field.`);\n }\n\n throw e;\n }\n } else {\n const generatedEntryPath = await getGeneratedEntryPath();\n\n report.warn(\n `No ${kleur.blue(field)} field found in ${kleur.blue(\n 'package.json'\n )}. Consider ${\n generatedEntryPath\n ? `pointing it to ${kleur.blue(generatedEntryPath)}`\n : 'adding it'\n } so that consumers of your package can use it.`\n );\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,KAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,KAAA,GAAAP,sBAAA,CAAAC,OAAA;AAAwB,SAAAO,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAJ,wBAAAQ,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA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AAS,CAAC;MAC9D;MAEA,MAAM8D,CAAC;IACT;EACF,CAAC,MAAM;IACL,MAAMC,kBAAkB,GAAG,MAAML,qBAAqB,CAAC,CAAC;IAExD3D,MAAM,CAACyB,IAAI,CACR,MAAKf,cAAK,CAACC,IAAI,CAACV,KAAK,CAAE,mBAAkBS,cAAK,CAACC,IAAI,CAClD,cACF,CAAE,cACAqD,kBAAkB,GACb,kBAAiBtD,cAAK,CAACC,IAAI,CAACqD,kBAAkB,CAAE,EAAC,GAClD,WACL,gDACH,CAAC;EACH;AACF"}
|
package/lib/utils/logger.js
CHANGED
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.warn = exports.success = exports.info = exports.exit = exports.error = void 0;
|
|
7
|
-
|
|
8
7
|
var _kleur = _interopRequireDefault(require("kleur"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
9
|
const logger = (type, color) => (...messages) => {
|
|
13
10
|
console.log(color(_kleur.default.bold(type)), ...messages.map(message => {
|
|
14
11
|
if (typeof message === 'string') {
|
|
@@ -18,7 +15,6 @@ const logger = (type, color) => (...messages) => {
|
|
|
18
15
|
}
|
|
19
16
|
}));
|
|
20
17
|
};
|
|
21
|
-
|
|
22
18
|
const info = logger('ℹ', _kleur.default.blue);
|
|
23
19
|
exports.info = info;
|
|
24
20
|
const warn = logger('⚠', _kleur.default.yellow);
|
|
@@ -27,11 +23,9 @@ const error = logger('✖', _kleur.default.red);
|
|
|
27
23
|
exports.error = error;
|
|
28
24
|
const success = logger('✔', _kleur.default.green);
|
|
29
25
|
exports.success = success;
|
|
30
|
-
|
|
31
26
|
const exit = (...messages) => {
|
|
32
27
|
error(...messages);
|
|
33
28
|
process.exit(1);
|
|
34
29
|
};
|
|
35
|
-
|
|
36
30
|
exports.exit = exit;
|
|
37
31
|
//# sourceMappingURL=logger.js.map
|
package/lib/utils/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","names":["logger","type","color","messages","console","log","kleur","bold","map","message","split","join","info","blue","warn","yellow","error","red","success","green","exit","process"],"sources":["../../src/utils/logger.ts"],"sourcesContent":["import kleur from 'kleur';\n\nconst logger =\n (type: string, color: Function) =>\n (...messages: unknown[]) => {\n console.log(\n color(kleur.bold(type)),\n ...messages.map((message) => {\n if (typeof message === 'string') {\n return message.split('\\n').join(`\\n `);\n } else {\n return message;\n }\n })\n );\n };\n\nexport const info = logger('ℹ', kleur.blue);\nexport const warn = logger('⚠', kleur.yellow);\nexport const error = logger('✖', kleur.red);\nexport const success = logger('✔', kleur.green);\n\nexport const exit = (...messages: unknown[]) => {\n error(...messages);\n process.exit(1);\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.js","names":["_kleur","_interopRequireDefault","require","obj","__esModule","default","logger","type","color","messages","console","log","kleur","bold","map","message","split","join","info","blue","exports","warn","yellow","error","red","success","green","exit","process"],"sources":["../../src/utils/logger.ts"],"sourcesContent":["import kleur from 'kleur';\n\nconst logger =\n (type: string, color: Function) =>\n (...messages: unknown[]) => {\n console.log(\n color(kleur.bold(type)),\n ...messages.map((message) => {\n if (typeof message === 'string') {\n return message.split('\\n').join(`\\n `);\n } else {\n return message;\n }\n })\n );\n };\n\nexport const info = logger('ℹ', kleur.blue);\nexport const warn = logger('⚠', kleur.yellow);\nexport const error = logger('✖', kleur.red);\nexport const success = logger('✔', kleur.green);\n\nexport const exit = (...messages: unknown[]) => {\n error(...messages);\n process.exit(1);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA0B,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE1B,MAAMG,MAAM,GACVA,CAACC,IAAY,EAAEC,KAAe,KAC9B,CAAC,GAAGC,QAAmB,KAAK;EAC1BC,OAAO,CAACC,GAAG,CACTH,KAAK,CAACI,cAAK,CAACC,IAAI,CAACN,IAAI,CAAC,CAAC,EACvB,GAAGE,QAAQ,CAACK,GAAG,CAAEC,OAAO,IAAK;IAC3B,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;MAC/B,OAAOA,OAAO,CAACC,KAAK,CAAC,IAAI,CAAC,CAACC,IAAI,CAAE,MAAK,CAAC;IACzC,CAAC,MAAM;MACL,OAAOF,OAAO;IAChB;EACF,CAAC,CACH,CAAC;AACH,CAAC;AAEI,MAAMG,IAAI,GAAGZ,MAAM,CAAC,GAAG,EAAEM,cAAK,CAACO,IAAI,CAAC;AAACC,OAAA,CAAAF,IAAA,GAAAA,IAAA;AACrC,MAAMG,IAAI,GAAGf,MAAM,CAAC,GAAG,EAAEM,cAAK,CAACU,MAAM,CAAC;AAACF,OAAA,CAAAC,IAAA,GAAAA,IAAA;AACvC,MAAME,KAAK,GAAGjB,MAAM,CAAC,GAAG,EAAEM,cAAK,CAACY,GAAG,CAAC;AAACJ,OAAA,CAAAG,KAAA,GAAAA,KAAA;AACrC,MAAME,OAAO,GAAGnB,MAAM,CAAC,GAAG,EAAEM,cAAK,CAACc,KAAK,CAAC;AAACN,OAAA,CAAAK,OAAA,GAAAA,OAAA;AAEzC,MAAME,IAAI,GAAGA,CAAC,GAAGlB,QAAmB,KAAK;EAC9Cc,KAAK,CAAC,GAAGd,QAAQ,CAAC;EAClBmB,OAAO,CAACD,IAAI,CAAC,CAAC,CAAC;AACjB,CAAC;AAACP,OAAA,CAAAO,IAAA,GAAAA,IAAA"}
|
package/lib/utils/prompts.js
CHANGED
|
@@ -4,17 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = prompts;
|
|
7
|
-
|
|
8
7
|
var _prompts = _interopRequireDefault(require("prompts"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
9
|
function prompts(args, options) {
|
|
13
10
|
return (0, _prompts.default)(args, {
|
|
14
11
|
onCancel() {
|
|
15
12
|
process.exit(1);
|
|
16
13
|
},
|
|
17
|
-
|
|
18
14
|
...options
|
|
19
15
|
});
|
|
20
16
|
}
|
package/lib/utils/prompts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.js","names":["prompts","args","options","promptsModule","onCancel","process","exit"],"sources":["../../src/utils/prompts.ts"],"sourcesContent":["import promptsModule from 'prompts';\n\nexport default function prompts(\n args: promptsModule.PromptObject | promptsModule.PromptObject[],\n options?: promptsModule.Options\n) {\n return promptsModule(args, {\n onCancel() {\n process.exit(1);\n },\n ...options,\n });\n}\n\nexport type PromptObject<T extends string = string> =\n promptsModule.PromptObject<T>;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"prompts.js","names":["_prompts","_interopRequireDefault","require","obj","__esModule","default","prompts","args","options","promptsModule","onCancel","process","exit"],"sources":["../../src/utils/prompts.ts"],"sourcesContent":["import promptsModule from 'prompts';\n\nexport default function prompts(\n args: promptsModule.PromptObject | promptsModule.PromptObject[],\n options?: promptsModule.Options\n) {\n return promptsModule(args, {\n onCancel() {\n process.exit(1);\n },\n ...options,\n });\n}\n\nexport type PromptObject<T extends string = string> =\n promptsModule.PromptObject<T>;\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAErB,SAASG,OAAOA,CAC7BC,IAA+D,EAC/DC,OAA+B,EAC/B;EACA,OAAO,IAAAC,gBAAa,EAACF,IAAI,EAAE;IACzBG,QAAQA,CAAA,EAAG;MACTC,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC;IACjB,CAAC;IACD,GAAGJ;EACL,CAAC,CAAC;AACJ"}
|