react-native-builder-bob 0.28.0 → 0.29.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/babel-config.js +22 -13
- package/babel-preset.js +9 -5
- package/lib/__fixtures__/project/code/$alias-input.js.map +1 -1
- package/lib/__fixtures__/project/code/$alias-output.js.map +1 -1
- package/lib/__fixtures__/project/code/$exports-input.js +4 -6
- package/lib/__fixtures__/project/code/$exports-input.js.map +1 -1
- package/lib/__fixtures__/project/code/$exports-output.js +4 -6
- package/lib/__fixtures__/project/code/$exports-output.js.map +1 -1
- package/lib/__fixtures__/project/code/$imports-input.js.map +1 -1
- package/lib/__fixtures__/project/code/$imports-output.js.map +1 -1
- package/lib/__fixtures__/project/code/a.js.map +1 -1
- package/lib/__fixtures__/project/code/b.js.map +1 -1
- package/lib/__fixtures__/project/code/e.story.js.map +1 -1
- package/lib/__fixtures__/project/f.js.map +1 -1
- package/lib/__fixtures__/project/index.js.map +1 -1
- package/lib/__tests__/index.test.js +1 -1
- package/lib/__tests__/index.test.js.map +1 -1
- package/lib/babel.js +1 -1
- package/lib/babel.js.map +1 -1
- package/lib/index.js +38 -25
- package/lib/index.js.map +1 -1
- package/lib/targets/commonjs.js +1 -1
- package/lib/targets/commonjs.js.map +1 -1
- package/lib/targets/module.js +1 -1
- package/lib/targets/module.js.map +1 -1
- package/lib/targets/typescript.js +69 -31
- package/lib/targets/typescript.js.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib/utils/androidAssemble.js +1 -1
- package/lib/utils/androidAssemble.js.map +1 -1
- package/lib/utils/compile.js +16 -6
- package/lib/utils/compile.js.map +1 -1
- package/lib/utils/logger.js +5 -9
- package/lib/utils/logger.js.map +1 -1
- package/lib/utils/prompts.js +1 -1
- package/lib/utils/prompts.js.map +1 -1
- package/metro-config.js +6 -1
- package/package.json +12 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commonjs.js","names":["_path","_interopRequireDefault","require","_kleur","_del","_compile","
|
|
1
|
+
{"version":3,"file":"commonjs.js","names":["_path","_interopRequireDefault","require","_kleur","_del","_compile","e","__esModule","default","build","root","source","output","exclude","options","report","info","kleur","blue","path","relative","del","compile","modules"],"sources":["../../src/targets/commonjs.ts"],"sourcesContent":["import path from 'path';\nimport kleur from 'kleur';\nimport del from 'del';\nimport compile from '../utils/compile';\nimport type { Input } from '../types';\n\ntype Options = Input & {\n options?: {\n esm?: boolean;\n babelrc?: boolean | null;\n configFile?: string | false | null;\n sourceMaps?: boolean;\n copyFlow?: boolean;\n };\n exclude: string;\n};\n\nexport default async function build({\n root,\n source,\n output,\n exclude,\n options,\n report,\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 await compile({\n ...options,\n root,\n source,\n output,\n exclude,\n modules: 'commonjs',\n report,\n });\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,IAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,QAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAcxB,eAAeG,KAAKA,CAAC;EAClCC,IAAI;EACJC,MAAM;EACNC,MAAM;EACNC,OAAO;EACPC,OAAO;EACPC;AACO,CAAC,EAAE;EACVA,MAAM,CAACC,IAAI,CACT,iCAAiCC,cAAK,CAACC,IAAI,CAACC,aAAI,CAACC,QAAQ,CAACV,IAAI,EAAEE,MAAM,CAAC,CAAC,EAC1E,CAAC;EAED,MAAM,IAAAS,YAAG,EAAC,CAACT,MAAM,CAAC,CAAC;EAEnB,MAAM,IAAAU,gBAAO,EAAC;IACZ,GAAGR,OAAO;IACVJ,IAAI;IACJC,MAAM;IACNC,MAAM;IACNC,OAAO;IACPU,OAAO,EAAE,UAAU;IACnBR;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
|
package/lib/targets/module.js
CHANGED
|
@@ -8,7 +8,7 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
8
8
|
var _kleur = _interopRequireDefault(require("kleur"));
|
|
9
9
|
var _del = _interopRequireDefault(require("del"));
|
|
10
10
|
var _compile = _interopRequireDefault(require("../utils/compile"));
|
|
11
|
-
function _interopRequireDefault(
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
async function build({
|
|
13
13
|
root,
|
|
14
14
|
source,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","names":["_path","_interopRequireDefault","require","_kleur","_del","_compile","
|
|
1
|
+
{"version":3,"file":"module.js","names":["_path","_interopRequireDefault","require","_kleur","_del","_compile","e","__esModule","default","build","root","source","output","exclude","options","report","info","kleur","blue","path","relative","del","compile","modules"],"sources":["../../src/targets/module.ts"],"sourcesContent":["import path from 'path';\nimport kleur from 'kleur';\nimport del from 'del';\nimport compile from '../utils/compile';\nimport type { Input } from '../types';\n\ntype Options = Input & {\n options?: {\n esm?: boolean;\n babelrc?: boolean | null;\n configFile?: string | false | null;\n sourceMaps?: boolean;\n copyFlow?: boolean;\n };\n exclude: string;\n};\n\nexport default async function build({\n root,\n source,\n output,\n exclude,\n options,\n report,\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 await compile({\n ...options,\n root,\n source,\n output,\n exclude,\n modules: 'preserve',\n report,\n });\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,IAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,QAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAcxB,eAAeG,KAAKA,CAAC;EAClCC,IAAI;EACJC,MAAM;EACNC,MAAM;EACNC,OAAO;EACPC,OAAO;EACPC;AACO,CAAC,EAAE;EACVA,MAAM,CAACC,IAAI,CACT,iCAAiCC,cAAK,CAACC,IAAI,CAACC,aAAI,CAACC,QAAQ,CAACV,IAAI,EAAEE,MAAM,CAAC,CAAC,EAC1E,CAAC;EAED,MAAM,IAAAS,YAAG,EAAC,CAACT,MAAM,CAAC,CAAC;EAEnB,MAAM,IAAAU,gBAAO,EAAC;IACZ,GAAGR,OAAO;IACVJ,IAAI;IACJC,MAAM;IACNC,MAAM;IACNC,OAAO;IACPU,OAAO,EAAE,UAAU;IACnBR;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -12,7 +12,7 @@ var _crossSpawn = _interopRequireDefault(require("cross-spawn"));
|
|
|
12
12
|
var _del = _interopRequireDefault(require("del"));
|
|
13
13
|
var _json = _interopRequireDefault(require("json5"));
|
|
14
14
|
var _os = require("os");
|
|
15
|
-
function _interopRequireDefault(
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
16
|
async function build({
|
|
17
17
|
source,
|
|
18
18
|
root,
|
|
@@ -89,18 +89,59 @@ async function build({
|
|
|
89
89
|
} catch (e) {
|
|
90
90
|
// Ignore
|
|
91
91
|
}
|
|
92
|
-
const
|
|
92
|
+
const outputs = options?.esm ? {
|
|
93
|
+
commonjs: _path.default.join(output, 'commonjs'),
|
|
94
|
+
module: _path.default.join(output, 'module')
|
|
95
|
+
} : {
|
|
96
|
+
commonjs: output
|
|
97
|
+
};
|
|
98
|
+
const result = _crossSpawn.default.sync(tsc, ['--pretty', '--declaration', '--declarationMap', '--noEmit', 'false', '--emitDeclarationOnly', '--project', project, '--outDir', outputs.commonjs], {
|
|
93
99
|
stdio: 'inherit',
|
|
94
100
|
cwd: root
|
|
95
101
|
});
|
|
96
102
|
if (result.status === 0) {
|
|
97
103
|
await (0, _del.default)([tsbuildinfo]);
|
|
104
|
+
if (outputs?.module) {
|
|
105
|
+
// When ESM compatible output is enabled, we need to generate 2 builds for commonjs and esm
|
|
106
|
+
// In this case we copy the already generated types, and add `package.json` with `type` field
|
|
107
|
+
await _fsExtra.default.copy(outputs.commonjs, outputs.module);
|
|
108
|
+
await _fsExtra.default.writeJSON(_path.default.join(outputs.commonjs, 'package.json'), {
|
|
109
|
+
type: 'commonjs'
|
|
110
|
+
});
|
|
111
|
+
await _fsExtra.default.writeJSON(_path.default.join(outputs.module, 'package.json'), {
|
|
112
|
+
type: 'module'
|
|
113
|
+
});
|
|
114
|
+
}
|
|
98
115
|
report.success(`Wrote definition files to ${_kleur.default.blue(_path.default.relative(root, output))}`);
|
|
99
116
|
const pkg = JSON.parse(await _fsExtra.default.readFile(_path.default.join(root, 'package.json'), 'utf-8'));
|
|
100
|
-
const
|
|
117
|
+
const fields = [{
|
|
118
|
+
name: 'types',
|
|
119
|
+
value: pkg.types,
|
|
120
|
+
output: outputs.commonjs,
|
|
121
|
+
error: false
|
|
122
|
+
}, ...(pkg.exports?.['.']?.types ? [{
|
|
123
|
+
name: "exports['.'].types",
|
|
124
|
+
value: pkg.exports?.['.']?.types,
|
|
125
|
+
output: outputs.commonjs,
|
|
126
|
+
error: options?.esm === true
|
|
127
|
+
}] : []), {
|
|
128
|
+
name: "exports['.'].import.types",
|
|
129
|
+
value: pkg.exports?.['.']?.import?.types,
|
|
130
|
+
output: outputs.module,
|
|
131
|
+
error: !options?.esm
|
|
132
|
+
}, {
|
|
133
|
+
name: "exports['.'].require.types",
|
|
134
|
+
value: pkg.exports?.['.']?.require?.types,
|
|
135
|
+
output: outputs.commonjs,
|
|
136
|
+
error: !options?.esm
|
|
137
|
+
}];
|
|
138
|
+
const getGeneratedTypesPath = async field => {
|
|
139
|
+
if (!field.output || field.error) {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
101
142
|
if (pkg.source) {
|
|
102
143
|
const indexDTsName = _path.default.basename(pkg.source).replace(/\.(jsx?|tsx?)$/, '') + '.d.ts';
|
|
103
|
-
const potentialPaths = [_path.default.join(output, _path.default.dirname(pkg.source), indexDTsName), _path.default.join(output, _path.default.
|
|
144
|
+
const potentialPaths = [_path.default.join(field.output, _path.default.dirname(pkg.source), indexDTsName), _path.default.join(field.output, _path.default.relative(source, _path.default.join(root, _path.default.dirname(pkg.source))), indexDTsName)];
|
|
104
145
|
for (const potentialPath of potentialPaths) {
|
|
105
146
|
if (await _fsExtra.default.pathExists(potentialPath)) {
|
|
106
147
|
return _path.default.relative(root, potentialPath);
|
|
@@ -109,34 +150,31 @@ async function build({
|
|
|
109
150
|
}
|
|
110
151
|
return null;
|
|
111
152
|
};
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
name: "exports['.'].types",
|
|
117
|
-
value: pkg.exports?.['.']?.types
|
|
118
|
-
}];
|
|
119
|
-
if (fields.some(field => field.value)) {
|
|
120
|
-
await Promise.all(fields.map(async ({
|
|
121
|
-
name,
|
|
122
|
-
value
|
|
123
|
-
}) => {
|
|
124
|
-
if (!value) {
|
|
125
|
-
return;
|
|
153
|
+
const invalidFieldNames = (await Promise.all(fields.map(async field => {
|
|
154
|
+
if (field.error) {
|
|
155
|
+
if (field.value) {
|
|
156
|
+
report.warn(`The ${_kleur.default.blue(field.name)} field in ${_kleur.default.blue(`package.json`)} should not be set when the ${_kleur.default.blue('esm')} option is ${options?.esm ? 'enabled' : 'disabled'}.`);
|
|
126
157
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
if (field.name.startsWith('exports') && field.value && !/^\.\//.test(field.value)) {
|
|
161
|
+
report.error(`The ${_kleur.default.blue(field.name)} field in ${_kleur.default.blue(`package.json`)} should be a relative path starting with ${_kleur.default.blue('./')}. Found: ${_kleur.default.blue(field.value)}`);
|
|
162
|
+
return field.name;
|
|
163
|
+
}
|
|
164
|
+
if (field.value && !(await _fsExtra.default.pathExists(_path.default.join(root, field.value)))) {
|
|
165
|
+
const generatedTypesPath = await getGeneratedTypesPath(field);
|
|
166
|
+
report.error(`The ${_kleur.default.blue(field.name)} field in ${_kleur.default.blue('package.json')} points to a non-existent file: ${_kleur.default.blue(field.value)}.\nVerify the path points to the correct file under ${_kleur.default.blue(_path.default.relative(root, output))}${generatedTypesPath ? ` (found ${_kleur.default.blue(generatedTypesPath)}).` : '.'}`);
|
|
167
|
+
return field.name;
|
|
168
|
+
}
|
|
169
|
+
return null;
|
|
170
|
+
}))).filter(name => name != null);
|
|
171
|
+
if (invalidFieldNames.length) {
|
|
172
|
+
throw new Error(`Found errors for fields: ${invalidFieldNames.join(', ')}.`);
|
|
173
|
+
}
|
|
174
|
+
const validFields = fields.filter(field => !field.error);
|
|
175
|
+
if (validFields.every(field => field.value == null)) {
|
|
176
|
+
const suggestedTypesPaths = (await Promise.all(validFields.map(field => getGeneratedTypesPath(field)))).filter(path => path != null).filter((path, i, self) => self.indexOf(path) === i);
|
|
177
|
+
report.warn(`No ${validFields.map(field => _kleur.default.blue(field.name)).join(' or ')} field found in ${_kleur.default.blue('package.json')}. Consider ${suggestedTypesPaths.length ? `pointing to ${suggestedTypesPaths.map(path => _kleur.default.blue(path)).join(' or ')}` : `adding ${validFields.length > 1 ? 'them' : 'it'}`} so that consumers of your package can use the typescript definitions.`);
|
|
140
178
|
}
|
|
141
179
|
} else {
|
|
142
180
|
throw new Error('Failed to build definition files.');
|
|
@@ -1 +1 @@
|
|
|
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","declarationDir","push","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","fields","name","value","types","exports","some","field","Promise","all","map","typesPath","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.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 '--noEmit',\n 'false',\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 const fields = [\n { name: 'types', value: pkg.types },\n { name: \"exports['.'].types\", value: pkg.exports?.['.']?.types },\n ];\n\n if (fields.some((field) => field.value)) {\n await Promise.all(\n fields.map(async ({ name, value }) => {\n if (!value) {\n return;\n }\n\n const typesPath = path.join(root, value);\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(name)} field in ${kleur.blue(\n 'package.json'\n )} points to a non-existent file: ${kleur.blue(\n value\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 '${name}' field.`);\n }\n })\n );\n } else {\n const generatedTypesPath = await getGeneratedTypesPath();\n\n report.warn(\n `No ${kleur.blue(\n fields.map((field) => field.name).join(' or ')\n )} field found in ${kleur.blue('package.json')}.\\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,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAOf,eAAeG,KAAKA,CAAC;EAClCC,MAAM;EACNC,IAAI;EACJC,MAAM;EACNC,MAAM;EACNC;AACO,CAAC,EAAE;EACVD,MAAM,CAACE,IAAI,CACR,iCAAgCC,cAAK,CAACC,IAAI,CAACC,aAAI,CAACC,QAAQ,CAACR,IAAI,EAAEC,MAAM,CAAC,CAAE,EAC3E,CAAC;EAED,MAAM,IAAAQ,YAAG,EAAC,CAACR,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AO,CAAC;MACzB,CAAC,MAAM;QACL,MAAMjD,CAAC;MACT;IACF,CAAC,MAAM;MACL,MAAMA,CAAC;IACT;IAEA,MAAM,IAAIC,KAAK,CAAC,mCAAmC,CAAC;EACtD;AACF"}
|
|
1
|
+
{"version":3,"file":"typescript.js","names":["_kleur","_interopRequireDefault","require","_path","_fsExtra","_which","_crossSpawn","_del","_json","_os","e","__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","declarationDir","push","outDir","length","warn","reduce","acc","curr","gray","yellow","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","outputs","esm","commonjs","module","status","copy","writeJSON","type","success","pkg","JSON","fields","name","value","types","error","exports","import","getGeneratedTypesPath","field","indexDTsName","basename","potentialPaths","dirname","potentialPath","invalidFieldNames","Promise","all","map","startsWith","test","generatedTypesPath","filter","validFields","every","suggestedTypesPaths","i","self","indexOf","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?: {\n esm?: boolean;\n project?: string;\n tsc?: string;\n };\n};\n\ntype Field = {\n name: string;\n value: string | undefined;\n output: string | undefined;\n error: boolean;\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.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 outputs = options?.esm\n ? {\n commonjs: path.join(output, 'commonjs'),\n module: path.join(output, 'module'),\n }\n : { commonjs: output };\n\n const result = spawn.sync(\n tsc,\n [\n '--pretty',\n '--declaration',\n '--declarationMap',\n '--noEmit',\n 'false',\n '--emitDeclarationOnly',\n '--project',\n project,\n '--outDir',\n outputs.commonjs,\n ],\n {\n stdio: 'inherit',\n cwd: root,\n }\n );\n\n if (result.status === 0) {\n await del([tsbuildinfo]);\n\n if (outputs?.module) {\n // When ESM compatible output is enabled, we need to generate 2 builds for commonjs and esm\n // In this case we copy the already generated types, and add `package.json` with `type` field\n await fs.copy(outputs.commonjs, outputs.module);\n await fs.writeJSON(path.join(outputs.commonjs, 'package.json'), {\n type: 'commonjs',\n });\n await fs.writeJSON(path.join(outputs.module, 'package.json'), {\n type: 'module',\n });\n }\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 fields: Field[] = [\n {\n name: 'types',\n value: pkg.types,\n output: outputs.commonjs,\n error: false,\n },\n ...(pkg.exports?.['.']?.types\n ? [\n {\n name: \"exports['.'].types\",\n value: pkg.exports?.['.']?.types,\n output: outputs.commonjs,\n error: options?.esm === true,\n },\n ]\n : []),\n {\n name: \"exports['.'].import.types\",\n value: pkg.exports?.['.']?.import?.types,\n output: outputs.module,\n error: !options?.esm,\n },\n {\n name: \"exports['.'].require.types\",\n value: pkg.exports?.['.']?.require?.types,\n output: outputs.commonjs,\n error: !options?.esm,\n },\n ];\n\n const getGeneratedTypesPath = async (field: Field) => {\n if (!field.output || field.error) {\n return null;\n }\n\n if (pkg.source) {\n const indexDTsName =\n path.basename(pkg.source).replace(/\\.(jsx?|tsx?)$/, '') + '.d.ts';\n\n const potentialPaths = [\n path.join(field.output, path.dirname(pkg.source), indexDTsName),\n path.join(\n field.output,\n path.relative(source, path.join(root, path.dirname(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 const invalidFieldNames = (\n await Promise.all(\n fields.map(async (field) => {\n if (field.error) {\n if (field.value) {\n report.warn(\n `The ${kleur.blue(field.name)} field in ${kleur.blue(\n `package.json`\n )} should not be set when the ${kleur.blue(\n 'esm'\n )} option is ${options?.esm ? 'enabled' : 'disabled'}.`\n );\n }\n\n return null;\n }\n\n if (\n field.name.startsWith('exports') &&\n field.value &&\n !/^\\.\\//.test(field.value)\n ) {\n report.error(\n `The ${kleur.blue(field.name)} field in ${kleur.blue(\n `package.json`\n )} should be a relative path starting with ${kleur.blue(\n './'\n )}. Found: ${kleur.blue(field.value)}`\n );\n\n return field.name;\n }\n\n if (\n field.value &&\n !(await fs.pathExists(path.join(root, field.value)))\n ) {\n const generatedTypesPath = await getGeneratedTypesPath(field);\n\n report.error(\n `The ${kleur.blue(field.name)} field in ${kleur.blue(\n 'package.json'\n )} points to a non-existent file: ${kleur.blue(\n field.value\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 return field.name;\n }\n\n return null;\n })\n )\n ).filter((name): name is string => name != null);\n\n if (invalidFieldNames.length) {\n throw new Error(\n `Found errors for fields: ${invalidFieldNames.join(', ')}.`\n );\n }\n\n const validFields = fields.filter((field) => !field.error);\n\n if (validFields.every((field) => field.value == null)) {\n const suggestedTypesPaths = (\n await Promise.all(\n validFields.map((field) => getGeneratedTypesPath(field))\n )\n )\n .filter((path): path is string => path != null)\n .filter((path, i, self) => self.indexOf(path) === i);\n\n report.warn(\n `No ${validFields\n .map((field) => kleur.blue(field.name))\n .join(' or ')} field found in ${kleur.blue(\n 'package.json'\n )}. Consider ${\n suggestedTypesPaths.length\n ? `pointing to ${suggestedTypesPaths\n .map((path) => kleur.blue(path))\n .join(' or ')}`\n : `adding ${validFields.length > 1 ? 'them' : 'it'}`\n } so that consumers of your package can use the typescript definitions.`\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,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAkBf,eAAe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ACjB,UAAU4E,WAAW,CAAChE,MAAM,GAAG,CAAC,GAAG,MAAM,GAAG,IAAI,EAAE,wEAE1D,CAAC;MACH;IACF,CAAC,MAAM;MACL,MAAM,IAAIO,KAAK,CAAC,mCAAmC,CAAC;IACtD;EACF,CAAC,CAAC,OAAOpC,CAAU,EAAE;IACnB,IAAIA,CAAC,IAAI,IAAI,IAAI,OAAOA,CAAC,KAAK,QAAQ,EAAE;MACtC,IAAI,QAAQ,IAAIA,CAAC,IAAIA,CAAC,CAACqD,MAAM,IAAI,IAAI,EAAE;QACrC9C,MAAM,CAACoE,KAAK,CACV,iDAAiD3E,CAAC,CAACqD,MAAM,CAAC8C,QAAQ,CAAC,CAAC,EACtE,CAAC;MACH,CAAC,MAAM,IAAI,SAAS,IAAInG,CAAC,IAAI,OAAOA,CAAC,CAACoG,OAAO,KAAK,QAAQ,EAAE;QAC1D7F,MAAM,CAACoE,KAAK,CAAC3E,CAAC,CAACoG,OAAO,CAAC;MACzB,CAAC,MAAM;QACL,MAAMpG,CAAC;MACT;IACF,CAAC,MAAM;MACL,MAAMA,CAAC;IACT;IAEA,MAAM,IAAIoC,KAAK,CAAC,mCAAmC,CAAC;EACtD;AACF","ignoreList":[]}
|
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 = 'commonjs' | 'module' | 'typescript';\n\nexport type Options = {\n source?: string;\n output?: string;\n targets?: (Target | [Target, object])[];\n exclude?: string;\n};\n"],"mappings":""}
|
|
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":"","ignoreList":[]}
|
|
@@ -9,7 +9,7 @@ var _kleur = _interopRequireDefault(require("kleur"));
|
|
|
9
9
|
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
10
10
|
var _child_process = require("child_process");
|
|
11
11
|
var _os = require("os");
|
|
12
|
-
function _interopRequireDefault(
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
async function androidAssemble({
|
|
14
14
|
root,
|
|
15
15
|
androidPath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"androidAssemble.js","names":["_path","_interopRequireDefault","require","_kleur","_fsExtra","_child_process","_os","
|
|
1
|
+
{"version":3,"file":"androidAssemble.js","names":["_path","_interopRequireDefault","require","_kleur","_fsExtra","_child_process","_os","e","__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,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;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,CACT,iCAAiCC,cAAK,CAACC,IAAI,CAACL,GAAG,CAAC,SAASI,cAAK,CAACC,IAAI,CACjE,QACF,CAAC,EACH,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,CACb,OAAOR,cAAK,CAACC,IAAI,CACf,SACF,CAAC,sCAAsCD,cAAK,CAACC,IAAI,CAC/CP,WACF,CAAC,4CAA4CM,cAAK,CAACC,IAAI,CACrD,gBACF,CAAC,qBACH,CAAC;EACH;AACF","ignoreList":[]}
|
package/lib/utils/compile.js
CHANGED
|
@@ -9,9 +9,9 @@ var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
|
9
9
|
var _kleur = _interopRequireDefault(require("kleur"));
|
|
10
10
|
var babel = _interopRequireWildcard(require("@babel/core"));
|
|
11
11
|
var _glob = _interopRequireDefault(require("glob"));
|
|
12
|
-
function _getRequireWildcardCache(
|
|
13
|
-
function _interopRequireWildcard(
|
|
14
|
-
function _interopRequireDefault(
|
|
12
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
const sourceExt = /\.([cm])?[jt]sx?$/;
|
|
16
16
|
async function compile({
|
|
17
17
|
root,
|
|
@@ -110,14 +110,20 @@ async function compile({
|
|
|
110
110
|
}];
|
|
111
111
|
if (esm) {
|
|
112
112
|
if (modules === 'commonjs') {
|
|
113
|
-
fields.push({
|
|
113
|
+
fields.push(typeof pkg.exports?.['.']?.require === 'string' ? {
|
|
114
114
|
name: "exports['.'].require",
|
|
115
115
|
value: pkg.exports?.['.']?.require
|
|
116
|
+
} : {
|
|
117
|
+
name: "exports['.'].require.default",
|
|
118
|
+
value: pkg.exports?.['.']?.require?.default
|
|
116
119
|
});
|
|
117
120
|
} else {
|
|
118
|
-
fields.push({
|
|
121
|
+
fields.push(typeof pkg.exports?.['.']?.import === 'string' ? {
|
|
119
122
|
name: "exports['.'].import",
|
|
120
123
|
value: pkg.exports?.['.']?.import
|
|
124
|
+
} : {
|
|
125
|
+
name: "exports['.'].import.default",
|
|
126
|
+
value: pkg.exports?.['.']?.import?.default
|
|
121
127
|
});
|
|
122
128
|
}
|
|
123
129
|
} else {
|
|
@@ -135,6 +141,10 @@ async function compile({
|
|
|
135
141
|
if (!value) {
|
|
136
142
|
return;
|
|
137
143
|
}
|
|
144
|
+
if (name.startsWith('exports') && value && !/^\.\//.test(value)) {
|
|
145
|
+
report.error(`The ${_kleur.default.blue(name)} field in ${_kleur.default.blue(`package.json`)} should be a relative path starting with ${_kleur.default.blue('./')}. Found: ${_kleur.default.blue(value)}`);
|
|
146
|
+
throw new Error(`Found incorrect path in '${name}' field.`);
|
|
147
|
+
}
|
|
138
148
|
try {
|
|
139
149
|
require.resolve(_path.default.join(root, value));
|
|
140
150
|
} catch (e) {
|
|
@@ -151,7 +161,7 @@ async function compile({
|
|
|
151
161
|
}));
|
|
152
162
|
} else {
|
|
153
163
|
const generatedEntryPath = await getGeneratedEntryPath();
|
|
154
|
-
report.warn(`No ${
|
|
164
|
+
report.warn(`No ${fields.map(field => _kleur.default.blue(field.name)).join(' or ')} field found in ${_kleur.default.blue('package.json')}. Consider ${generatedEntryPath ? `pointing to ${_kleur.default.blue(generatedEntryPath)}` : `adding ${fields.length > 1 ? 'them' : 'it'}`} so that consumers of your package can import your package.`);
|
|
155
165
|
}
|
|
156
166
|
}
|
|
157
167
|
//# sourceMappingURL=compile.js.map
|
package/lib/utils/compile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.js","names":["_path","_interopRequireDefault","require","_fsExtra","_kleur","babel","_interopRequireWildcard","_glob","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","sourceExt","compile","root","source","output","esm","babelrc","configFile","exclude","modules","copyFlow","sourceMaps","report","files","glob","sync","cwd","absolute","nodir","ignore","info","kleur","blue","String","length","path","relative","pkg","JSON","parse","fs","readFile","join","keys","devDependencies","includes","warn","mkdirp","writeJSON","type","Promise","all","map","filepath","outputFilename","replace","dirname","test","copy","content","result","transformAsync","sourceRoot","sourceFileName","filename","presets","resolve","Error","code","mapFilename","basename","sourcesContent","undefined","writeFile","success","getGeneratedEntryPath","ext","indexName","potentialPath","pathExists","fields","name","value","main","module","push","exports","import","some","field","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 glob from 'glob';\nimport type { Input } from '../types';\n\ntype Options = Input & {\n esm?: boolean;\n babelrc?: boolean | null;\n configFile?: string | false | null;\n sourceMaps?: boolean;\n copyFlow?: boolean;\n modules: 'commonjs' | 'preserve';\n exclude: string;\n};\n\nconst sourceExt = /\\.([cm])?[jt]sx?$/;\n\nexport default async function compile({\n root,\n source,\n output,\n esm = false,\n babelrc = false,\n configFile = false,\n exclude,\n modules,\n copyFlow,\n sourceMaps = true,\n report,\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 fs.mkdirp(output);\n await fs.writeJSON(path.join(output, 'package.json'), {\n type: modules === 'commonjs' ? 'commonjs' : 'module',\n });\n\n await Promise.all(\n files.map(async (filepath) => {\n const outputFilename = path\n .join(output, path.relative(source, filepath))\n .replace(sourceExt, '.$1js');\n\n await fs.mkdirp(path.dirname(outputFilename));\n\n if (!sourceExt.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'),\n {\n modules:\n // If a file is explicitly marked as ESM, then preserve the syntax\n /\\.m[jt]s$/.test(filepath) ? 'preserve' : modules,\n esm,\n },\n ],\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 for (const ext of ['.js', '.cjs', '.mjs']) {\n const indexName =\n // The source field may not have an extension, so we add it instead of replacing directly\n path.basename(pkg.source).replace(sourceExt, '') + ext;\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\n return null;\n };\n\n const fields =\n modules === 'commonjs'\n ? [{ name: 'main', value: pkg.main }]\n : [{ name: 'module', value: pkg.module }];\n\n if (esm) {\n if (modules === 'commonjs') {\n fields.push({\n name: \"exports['.'].require\",\n value: pkg.exports?.['.']?.require,\n });\n } else {\n fields.push({\n name: \"exports['.'].import\",\n value: pkg.exports?.['.']?.import,\n });\n }\n } else {\n if (modules === 'commonjs' && pkg.exports?.['.']?.require) {\n report.warn(\n `The ${kleur.blue('esm')} option is disabled, but the ${kleur.blue(\n \"exports['.'].require\"\n )} field is set in ${kleur.blue(\n 'package.json'\n )}. This is likely a mistake.`\n );\n } else if (modules === 'preserve' && pkg.exports?.['.']?.import) {\n report.warn(\n `The ${kleur.blue('esm')} option is disabled, but the ${kleur.blue(\n \"exports['.'].import\"\n )} field is set in ${kleur.blue(\n 'package.json'\n )}. This is likely a mistake.`\n );\n }\n }\n\n if (fields.some((field) => field.value)) {\n await Promise.all(\n fields.map(async ({ name, value }) => {\n if (!value) {\n return;\n }\n\n try {\n require.resolve(path.join(root, value));\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(name)} field in ${kleur.blue(\n 'package.json'\n )} points to a non-existent file: ${kleur.blue(\n value\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 '${name}' field.`);\n }\n\n throw e;\n }\n })\n );\n } else {\n const generatedEntryPath = await getGeneratedEntryPath();\n\n report.warn(\n `No ${kleur.blue(\n fields.map((field) => field.name).join(' or ')\n )} field found in ${kleur.blue('package.json')}. 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,KAAA,GAAAN,sBAAA,CAAAC,OAAA;AAAwB,SAAAM,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,SAAAH,wBAAAO,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAA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,cAAK,CAACC,IAAI,CAAC,cAAc,CAAE,cAC7C2D,kBAAkB,GACb,kBAAiB5D,cAAK,CAACC,IAAI,CAAC2D,kBAAkB,CAAE,EAAC,GAClD,WACL,gDACH,CAAC;EACH;AACF"}
|
|
1
|
+
{"version":3,"file":"compile.js","names":["_path","_interopRequireDefault","require","_fsExtra","_kleur","babel","_interopRequireWildcard","_glob","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","sourceExt","compile","root","source","output","esm","babelrc","configFile","exclude","modules","copyFlow","sourceMaps","report","files","glob","sync","cwd","absolute","nodir","ignore","info","kleur","blue","String","length","path","relative","pkg","JSON","parse","fs","readFile","join","keys","devDependencies","includes","warn","mkdirp","writeJSON","type","Promise","all","map","filepath","outputFilename","replace","dirname","test","copy","content","result","transformAsync","sourceRoot","sourceFileName","filename","presets","resolve","Error","code","mapFilename","basename","sourcesContent","undefined","writeFile","success","getGeneratedEntryPath","ext","indexName","potentialPath","pathExists","fields","name","value","main","module","push","exports","import","some","field","startsWith","error","generatedEntryPath"],"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 glob from 'glob';\nimport type { Input } from '../types';\n\ntype Options = Input & {\n esm?: boolean;\n babelrc?: boolean | null;\n configFile?: string | false | null;\n sourceMaps?: boolean;\n copyFlow?: boolean;\n modules: 'commonjs' | 'preserve';\n exclude: string;\n};\n\nconst sourceExt = /\\.([cm])?[jt]sx?$/;\n\nexport default async function compile({\n root,\n source,\n output,\n esm = false,\n babelrc = false,\n configFile = false,\n exclude,\n modules,\n copyFlow,\n sourceMaps = true,\n report,\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 fs.mkdirp(output);\n await fs.writeJSON(path.join(output, 'package.json'), {\n type: modules === 'commonjs' ? 'commonjs' : 'module',\n });\n\n await Promise.all(\n files.map(async (filepath) => {\n const outputFilename = path\n .join(output, path.relative(source, filepath))\n .replace(sourceExt, '.$1js');\n\n await fs.mkdirp(path.dirname(outputFilename));\n\n if (!sourceExt.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'),\n {\n modules:\n // If a file is explicitly marked as ESM, then preserve the syntax\n /\\.m[jt]s$/.test(filepath) ? 'preserve' : modules,\n esm,\n },\n ],\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 for (const ext of ['.js', '.cjs', '.mjs']) {\n const indexName =\n // The source field may not have an extension, so we add it instead of replacing directly\n path.basename(pkg.source).replace(sourceExt, '') + ext;\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\n return null;\n };\n\n const fields =\n modules === 'commonjs'\n ? [{ name: 'main', value: pkg.main }]\n : [{ name: 'module', value: pkg.module }];\n\n if (esm) {\n if (modules === 'commonjs') {\n fields.push(\n typeof pkg.exports?.['.']?.require === 'string'\n ? {\n name: \"exports['.'].require\",\n value: pkg.exports?.['.']?.require,\n }\n : {\n name: \"exports['.'].require.default\",\n value: pkg.exports?.['.']?.require?.default,\n }\n );\n } else {\n fields.push(\n typeof pkg.exports?.['.']?.import === 'string'\n ? {\n name: \"exports['.'].import\",\n value: pkg.exports?.['.']?.import,\n }\n : {\n name: \"exports['.'].import.default\",\n value: pkg.exports?.['.']?.import?.default,\n }\n );\n }\n } else {\n if (modules === 'commonjs' && pkg.exports?.['.']?.require) {\n report.warn(\n `The ${kleur.blue('esm')} option is disabled, but the ${kleur.blue(\n \"exports['.'].require\"\n )} field is set in ${kleur.blue(\n 'package.json'\n )}. This is likely a mistake.`\n );\n } else if (modules === 'preserve' && pkg.exports?.['.']?.import) {\n report.warn(\n `The ${kleur.blue('esm')} option is disabled, but the ${kleur.blue(\n \"exports['.'].import\"\n )} field is set in ${kleur.blue(\n 'package.json'\n )}. This is likely a mistake.`\n );\n }\n }\n\n if (fields.some((field) => field.value)) {\n await Promise.all(\n fields.map(async ({ name, value }) => {\n if (!value) {\n return;\n }\n\n if (name.startsWith('exports') && value && !/^\\.\\//.test(value)) {\n report.error(\n `The ${kleur.blue(name)} field in ${kleur.blue(\n `package.json`\n )} should be a relative path starting with ${kleur.blue(\n './'\n )}. Found: ${kleur.blue(value)}`\n );\n\n throw new Error(`Found incorrect path in '${name}' field.`);\n }\n\n try {\n require.resolve(path.join(root, value));\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(name)} field in ${kleur.blue(\n 'package.json'\n )} points to a non-existent file: ${kleur.blue(\n value\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 '${name}' field.`);\n }\n\n throw e;\n }\n })\n );\n } else {\n const generatedEntryPath = await getGeneratedEntryPath();\n\n report.warn(\n `No ${fields\n .map((field) => kleur.blue(field.name))\n .join(' or ')} field found in ${kleur.blue('package.json')}. Consider ${\n generatedEntryPath\n ? `pointing to ${kleur.blue(generatedEntryPath)}`\n : `adding ${fields.length > 1 ? 'them' : 'it'}`\n } so that consumers of your package can import your package.`\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,KAAA,GAAAN,sBAAA,CAAAC,OAAA;AAAwB,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,I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AC7D;QAEA,MAAM1F,CAAC;MACT;IACF,CAAC,CACH,CAAC;EACH,CAAC,MAAM;IACL,MAAMqG,kBAAkB,GAAG,MAAMjB,qBAAqB,CAAC,CAAC;IAExDrD,MAAM,CAACwB,IAAI,CACT,MAAMkC,MAAM,CACT5B,GAAG,CAAEqC,KAAK,IAAK1D,cAAK,CAACC,IAAI,CAACyD,KAAK,CAACR,IAAI,CAAC,CAAC,CACtCvC,IAAI,CAAC,MAAM,CAAC,mBAAmBX,cAAK,CAACC,IAAI,CAAC,cAAc,CAAC,cAC1D4D,kBAAkB,GACd,eAAe7D,cAAK,CAACC,IAAI,CAAC4D,kBAAkB,CAAC,EAAE,GAC/C,UAAUZ,MAAM,CAAC9C,MAAM,GAAG,CAAC,GAAG,MAAM,GAAG,IAAI,EAAE,6DAErD,CAAC;EACH;AACF","ignoreList":[]}
|
package/lib/utils/logger.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.warn = exports.success = exports.info = exports.exit = exports.error = void 0;
|
|
7
7
|
var _kleur = _interopRequireDefault(require("kleur"));
|
|
8
|
-
function _interopRequireDefault(
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
const logger = (type, color) => (...messages) => {
|
|
10
10
|
console.log(color(_kleur.default.bold(type)), ...messages.map(message => {
|
|
11
11
|
if (typeof message === 'string') {
|
|
@@ -15,14 +15,10 @@ const logger = (type, color) => (...messages) => {
|
|
|
15
15
|
}
|
|
16
16
|
}));
|
|
17
17
|
};
|
|
18
|
-
const info = logger('ℹ', _kleur.default.blue);
|
|
19
|
-
exports.
|
|
20
|
-
const
|
|
21
|
-
exports.
|
|
22
|
-
const error = logger('✖', _kleur.default.red);
|
|
23
|
-
exports.error = error;
|
|
24
|
-
const success = logger('✔', _kleur.default.green);
|
|
25
|
-
exports.success = success;
|
|
18
|
+
const info = exports.info = logger('ℹ', _kleur.default.blue);
|
|
19
|
+
const warn = exports.warn = logger('⚠', _kleur.default.yellow);
|
|
20
|
+
const error = exports.error = logger('✖', _kleur.default.red);
|
|
21
|
+
const success = exports.success = logger('✔', _kleur.default.green);
|
|
26
22
|
const exit = (...messages) => {
|
|
27
23
|
error(...messages);
|
|
28
24
|
process.exit(1);
|
package/lib/utils/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","names":["_kleur","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"file":"logger.js","names":["_kleur","_interopRequireDefault","require","e","__esModule","default","logger","type","color","messages","console","log","kleur","bold","map","message","split","join","info","exports","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: kleur.Color) =>\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,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE1B,MAAMG,MAAM,GACVA,CAACC,IAAY,EAAEC,KAAkB,KACjC,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,CAAC,MAAM,CAAC;IACzC,CAAC,MAAM;MACL,OAAOF,OAAO;IAChB;EACF,CAAC,CACH,CAAC;AACH,CAAC;AAEI,MAAMG,IAAI,GAAAC,OAAA,CAAAD,IAAA,GAAGZ,MAAM,CAAC,GAAG,EAAEM,cAAK,CAACQ,IAAI,CAAC;AACpC,MAAMC,IAAI,GAAAF,OAAA,CAAAE,IAAA,GAAGf,MAAM,CAAC,GAAG,EAAEM,cAAK,CAACU,MAAM,CAAC;AACtC,MAAMC,KAAK,GAAAJ,OAAA,CAAAI,KAAA,GAAGjB,MAAM,CAAC,GAAG,EAAEM,cAAK,CAACY,GAAG,CAAC;AACpC,MAAMC,OAAO,GAAAN,OAAA,CAAAM,OAAA,GAAGnB,MAAM,CAAC,GAAG,EAAEM,cAAK,CAACc,KAAK,CAAC;AAExC,MAAMC,IAAI,GAAGA,CAAC,GAAGlB,QAAmB,KAAK;EAC9Cc,KAAK,CAAC,GAAGd,QAAQ,CAAC;EAClBmB,OAAO,CAACD,IAAI,CAAC,CAAC,CAAC;AACjB,CAAC;AAACR,OAAA,CAAAQ,IAAA,GAAAA,IAAA","ignoreList":[]}
|
package/lib/utils/prompts.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = prompts;
|
|
7
7
|
var _prompts = _interopRequireDefault(require("prompts"));
|
|
8
|
-
function _interopRequireDefault(
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
function prompts(args, options) {
|
|
10
10
|
return (0, _prompts.default)(args, {
|
|
11
11
|
onCancel() {
|
package/lib/utils/prompts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.js","names":["_prompts","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"file":"prompts.js","names":["_prompts","_interopRequireDefault","require","e","__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,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;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","ignoreList":[]}
|
package/metro-config.js
CHANGED
|
@@ -17,7 +17,12 @@ const exclusionList = require('metro-config/src/defaults/exclusionList');
|
|
|
17
17
|
* @returns {import('metro-config').MetroConfig} Metro configuration
|
|
18
18
|
*/
|
|
19
19
|
const getConfig = (defaultConfig, { root, pkg, project }) => {
|
|
20
|
-
const modules =
|
|
20
|
+
const modules = [
|
|
21
|
+
// AssetsRegistry is used internally by React Native to handle asset imports
|
|
22
|
+
// This needs to be a singleton so all assets are registered to a single registry
|
|
23
|
+
'@react-native/assets-registry',
|
|
24
|
+
...Object.keys({ ...pkg.peerDependencies }),
|
|
25
|
+
];
|
|
21
26
|
|
|
22
27
|
/**
|
|
23
28
|
* Metro configuration
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-builder-bob",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "CLI to build JavaScript files for React Native libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -45,12 +45,16 @@
|
|
|
45
45
|
]
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@babel/core": "^7.
|
|
48
|
+
"@babel/core": "^7.25.2",
|
|
49
|
+
"@babel/plugin-transform-class-properties": "^7.24.7",
|
|
50
|
+
"@babel/plugin-transform-classes": "^7.25.0",
|
|
51
|
+
"@babel/plugin-transform-private-methods": "^7.24.7",
|
|
52
|
+
"@babel/plugin-transform-private-property-in-object": "^7.24.7",
|
|
49
53
|
"@babel/plugin-transform-strict-mode": "^7.24.7",
|
|
50
|
-
"@babel/preset-env": "^7.
|
|
51
|
-
"@babel/preset-flow": "^7.
|
|
52
|
-
"@babel/preset-react": "^7.
|
|
53
|
-
"@babel/preset-typescript": "^7.
|
|
54
|
+
"@babel/preset-env": "^7.25.2",
|
|
55
|
+
"@babel/preset-flow": "^7.24.7",
|
|
56
|
+
"@babel/preset-react": "^7.24.7",
|
|
57
|
+
"@babel/preset-typescript": "^7.24.7",
|
|
54
58
|
"babel-plugin-module-resolver": "^5.0.2",
|
|
55
59
|
"browserslist": "^4.20.4",
|
|
56
60
|
"cosmiconfig": "^9.0.0",
|
|
@@ -69,7 +73,7 @@
|
|
|
69
73
|
"yargs": "^17.5.1"
|
|
70
74
|
},
|
|
71
75
|
"devDependencies": {
|
|
72
|
-
"@babel/cli": "^7.
|
|
76
|
+
"@babel/cli": "^7.24.8",
|
|
73
77
|
"@jest/globals": "^29.7.0",
|
|
74
78
|
"@types/babel__core": "^7.1.19",
|
|
75
79
|
"@types/browserslist": "^4.15.0",
|
|
@@ -85,5 +89,5 @@
|
|
|
85
89
|
"concurrently": "^7.2.2",
|
|
86
90
|
"jest": "^29.7.0"
|
|
87
91
|
},
|
|
88
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "47d624eb8e1524a15a4ceaa5d0388d3af5b2bb14"
|
|
89
93
|
}
|