@driveflux/fab 1.0.10 → 2.0.0-next.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/.turbo/turbo-build.log +13 -16
- package/CHANGELOG.md +1 -86
- package/bin/fab.js +6 -7
- package/dist/build.d.ts +5 -7
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +79 -166
- package/dist/clean.d.ts.map +1 -1
- package/dist/clean.js +17 -17
- package/dist/config.d.ts +0 -8
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +11 -13
- package/dist/create.d.ts.map +1 -1
- package/dist/create.js +8 -8
- package/dist/index.js +5 -5
- package/dist/utils.d.ts +2 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +21 -22
- package/package.json +11 -14
- package/src/build.ts +73 -119
- package/src/clean.ts +4 -8
- package/src/config.ts +12 -18
- package/src/create.ts +9 -17
- package/src/types.ts +1 -1
- package/src/utils.ts +6 -6
- package/templates/backend/package.json +1 -1
- package/templates/backend/src/index.ts +0 -1
- package/templates/frontend/package.json +1 -1
- package/templates/frontend/src/index.ts +0 -1
- package/tsconfig.tsbuildinfo +1 -1
package/dist/build.js
CHANGED
|
@@ -65,10 +65,6 @@ function _non_iterable_rest() {
|
|
|
65
65
|
function _sliced_to_array(arr, i) {
|
|
66
66
|
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
67
67
|
}
|
|
68
|
-
function _type_of(obj) {
|
|
69
|
-
"@swc/helpers - typeof";
|
|
70
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
71
|
-
}
|
|
72
68
|
function _unsupported_iterable_to_array(o, minLen) {
|
|
73
69
|
if (!o) return;
|
|
74
70
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
@@ -172,21 +168,21 @@ function _ts_generator(thisArg, body) {
|
|
|
172
168
|
};
|
|
173
169
|
}
|
|
174
170
|
}
|
|
175
|
-
import fg from
|
|
176
|
-
import
|
|
177
|
-
import
|
|
178
|
-
import
|
|
179
|
-
import
|
|
180
|
-
import {
|
|
181
|
-
import { ensureDir, getDefaultOptions, runCommand, validatePackageJson } from './utils.js';
|
|
171
|
+
import fg from "fast-glob";
|
|
172
|
+
import assert from "node:assert";
|
|
173
|
+
import fs from "node:fs/promises";
|
|
174
|
+
import path from "node:path";
|
|
175
|
+
import { clean } from "./clean.js";
|
|
176
|
+
import { ensureDir, getDefaultOptions, runCommand, validatePackageJson } from "./utils.js";
|
|
182
177
|
var glob = fg.glob;
|
|
183
178
|
export var build = function() {
|
|
184
|
-
var _ref = _async_to_generator(function(
|
|
179
|
+
var _ref = _async_to_generator(function() {
|
|
185
180
|
var options, promises;
|
|
181
|
+
var _arguments = arguments;
|
|
186
182
|
return _ts_generator(this, function(_state) {
|
|
187
183
|
switch(_state.label){
|
|
188
184
|
case 0:
|
|
189
|
-
options =
|
|
185
|
+
options = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : getDefaultOptions();
|
|
190
186
|
// Cleanup first
|
|
191
187
|
return [
|
|
192
188
|
4,
|
|
@@ -204,7 +200,6 @@ export var build = function() {
|
|
|
204
200
|
if (!options.noCJS) {
|
|
205
201
|
promises.push(buildCjs(options));
|
|
206
202
|
}
|
|
207
|
-
promises.push(copyVerbatim(options));
|
|
208
203
|
// Build necessary files
|
|
209
204
|
return [
|
|
210
205
|
4,
|
|
@@ -212,110 +207,35 @@ export var build = function() {
|
|
|
212
207
|
];
|
|
213
208
|
case 2:
|
|
214
209
|
_state.sent();
|
|
215
|
-
|
|
216
|
-
3,
|
|
217
|
-
4
|
|
218
|
-
];
|
|
210
|
+
// Make exports for CJS
|
|
219
211
|
return [
|
|
220
212
|
4,
|
|
221
213
|
makeBaseExports(options)
|
|
222
214
|
];
|
|
223
215
|
case 3:
|
|
224
216
|
_state.sent();
|
|
225
|
-
_state.label = 4;
|
|
226
|
-
case 4:
|
|
227
|
-
return [
|
|
228
|
-
2
|
|
229
|
-
];
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
});
|
|
233
|
-
return function build(rawOptions) {
|
|
234
|
-
return _ref.apply(this, arguments);
|
|
235
|
-
};
|
|
236
|
-
}();
|
|
237
|
-
export var copyVerbatim = function() {
|
|
238
|
-
var _ref = _async_to_generator(function(rawOptions) {
|
|
239
|
-
var _options_copyVerbatim, options, _options_cwd, cwd, _options_destination, destination;
|
|
240
|
-
return _ts_generator(this, function(_state) {
|
|
241
|
-
switch(_state.label){
|
|
242
|
-
case 0:
|
|
243
|
-
options = merge({}, getDefaultOptions(), rawOptions);
|
|
244
|
-
if (!((_options_copyVerbatim = options.copyVerbatim) === null || _options_copyVerbatim === void 0 ? void 0 : _options_copyVerbatim.length)) return [
|
|
245
|
-
3,
|
|
246
|
-
2
|
|
247
|
-
];
|
|
248
|
-
cwd = (_options_cwd = options.cwd) !== null && _options_cwd !== void 0 ? _options_cwd : process.cwd();
|
|
249
|
-
destination = (_options_destination = options.destination) !== null && _options_destination !== void 0 ? _options_destination : getDefaultOptions().destination;
|
|
250
|
-
return [
|
|
251
|
-
4,
|
|
252
|
-
Promise.all(options.copyVerbatim.map(function() {
|
|
253
|
-
var _ref = _async_to_generator(function(fileOrFolderRaw) {
|
|
254
|
-
var fileOrFolder, targetPath, targetPathCjs;
|
|
255
|
-
return _ts_generator(this, function(_state) {
|
|
256
|
-
switch(_state.label){
|
|
257
|
-
case 0:
|
|
258
|
-
fileOrFolder = "src/".concat(fileOrFolderRaw.replace(/^(\/)*src/, ''));
|
|
259
|
-
targetPath = path.resolve(destination, fileOrFolder).replace('/src', '');
|
|
260
|
-
targetPathCjs = path.resolve(destination, 'cjs', fileOrFolder).replace('/src', '');
|
|
261
|
-
return [
|
|
262
|
-
4,
|
|
263
|
-
ensureDir(path.dirname(targetPath))
|
|
264
|
-
];
|
|
265
|
-
case 1:
|
|
266
|
-
_state.sent();
|
|
267
|
-
return [
|
|
268
|
-
4,
|
|
269
|
-
fs.cp(path.resolve(cwd, fileOrFolder), targetPath, {
|
|
270
|
-
recursive: true
|
|
271
|
-
})
|
|
272
|
-
];
|
|
273
|
-
case 2:
|
|
274
|
-
_state.sent();
|
|
275
|
-
return [
|
|
276
|
-
4,
|
|
277
|
-
fs.cp(path.resolve(cwd, fileOrFolder), targetPathCjs, {
|
|
278
|
-
recursive: true
|
|
279
|
-
})
|
|
280
|
-
];
|
|
281
|
-
case 3:
|
|
282
|
-
_state.sent();
|
|
283
|
-
return [
|
|
284
|
-
2
|
|
285
|
-
];
|
|
286
|
-
}
|
|
287
|
-
});
|
|
288
|
-
});
|
|
289
|
-
return function(fileOrFolderRaw) {
|
|
290
|
-
return _ref.apply(this, arguments);
|
|
291
|
-
};
|
|
292
|
-
}()))
|
|
293
|
-
];
|
|
294
|
-
case 1:
|
|
295
|
-
_state.sent();
|
|
296
|
-
_state.label = 2;
|
|
297
|
-
case 2:
|
|
298
217
|
return [
|
|
299
218
|
2
|
|
300
219
|
];
|
|
301
220
|
}
|
|
302
221
|
});
|
|
303
222
|
});
|
|
304
|
-
return function
|
|
223
|
+
return function build() {
|
|
305
224
|
return _ref.apply(this, arguments);
|
|
306
225
|
};
|
|
307
226
|
}();
|
|
308
227
|
export var buildTypes = function() {
|
|
309
|
-
var _ref = _async_to_generator(function(
|
|
228
|
+
var _ref = _async_to_generator(function() {
|
|
310
229
|
var options;
|
|
230
|
+
var _arguments = arguments;
|
|
311
231
|
return _ts_generator(this, function(_state) {
|
|
312
232
|
switch(_state.label){
|
|
313
233
|
case 0:
|
|
314
|
-
options =
|
|
234
|
+
options = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : getDefaultOptions();
|
|
315
235
|
return [
|
|
316
236
|
4,
|
|
317
237
|
validatePackageJson({
|
|
318
|
-
command:
|
|
238
|
+
command: "tsc",
|
|
319
239
|
cwd: options.cwd
|
|
320
240
|
})
|
|
321
241
|
];
|
|
@@ -323,10 +243,10 @@ export var buildTypes = function() {
|
|
|
323
243
|
_state.sent();
|
|
324
244
|
return [
|
|
325
245
|
4,
|
|
326
|
-
runCommand(
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
246
|
+
runCommand("pnpm", [
|
|
247
|
+
"tsc",
|
|
248
|
+
"--emitDeclarationOnly",
|
|
249
|
+
"--declarationMap"
|
|
330
250
|
], {
|
|
331
251
|
cwd: options.cwd
|
|
332
252
|
})
|
|
@@ -339,24 +259,25 @@ export var buildTypes = function() {
|
|
|
339
259
|
}
|
|
340
260
|
});
|
|
341
261
|
});
|
|
342
|
-
return function buildTypes(
|
|
262
|
+
return function buildTypes() {
|
|
343
263
|
return _ref.apply(this, arguments);
|
|
344
264
|
};
|
|
345
265
|
}();
|
|
346
266
|
export var buildCjs = function() {
|
|
347
|
-
var _ref = _async_to_generator(function(
|
|
267
|
+
var _ref = _async_to_generator(function() {
|
|
348
268
|
var options, _options_cwd, cwd, _options_destination, destination, cjsPath, targetPath;
|
|
269
|
+
var _arguments = arguments;
|
|
349
270
|
return _ts_generator(this, function(_state) {
|
|
350
271
|
switch(_state.label){
|
|
351
272
|
case 0:
|
|
352
|
-
options =
|
|
273
|
+
options = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : getDefaultOptions();
|
|
353
274
|
cwd = (_options_cwd = options.cwd) !== null && _options_cwd !== void 0 ? _options_cwd : process.cwd();
|
|
354
275
|
destination = (_options_destination = options.destination) !== null && _options_destination !== void 0 ? _options_destination : getDefaultOptions().destination;
|
|
355
|
-
cjsPath = path.resolve(destination,
|
|
276
|
+
cjsPath = path.resolve(destination, "cjs");
|
|
356
277
|
return [
|
|
357
278
|
4,
|
|
358
279
|
validatePackageJson({
|
|
359
|
-
command:
|
|
280
|
+
command: "swc",
|
|
360
281
|
cwd: cwd
|
|
361
282
|
})
|
|
362
283
|
];
|
|
@@ -366,12 +287,11 @@ export var buildCjs = function() {
|
|
|
366
287
|
return [
|
|
367
288
|
4,
|
|
368
289
|
runCommand("pnpm", [
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
'-d',
|
|
290
|
+
"swc",
|
|
291
|
+
"src",
|
|
292
|
+
"-C",
|
|
293
|
+
"module.type=commonjs",
|
|
294
|
+
"-d",
|
|
375
295
|
cjsPath
|
|
376
296
|
], {
|
|
377
297
|
cwd: cwd
|
|
@@ -379,7 +299,7 @@ export var buildCjs = function() {
|
|
|
379
299
|
];
|
|
380
300
|
case 2:
|
|
381
301
|
_state.sent();
|
|
382
|
-
targetPath = path.resolve(cwd, cjsPath,
|
|
302
|
+
targetPath = path.resolve(cwd, cjsPath, "package.json");
|
|
383
303
|
return [
|
|
384
304
|
4,
|
|
385
305
|
ensureDir(path.dirname(targetPath))
|
|
@@ -398,17 +318,18 @@ export var buildCjs = function() {
|
|
|
398
318
|
}
|
|
399
319
|
});
|
|
400
320
|
});
|
|
401
|
-
return function buildCjs(
|
|
321
|
+
return function buildCjs() {
|
|
402
322
|
return _ref.apply(this, arguments);
|
|
403
323
|
};
|
|
404
324
|
}();
|
|
405
325
|
export var makeBaseExports = function() {
|
|
406
|
-
var _ref = _async_to_generator(function(
|
|
326
|
+
var _ref = _async_to_generator(function() {
|
|
407
327
|
var options, _options_cwd, cwd, exp, _tmp, baseMap;
|
|
328
|
+
var _arguments = arguments;
|
|
408
329
|
return _ts_generator(this, function(_state) {
|
|
409
330
|
switch(_state.label){
|
|
410
331
|
case 0:
|
|
411
|
-
options =
|
|
332
|
+
options = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : getDefaultOptions();
|
|
412
333
|
cwd = (_options_cwd = options.cwd) !== null && _options_cwd !== void 0 ? _options_cwd : process.cwd();
|
|
413
334
|
_tmp = options.exports;
|
|
414
335
|
if (_tmp) return [
|
|
@@ -426,10 +347,10 @@ export var makeBaseExports = function() {
|
|
|
426
347
|
exp = _tmp;
|
|
427
348
|
// Let's validate the exports
|
|
428
349
|
if (!exp) {
|
|
429
|
-
throw new Error(
|
|
350
|
+
throw new Error("No exports found");
|
|
430
351
|
}
|
|
431
|
-
if (
|
|
432
|
-
throw new Error(
|
|
352
|
+
if (typeof exp !== "object" && Array.isArray(exp)) {
|
|
353
|
+
throw new Error("Exports must be an object");
|
|
433
354
|
}
|
|
434
355
|
return [
|
|
435
356
|
4,
|
|
@@ -454,7 +375,7 @@ export var makeBaseExports = function() {
|
|
|
454
375
|
}
|
|
455
376
|
});
|
|
456
377
|
});
|
|
457
|
-
return function makeBaseExports(
|
|
378
|
+
return function makeBaseExports() {
|
|
458
379
|
return _ref.apply(this, arguments);
|
|
459
380
|
};
|
|
460
381
|
}();
|
|
@@ -496,11 +417,11 @@ var processEntry = function() {
|
|
|
496
417
|
case 0:
|
|
497
418
|
cjsExportsPromise = Promise.resolve([]);
|
|
498
419
|
if (!options.noCJS) {
|
|
499
|
-
cjsExportsPromise = extractBaseExportsFromEntry(entry,
|
|
420
|
+
cjsExportsPromise = extractBaseExportsFromEntry(entry, "cjs", options);
|
|
500
421
|
}
|
|
501
422
|
typesExportsPromise = Promise.resolve([]);
|
|
502
423
|
if (!options.noTypes) {
|
|
503
|
-
typesExportsPromise = extractBaseExportsFromEntry(entry,
|
|
424
|
+
typesExportsPromise = extractBaseExportsFromEntry(entry, "types", options);
|
|
504
425
|
}
|
|
505
426
|
return [
|
|
506
427
|
4,
|
|
@@ -530,16 +451,16 @@ var extractBaseExportsFromEntry = function() {
|
|
|
530
451
|
_param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
|
|
531
452
|
cwd = (_options_cwd = options.cwd) !== null && _options_cwd !== void 0 ? _options_cwd : process.cwd();
|
|
532
453
|
assert([
|
|
533
|
-
|
|
534
|
-
|
|
454
|
+
"cjs",
|
|
455
|
+
"types"
|
|
535
456
|
].includes(type), "The type of the entry ".concat(key, ' must be "cjs" | "types". ').concat(type, " given"));
|
|
536
457
|
// We need to make sure the * is ONLY once at most and is at the end of the key
|
|
537
458
|
hasWildcard = /^[^*]*\*$/.test(key);
|
|
538
|
-
if (key.includes(
|
|
459
|
+
if (key.includes("*") && !hasWildcard) {
|
|
539
460
|
throw new Error("Only 1 wildcard at the end of the export path is allowed. Provided ".concat(key));
|
|
540
461
|
}
|
|
541
|
-
exportTypeKey = type ===
|
|
542
|
-
if (
|
|
462
|
+
exportTypeKey = type === "cjs" ? "require" : "types";
|
|
463
|
+
if (typeof value !== "object" || !value || Array.isArray(value) || !(exportTypeKey in value) || typeof value[exportTypeKey] === "undefined") {
|
|
543
464
|
throw new Error("Missing key ".concat(exportTypeKey, " from the exports map of ").concat(key, ". If this is desired, then set it to null."));
|
|
544
465
|
}
|
|
545
466
|
exportKeyValue = value[exportTypeKey];
|
|
@@ -549,11 +470,11 @@ var extractBaseExportsFromEntry = function() {
|
|
|
549
470
|
[]
|
|
550
471
|
];
|
|
551
472
|
}
|
|
552
|
-
if (typeof exportKeyValue !==
|
|
473
|
+
if (typeof exportKeyValue !== "string") {
|
|
553
474
|
throw new Error('Only strings are allowed in the "'.concat(exportTypeKey, '" field'));
|
|
554
475
|
}
|
|
555
|
-
asteriskPosition = exportKeyValue.replace(
|
|
556
|
-
return p.startsWith(
|
|
476
|
+
asteriskPosition = exportKeyValue.replace("./", "").split("/").findIndex(function(p) {
|
|
477
|
+
return p.startsWith("*");
|
|
557
478
|
});
|
|
558
479
|
return [
|
|
559
480
|
4,
|
|
@@ -569,13 +490,13 @@ var extractBaseExportsFromEntry = function() {
|
|
|
569
490
|
case 0:
|
|
570
491
|
finalKey = key;
|
|
571
492
|
if (hasWildcard) {
|
|
572
|
-
finalKey = key.replace(
|
|
493
|
+
finalKey = key.replace("*", p.split("/").slice(asteriskPosition, asteriskPosition + 1).join("/"));
|
|
573
494
|
}
|
|
574
|
-
if (finalKey ===
|
|
575
|
-
finalKey =
|
|
495
|
+
if (finalKey === "." || finalKey === "./") {
|
|
496
|
+
finalKey = "index";
|
|
576
497
|
}
|
|
577
|
-
content =
|
|
578
|
-
targetFile =
|
|
498
|
+
content = "";
|
|
499
|
+
targetFile = "";
|
|
579
500
|
geImportPaths = function(importPath) {
|
|
580
501
|
var targetFile = path.resolve(cwd, importPath);
|
|
581
502
|
var importFromPath = path.dirname(targetFile);
|
|
@@ -587,13 +508,13 @@ var extractBaseExportsFromEntry = function() {
|
|
|
587
508
|
targetFile: targetFile
|
|
588
509
|
};
|
|
589
510
|
};
|
|
590
|
-
if (!(type ===
|
|
511
|
+
if (!(type === "cjs")) return [
|
|
591
512
|
3,
|
|
592
513
|
2
|
|
593
514
|
];
|
|
594
515
|
return [
|
|
595
516
|
4,
|
|
596
|
-
resolvePathWithExtension(finalKey,
|
|
517
|
+
resolvePathWithExtension(finalKey, "cjs")
|
|
597
518
|
];
|
|
598
519
|
case 1:
|
|
599
520
|
finalKey = _state.sent();
|
|
@@ -603,13 +524,13 @@ var extractBaseExportsFromEntry = function() {
|
|
|
603
524
|
content = "module.exports = require('".concat(formatImportPath(relativeImportPath), "')");
|
|
604
525
|
_state.label = 2;
|
|
605
526
|
case 2:
|
|
606
|
-
if (!(type ===
|
|
527
|
+
if (!(type === "types")) return [
|
|
607
528
|
3,
|
|
608
529
|
5
|
|
609
530
|
];
|
|
610
531
|
return [
|
|
611
532
|
4,
|
|
612
|
-
resolvePathWithExtension(finalKey,
|
|
533
|
+
resolvePathWithExtension(finalKey, "d.ts")
|
|
613
534
|
];
|
|
614
535
|
case 3:
|
|
615
536
|
finalKey = _state.sent();
|
|
@@ -617,10 +538,10 @@ var extractBaseExportsFromEntry = function() {
|
|
|
617
538
|
relativeImportPath1 = importPaths1.relativeImportPath;
|
|
618
539
|
targetFile = importPaths1.targetFile;
|
|
619
540
|
// Typescript will complain about exprting .d.ts, so we just omt that
|
|
620
|
-
content = "export * from '".concat(formatImportPath(relativeImportPath1).replace(
|
|
541
|
+
content = "export * from '".concat(formatImportPath(relativeImportPath1).replace(".d.ts", ""), "'");
|
|
621
542
|
return [
|
|
622
543
|
4,
|
|
623
|
-
fs.readFile(importPaths1.fullImportPath,
|
|
544
|
+
fs.readFile(importPaths1.fullImportPath, "utf-8")
|
|
624
545
|
];
|
|
625
546
|
case 4:
|
|
626
547
|
fileContent = _state.sent();
|
|
@@ -684,6 +605,11 @@ var resolvePathWithExtension = function() {
|
|
|
684
605
|
2,
|
|
685
606
|
"".concat(targetFile, "/index.").concat(extension)
|
|
686
607
|
];
|
|
608
|
+
} else {
|
|
609
|
+
return [
|
|
610
|
+
2,
|
|
611
|
+
"".concat(targetFile, ".").concat(extension)
|
|
612
|
+
];
|
|
687
613
|
}
|
|
688
614
|
return [
|
|
689
615
|
3,
|
|
@@ -692,25 +618,12 @@ var resolvePathWithExtension = function() {
|
|
|
692
618
|
case 2:
|
|
693
619
|
e = _state.sent();
|
|
694
620
|
return [
|
|
695
|
-
|
|
696
|
-
|
|
621
|
+
2,
|
|
622
|
+
"".concat(targetFile, ".").concat(extension)
|
|
697
623
|
];
|
|
698
624
|
case 3:
|
|
699
|
-
if (targetFile.endsWith(extension)) {
|
|
700
|
-
return [
|
|
701
|
-
2,
|
|
702
|
-
targetFile
|
|
703
|
-
];
|
|
704
|
-
}
|
|
705
|
-
if (targetFile.endsWith(".js")) {
|
|
706
|
-
return [
|
|
707
|
-
2,
|
|
708
|
-
targetFile.replace(/\.js$/, ".".concat(extension))
|
|
709
|
-
];
|
|
710
|
-
}
|
|
711
625
|
return [
|
|
712
|
-
2
|
|
713
|
-
"".concat(targetFile, ".").concat(extension)
|
|
626
|
+
2
|
|
714
627
|
];
|
|
715
628
|
}
|
|
716
629
|
});
|
|
@@ -720,7 +633,7 @@ var resolvePathWithExtension = function() {
|
|
|
720
633
|
};
|
|
721
634
|
}();
|
|
722
635
|
var formatImportPath = function(exportPath) {
|
|
723
|
-
return exportPath.startsWith(
|
|
636
|
+
return exportPath.startsWith(".") ? exportPath : "./".concat(exportPath);
|
|
724
637
|
};
|
|
725
638
|
var parseExportPath = function() {
|
|
726
639
|
var _ref = _async_to_generator(function(exportPath) {
|
|
@@ -730,7 +643,7 @@ var parseExportPath = function() {
|
|
|
730
643
|
switch(_state.label){
|
|
731
644
|
case 0:
|
|
732
645
|
cwd = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : process.cwd();
|
|
733
|
-
split = exportPath.split(
|
|
646
|
+
split = exportPath.split("*");
|
|
734
647
|
if (split.length === 1) {
|
|
735
648
|
return [
|
|
736
649
|
2,
|
|
@@ -741,7 +654,7 @@ var parseExportPath = function() {
|
|
|
741
654
|
}
|
|
742
655
|
// Allow only 1 * in the path
|
|
743
656
|
if (split.length > 2) {
|
|
744
|
-
throw new Error(
|
|
657
|
+
throw new Error("Invalid export path. Only one * is allowed");
|
|
745
658
|
}
|
|
746
659
|
return [
|
|
747
660
|
4,
|
|
@@ -763,19 +676,19 @@ var parseExportPath = function() {
|
|
|
763
676
|
};
|
|
764
677
|
}();
|
|
765
678
|
export var buildEsm = function() {
|
|
766
|
-
var _ref = _async_to_generator(function(
|
|
679
|
+
var _ref = _async_to_generator(function() {
|
|
767
680
|
var options, _options_destination;
|
|
681
|
+
var _arguments = arguments;
|
|
768
682
|
return _ts_generator(this, function(_state) {
|
|
769
683
|
switch(_state.label){
|
|
770
684
|
case 0:
|
|
771
|
-
options =
|
|
685
|
+
options = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : getDefaultOptions();
|
|
772
686
|
return [
|
|
773
687
|
4,
|
|
774
688
|
runCommand("pnpm", [
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
'-d',
|
|
689
|
+
"swc",
|
|
690
|
+
"src",
|
|
691
|
+
"-d",
|
|
779
692
|
(_options_destination = options.destination) !== null && _options_destination !== void 0 ? _options_destination : getDefaultOptions().destination
|
|
780
693
|
], {
|
|
781
694
|
cwd: options.cwd
|
|
@@ -789,7 +702,7 @@ export var buildEsm = function() {
|
|
|
789
702
|
}
|
|
790
703
|
});
|
|
791
704
|
});
|
|
792
|
-
return function buildEsm(
|
|
705
|
+
return function buildEsm() {
|
|
793
706
|
return _ref.apply(this, arguments);
|
|
794
707
|
};
|
|
795
708
|
}();
|
|
@@ -804,7 +717,7 @@ var parseExports = function() {
|
|
|
804
717
|
_ = JSON.parse;
|
|
805
718
|
return [
|
|
806
719
|
4,
|
|
807
|
-
fs.readFile(path.join(cwd,
|
|
720
|
+
fs.readFile(path.join(cwd, "package.json"), "utf-8")
|
|
808
721
|
];
|
|
809
722
|
case 1:
|
|
810
723
|
pkg = _.apply(JSON, [
|
package/dist/clean.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../src/clean.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,MAAM,WAAW,YAAa,SAAQ,WAAW,EAAE,MAAM;IACvD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,GAAG,CAAC,EAAE,OAAO,CAAA;CACd;AAED,eAAO,MAAM,KAAK,gBAAsB,YAAY,
|
|
1
|
+
{"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../src/clean.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,MAAM,WAAW,YAAa,SAAQ,WAAW,EAAE,MAAM;IACvD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,GAAG,CAAC,EAAE,OAAO,CAAA;CACd;AAED,eAAO,MAAM,KAAK,gBAAsB,YAAY,kBA6BnD,CAAA"}
|
package/dist/clean.js
CHANGED
|
@@ -175,8 +175,8 @@ function _ts_generator(thisArg, body) {
|
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
-
import path from
|
|
179
|
-
import { getDefaultOptions, runCommand, validatePackageJson } from
|
|
178
|
+
import path from "node:path";
|
|
179
|
+
import { getDefaultOptions, runCommand, validatePackageJson } from "./utils.js";
|
|
180
180
|
export var clean = function() {
|
|
181
181
|
var _ref = _async_to_generator(function() {
|
|
182
182
|
var rawOptions, _$_object_spread, cwd, destination, cleanTs, all, rawDoNotCleanup, doNotCleanup;
|
|
@@ -189,26 +189,26 @@ export var clean = function() {
|
|
|
189
189
|
return [
|
|
190
190
|
4,
|
|
191
191
|
validatePackageJson({
|
|
192
|
-
command:
|
|
192
|
+
command: "del",
|
|
193
193
|
cwd: cwd
|
|
194
194
|
})
|
|
195
195
|
];
|
|
196
196
|
case 1:
|
|
197
197
|
_state.sent();
|
|
198
|
-
doNotCleanup =
|
|
198
|
+
doNotCleanup = rawDoNotCleanup.map(function(f) {
|
|
199
199
|
return "!".concat(f);
|
|
200
|
-
})
|
|
200
|
+
});
|
|
201
201
|
if (!all) return [
|
|
202
202
|
3,
|
|
203
203
|
3
|
|
204
204
|
];
|
|
205
205
|
return [
|
|
206
206
|
4,
|
|
207
|
-
runCommand(
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
207
|
+
runCommand("pnpm", [
|
|
208
|
+
"del",
|
|
209
|
+
"**/*.cjs",
|
|
210
|
+
"**/*.d.ts",
|
|
211
|
+
"tsconfig.tsbuildinfo"
|
|
212
212
|
].concat(_to_consumable_array(doNotCleanup)), {
|
|
213
213
|
cwd: cwd
|
|
214
214
|
})
|
|
@@ -219,9 +219,9 @@ export var clean = function() {
|
|
|
219
219
|
case 3:
|
|
220
220
|
return [
|
|
221
221
|
4,
|
|
222
|
-
runCommand(
|
|
223
|
-
|
|
224
|
-
path.resolve(destination,
|
|
222
|
+
runCommand("pnpm", [
|
|
223
|
+
"del",
|
|
224
|
+
path.resolve(destination, "**/*.js")
|
|
225
225
|
].concat(_to_consumable_array(doNotCleanup)), {
|
|
226
226
|
cwd: cwd
|
|
227
227
|
})
|
|
@@ -234,10 +234,10 @@ export var clean = function() {
|
|
|
234
234
|
];
|
|
235
235
|
return [
|
|
236
236
|
4,
|
|
237
|
-
runCommand(
|
|
238
|
-
|
|
239
|
-
path.resolve(destination,
|
|
240
|
-
path.resolve(destination,
|
|
237
|
+
runCommand("pnpm", [
|
|
238
|
+
"del",
|
|
239
|
+
path.resolve(destination, "**/*.d.ts"),
|
|
240
|
+
path.resolve(destination, "tsconfig.tsbuildinfo")
|
|
241
241
|
].concat(_to_consumable_array(doNotCleanup)), {
|
|
242
242
|
cwd: cwd
|
|
243
243
|
})
|
package/dist/config.d.ts
CHANGED
|
@@ -7,21 +7,13 @@ interface ParseConfigOptions {
|
|
|
7
7
|
}
|
|
8
8
|
declare const ConfigValidation: z.ZodObject<{
|
|
9
9
|
doNotCleanup: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
10
|
-
noCJS: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
|
|
11
|
-
copyVerbatim: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
12
10
|
}, "strip", z.ZodTypeAny, {
|
|
13
11
|
doNotCleanup?: string[] | undefined;
|
|
14
|
-
noCJS?: boolean | undefined;
|
|
15
|
-
copyVerbatim?: string[] | undefined;
|
|
16
12
|
}, {
|
|
17
13
|
doNotCleanup?: string[] | undefined;
|
|
18
|
-
noCJS?: boolean | undefined;
|
|
19
|
-
copyVerbatim?: string[] | undefined;
|
|
20
14
|
}>;
|
|
21
15
|
export declare const parseConfig: (options?: ParseConfigOptions) => Promise<{
|
|
22
16
|
doNotCleanup?: string[] | undefined;
|
|
23
|
-
noCJS?: boolean | undefined;
|
|
24
|
-
copyVerbatim?: string[] | undefined;
|
|
25
17
|
}>;
|
|
26
18
|
export {};
|
|
27
19
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAErD,UAAU,kBAAkB;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED,QAAA,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAErD,UAAU,kBAAkB;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED,QAAA,MAAM,gBAAgB;;;;;;EAEV,CAAA;AAEZ,eAAO,MAAM,WAAW,aAAoB,kBAAkB;;EAiB7D,CAAA"}
|