@reliverse/dler 1.5.7 → 1.6.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/README.md +3 -3
- package/bin/init/info.js +1 -1
- package/bin/init/init.js +21 -0
- package/bin/libs/sdk/default.js +1 -0
- package/bin/libs/sdk/sdk-impl/build/build-library.js +2 -2
- package/bin/libs/sdk/sdk-impl/build/build-regular.js +2 -2
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/build.js +3 -3
- package/bin/libs/sdk/sdk-impl/spell/spell-executors.d.ts +0 -5
- package/bin/libs/sdk/sdk-impl/spell/spell-executors.js +0 -287
- package/bin/libs/sdk/sdk-impl/spell/spell-parser.js +2 -2
- package/bin/libs/sdk/sdk-impl/spell/spell-types.d.ts +1 -27
- package/bin/libs/sdk/sdk-mod.d.ts +47 -47
- package/bin/libs/sdk/sdk-types.d.ts +8 -1
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -242,9 +242,9 @@ libslist: {
|
|
|
242
242
|
- `// dler-replace-line` tells dler to grab the contents of `../../types.ts` and inject them directly in place of your command definition.
|
|
243
243
|
|
|
244
244
|
```ts
|
|
245
|
-
export * from "../../types
|
|
245
|
+
export * from "../../types"; // dler-replace-line
|
|
246
246
|
// or:
|
|
247
|
-
export type { specificTypeName1, specificTypeName2 } from "../../types
|
|
247
|
+
export type { specificTypeName1, specificTypeName2 } from "../../types"; // dler-replace-line
|
|
248
248
|
```
|
|
249
249
|
|
|
250
250
|
- more magic commands coming soon...
|
|
@@ -374,7 +374,7 @@ params are optional and comma-separated.
|
|
|
374
374
|
|
|
375
375
|
**usage examples:**
|
|
376
376
|
|
|
377
|
-
- `export * from "../../types
|
|
377
|
+
- `export * from "../../types"; // dler-replace-line` — injects file contents at this line (hooked=true by default)
|
|
378
378
|
- `// @ts-expect-error dler-remove-comment` — removes just this comment (hooked=true by default)
|
|
379
379
|
- `// dler-remove-line` — removes this line (hooked=true by default)
|
|
380
380
|
- `// dler-remove-file` — deletes this file (hooked=true by default)
|
package/bin/init/info.js
CHANGED
package/bin/init/init.js
CHANGED
|
@@ -161,6 +161,7 @@ export default defineConfig({
|
|
|
161
161
|
},
|
|
162
162
|
},
|
|
163
163
|
// Build setup
|
|
164
|
+
transpileFailOnWarn: ${DEFAULT_CONFIG.transpileFailOnWarn},
|
|
164
165
|
transpileEsbuild: "${DEFAULT_CONFIG.transpileEsbuild}",
|
|
165
166
|
transpileFormat: "${DEFAULT_CONFIG.transpileFormat}",
|
|
166
167
|
transpileMinify: ${DEFAULT_CONFIG.transpileMinify},
|
|
@@ -170,6 +171,26 @@ export default defineConfig({
|
|
|
170
171
|
transpileStub: ${DEFAULT_CONFIG.transpileStub},
|
|
171
172
|
transpileTarget: "${DEFAULT_CONFIG.transpileTarget}",
|
|
172
173
|
transpileWatch: ${DEFAULT_CONFIG.transpileWatch},
|
|
174
|
+
transpileAlias: {},
|
|
175
|
+
transpileEntries: [],
|
|
176
|
+
transpileExternals: [],
|
|
177
|
+
transpileClean: true,
|
|
178
|
+
transpileParallel: false,
|
|
179
|
+
transpileReplace: {},
|
|
180
|
+
transpileRollup: {
|
|
181
|
+
alias: {},
|
|
182
|
+
commonjs: {},
|
|
183
|
+
dts: {},
|
|
184
|
+
esbuild: {},
|
|
185
|
+
json: {},
|
|
186
|
+
replace: {},
|
|
187
|
+
resolve: {},
|
|
188
|
+
},
|
|
189
|
+
transpileShowOutLog: false,
|
|
190
|
+
transpileStubOptions: {
|
|
191
|
+
jiti: {},
|
|
192
|
+
},
|
|
193
|
+
transpileWatchOptions: undefined,
|
|
173
194
|
});
|
|
174
195
|
`;
|
|
175
196
|
return configTemplate;
|
package/bin/libs/sdk/default.js
CHANGED
|
@@ -601,7 +601,7 @@ async function library_performCommonBuildSteps(params) {
|
|
|
601
601
|
await convertImportsAliasToRelative({
|
|
602
602
|
targetDir: outDirBin,
|
|
603
603
|
aliasToReplace: ALIAS_PREFIX_TO_CONVERT,
|
|
604
|
-
pathExtFilter: "js"
|
|
604
|
+
pathExtFilter: "js-ts-none"
|
|
605
605
|
});
|
|
606
606
|
if (isJsr) {
|
|
607
607
|
relinka(
|
|
@@ -610,7 +610,7 @@ async function library_performCommonBuildSteps(params) {
|
|
|
610
610
|
);
|
|
611
611
|
await convertImportsExt({
|
|
612
612
|
targetDir: outDirBin,
|
|
613
|
-
extFrom: "
|
|
613
|
+
extFrom: "none",
|
|
614
614
|
extTo: "ts"
|
|
615
615
|
});
|
|
616
616
|
}
|
|
@@ -378,7 +378,7 @@ async function regular_performCommonBuildSteps({
|
|
|
378
378
|
await convertImportsAliasToRelative({
|
|
379
379
|
targetDir: outDirBin,
|
|
380
380
|
aliasToReplace: ALIAS_PREFIX_TO_CONVERT,
|
|
381
|
-
pathExtFilter: "js"
|
|
381
|
+
pathExtFilter: "js-ts-none"
|
|
382
382
|
});
|
|
383
383
|
if (isJsr) {
|
|
384
384
|
relinka(
|
|
@@ -387,7 +387,7 @@ async function regular_performCommonBuildSteps({
|
|
|
387
387
|
);
|
|
388
388
|
await convertImportsExt({
|
|
389
389
|
targetDir: outDirBin,
|
|
390
|
-
extFrom: "
|
|
390
|
+
extFrom: "none",
|
|
391
391
|
extTo: "ts"
|
|
392
392
|
});
|
|
393
393
|
}
|
|
@@ -80,7 +80,7 @@ async function _build(rootDir, inputConfig, buildConfig, pkg, cleanedDirs, _tran
|
|
|
80
80
|
...Module.builtinModules,
|
|
81
81
|
...Module.builtinModules.map((m) => `node:${m}`)
|
|
82
82
|
],
|
|
83
|
-
|
|
83
|
+
transpileFailOnWarn: true,
|
|
84
84
|
name: (pkg?.name || "").split("/").pop() || "default",
|
|
85
85
|
outDir,
|
|
86
86
|
parallel: false,
|
|
@@ -312,10 +312,10 @@ ${entry.modules.filter((m) => m.id.includes("node_modules")).sort((a, b) => (b.b
|
|
|
312
312
|
`Build is done with some warnings:
|
|
313
313
|
${[...ctx.warnings].map((msg) => `- ${msg}`).join("\n")}`
|
|
314
314
|
);
|
|
315
|
-
if (ctx.options.
|
|
315
|
+
if (ctx.options.transpileFailOnWarn) {
|
|
316
316
|
relinka(
|
|
317
317
|
"error",
|
|
318
|
-
"Exiting with code (1). You can change this behavior by setting `
|
|
318
|
+
"Exiting with code (1). You can change this behavior by setting `transpileFailOnWarn: false` ."
|
|
319
319
|
);
|
|
320
320
|
process.exit(1);
|
|
321
321
|
}
|
|
@@ -8,8 +8,3 @@ export declare const copyFileExecutor: (spell: Spell, filePath: string) => Promi
|
|
|
8
8
|
export declare const moveFileExecutor: (spell: Spell, filePath: string) => Promise<SpellResult>;
|
|
9
9
|
export declare const transformContentExecutor: (spell: Spell, filePath: string, content: string) => Promise<SpellResult>;
|
|
10
10
|
export declare const insertAtExecutor: (spell: Spell, filePath: string, content: string) => Promise<SpellResult>;
|
|
11
|
-
export declare const replaceRangeExecutor: (spell: Spell, filePath: string, content: string) => Promise<SpellResult>;
|
|
12
|
-
export declare const transformLineExecutor: (spell: Spell, filePath: string, content: string) => Promise<SpellResult>;
|
|
13
|
-
export declare const insertBeforeExecutor: (spell: Spell, filePath: string, content: string) => Promise<SpellResult>;
|
|
14
|
-
export declare const insertAfterExecutor: (spell: Spell, filePath: string, content: string) => Promise<SpellResult>;
|
|
15
|
-
export declare const conditionalExecuteExecutor: (spell: Spell, filePath: string, content: string) => Promise<SpellResult>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import path from "@reliverse/pathkit";
|
|
2
2
|
import * as fs from "./spell-filesystem.js";
|
|
3
|
-
import { executeSpell } from "./spell-mod.js";
|
|
4
3
|
export const replaceLineExecutor = async (spell, filePath, content) => {
|
|
5
4
|
if (!spell.lineNumber) {
|
|
6
5
|
return {
|
|
@@ -236,38 +235,6 @@ export const transformContentExecutor = async (spell, filePath, content) => {
|
|
|
236
235
|
}
|
|
237
236
|
);
|
|
238
237
|
break;
|
|
239
|
-
case "update-dependencies":
|
|
240
|
-
if (filePath.endsWith("package.json")) {
|
|
241
|
-
const pkg = JSON.parse(content);
|
|
242
|
-
let newDeps = { ...pkg.dependencies };
|
|
243
|
-
if (newDeps.pathe) {
|
|
244
|
-
const { ...rest } = newDeps;
|
|
245
|
-
newDeps = rest;
|
|
246
|
-
}
|
|
247
|
-
let newDevDeps = { ...pkg.devDependencies };
|
|
248
|
-
if (newDevDeps.pathe) {
|
|
249
|
-
const { ...rest } = newDevDeps;
|
|
250
|
-
newDevDeps = rest;
|
|
251
|
-
}
|
|
252
|
-
newDeps["@reliverse/pathkit"] = "latest";
|
|
253
|
-
const newPkg = {
|
|
254
|
-
...pkg,
|
|
255
|
-
dependencies: newDeps,
|
|
256
|
-
devDependencies: newDevDeps
|
|
257
|
-
};
|
|
258
|
-
newContent = JSON.stringify(newPkg, null, 2);
|
|
259
|
-
} else {
|
|
260
|
-
return {
|
|
261
|
-
spell,
|
|
262
|
-
file: filePath,
|
|
263
|
-
success: false,
|
|
264
|
-
message: "update-dependencies can only be used on package.json"
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
break;
|
|
268
|
-
case "update-imports":
|
|
269
|
-
newContent = content.replace(/from\s+['"]pathe['"]/g, 'from "@reliverse/pathkit"').replace(/from\s+['"]@unjs\/pathe['"]/g, 'from "@reliverse/pathkit"');
|
|
270
|
-
break;
|
|
271
238
|
default:
|
|
272
239
|
return {
|
|
273
240
|
spell,
|
|
@@ -338,257 +305,3 @@ export const insertAtExecutor = async (spell, filePath, content) => {
|
|
|
338
305
|
};
|
|
339
306
|
}
|
|
340
307
|
};
|
|
341
|
-
export const replaceRangeExecutor = async (spell, filePath, content) => {
|
|
342
|
-
if (!spell.lineNumber || !spell.params.startLine || !spell.params.endLine) {
|
|
343
|
-
return {
|
|
344
|
-
spell,
|
|
345
|
-
file: filePath,
|
|
346
|
-
success: false,
|
|
347
|
-
message: "Line numbers not provided"
|
|
348
|
-
};
|
|
349
|
-
}
|
|
350
|
-
if (!spell.value) {
|
|
351
|
-
return {
|
|
352
|
-
spell,
|
|
353
|
-
file: filePath,
|
|
354
|
-
success: false,
|
|
355
|
-
message: "Target file not specified"
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
const includeFilePath = path.resolve(path.dirname(filePath), spell.value);
|
|
359
|
-
try {
|
|
360
|
-
const includeContent = await fs.readFile(includeFilePath);
|
|
361
|
-
const lines = content.split("\n");
|
|
362
|
-
const start = spell.params.startLine - 1;
|
|
363
|
-
const end = spell.params.endLine;
|
|
364
|
-
const originalLines = lines.slice(start, end);
|
|
365
|
-
lines.splice(start, end - start, ...includeContent.trim().split("\n"));
|
|
366
|
-
const newContent = lines.join("\n");
|
|
367
|
-
await fs.writeFile(filePath, newContent);
|
|
368
|
-
return {
|
|
369
|
-
spell,
|
|
370
|
-
file: filePath,
|
|
371
|
-
success: true,
|
|
372
|
-
message: `Lines ${spell.params.startLine}-${spell.params.endLine} replaced with content from ${includeFilePath}`,
|
|
373
|
-
changes: {
|
|
374
|
-
before: originalLines.join("\n"),
|
|
375
|
-
after: includeContent.trim()
|
|
376
|
-
},
|
|
377
|
-
details: {
|
|
378
|
-
linesAffected: Array.from(
|
|
379
|
-
{ length: end - start },
|
|
380
|
-
(_, i) => start + i + 1
|
|
381
|
-
)
|
|
382
|
-
}
|
|
383
|
-
};
|
|
384
|
-
} catch (error) {
|
|
385
|
-
return {
|
|
386
|
-
spell,
|
|
387
|
-
file: filePath,
|
|
388
|
-
success: false,
|
|
389
|
-
message: `Failed to replace range: ${error}`
|
|
390
|
-
};
|
|
391
|
-
}
|
|
392
|
-
};
|
|
393
|
-
export const transformLineExecutor = async (spell, filePath, content) => {
|
|
394
|
-
if (!spell.lineNumber) {
|
|
395
|
-
return {
|
|
396
|
-
spell,
|
|
397
|
-
file: filePath,
|
|
398
|
-
success: false,
|
|
399
|
-
message: "Line number not provided"
|
|
400
|
-
};
|
|
401
|
-
}
|
|
402
|
-
if (!spell.value) {
|
|
403
|
-
return {
|
|
404
|
-
spell,
|
|
405
|
-
file: filePath,
|
|
406
|
-
success: false,
|
|
407
|
-
message: "Transformation not specified"
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
try {
|
|
411
|
-
const lines = content.split("\n");
|
|
412
|
-
const originalLine = lines[spell.lineNumber - 1];
|
|
413
|
-
const transformCode = spell.value;
|
|
414
|
-
const transformFn = new Function("line", transformCode);
|
|
415
|
-
const transformedLine = transformFn(originalLine);
|
|
416
|
-
lines[spell.lineNumber - 1] = transformedLine;
|
|
417
|
-
const newContent = lines.join("\n");
|
|
418
|
-
await fs.writeFile(filePath, newContent);
|
|
419
|
-
return {
|
|
420
|
-
spell,
|
|
421
|
-
file: filePath,
|
|
422
|
-
success: true,
|
|
423
|
-
message: "Line transformed",
|
|
424
|
-
changes: {
|
|
425
|
-
before: originalLine ?? "",
|
|
426
|
-
after: transformedLine
|
|
427
|
-
},
|
|
428
|
-
details: {
|
|
429
|
-
linesAffected: [spell.lineNumber]
|
|
430
|
-
}
|
|
431
|
-
};
|
|
432
|
-
} catch (error) {
|
|
433
|
-
return {
|
|
434
|
-
spell,
|
|
435
|
-
file: filePath,
|
|
436
|
-
success: false,
|
|
437
|
-
message: `Failed to transform line: ${error}`
|
|
438
|
-
};
|
|
439
|
-
}
|
|
440
|
-
};
|
|
441
|
-
export const insertBeforeExecutor = async (spell, filePath, content) => {
|
|
442
|
-
if (!spell.lineNumber) {
|
|
443
|
-
return {
|
|
444
|
-
spell,
|
|
445
|
-
file: filePath,
|
|
446
|
-
success: false,
|
|
447
|
-
message: "Line number not provided"
|
|
448
|
-
};
|
|
449
|
-
}
|
|
450
|
-
if (!spell.value) {
|
|
451
|
-
return {
|
|
452
|
-
spell,
|
|
453
|
-
file: filePath,
|
|
454
|
-
success: false,
|
|
455
|
-
message: "Content to insert not specified"
|
|
456
|
-
};
|
|
457
|
-
}
|
|
458
|
-
try {
|
|
459
|
-
const lines = content.split("\n");
|
|
460
|
-
const insertContent = spell.value.split("\n");
|
|
461
|
-
const lineNumber = spell.lineNumber;
|
|
462
|
-
lines.splice(lineNumber - 1, 0, ...insertContent);
|
|
463
|
-
const newContent = lines.join("\n");
|
|
464
|
-
await fs.writeFile(filePath, newContent);
|
|
465
|
-
return {
|
|
466
|
-
spell,
|
|
467
|
-
file: filePath,
|
|
468
|
-
success: true,
|
|
469
|
-
message: "Content inserted before line",
|
|
470
|
-
changes: {
|
|
471
|
-
before: "",
|
|
472
|
-
after: insertContent.join("\n")
|
|
473
|
-
},
|
|
474
|
-
details: {
|
|
475
|
-
linesAffected: Array.from(
|
|
476
|
-
{ length: insertContent.length },
|
|
477
|
-
(_, i) => lineNumber + i
|
|
478
|
-
)
|
|
479
|
-
}
|
|
480
|
-
};
|
|
481
|
-
} catch (error) {
|
|
482
|
-
return {
|
|
483
|
-
spell,
|
|
484
|
-
file: filePath,
|
|
485
|
-
success: false,
|
|
486
|
-
message: `Failed to insert content: ${error}`
|
|
487
|
-
};
|
|
488
|
-
}
|
|
489
|
-
};
|
|
490
|
-
export const insertAfterExecutor = async (spell, filePath, content) => {
|
|
491
|
-
if (!spell.lineNumber) {
|
|
492
|
-
return {
|
|
493
|
-
spell,
|
|
494
|
-
file: filePath,
|
|
495
|
-
success: false,
|
|
496
|
-
message: "Line number not provided"
|
|
497
|
-
};
|
|
498
|
-
}
|
|
499
|
-
if (!spell.value) {
|
|
500
|
-
return {
|
|
501
|
-
spell,
|
|
502
|
-
file: filePath,
|
|
503
|
-
success: false,
|
|
504
|
-
message: "Content to insert not specified"
|
|
505
|
-
};
|
|
506
|
-
}
|
|
507
|
-
try {
|
|
508
|
-
const lines = content.split("\n");
|
|
509
|
-
const insertContent = spell.value.split("\n");
|
|
510
|
-
const lineNumber = spell.lineNumber;
|
|
511
|
-
lines.splice(lineNumber, 0, ...insertContent);
|
|
512
|
-
const newContent = lines.join("\n");
|
|
513
|
-
await fs.writeFile(filePath, newContent);
|
|
514
|
-
return {
|
|
515
|
-
spell,
|
|
516
|
-
file: filePath,
|
|
517
|
-
success: true,
|
|
518
|
-
message: "Content inserted after line",
|
|
519
|
-
changes: {
|
|
520
|
-
before: "",
|
|
521
|
-
after: insertContent.join("\n")
|
|
522
|
-
},
|
|
523
|
-
details: {
|
|
524
|
-
linesAffected: Array.from(
|
|
525
|
-
{ length: insertContent.length },
|
|
526
|
-
(_, i) => lineNumber + i + 1
|
|
527
|
-
)
|
|
528
|
-
}
|
|
529
|
-
};
|
|
530
|
-
} catch (error) {
|
|
531
|
-
return {
|
|
532
|
-
spell,
|
|
533
|
-
file: filePath,
|
|
534
|
-
success: false,
|
|
535
|
-
message: `Failed to insert content: ${error}`
|
|
536
|
-
};
|
|
537
|
-
}
|
|
538
|
-
};
|
|
539
|
-
export const conditionalExecuteExecutor = async (spell, filePath, content) => {
|
|
540
|
-
if (!spell.params.condition) {
|
|
541
|
-
return {
|
|
542
|
-
spell,
|
|
543
|
-
file: filePath,
|
|
544
|
-
success: false,
|
|
545
|
-
message: "Condition not provided"
|
|
546
|
-
};
|
|
547
|
-
}
|
|
548
|
-
try {
|
|
549
|
-
const conditionFn = new Function(
|
|
550
|
-
"content",
|
|
551
|
-
"filePath",
|
|
552
|
-
spell.params.condition
|
|
553
|
-
);
|
|
554
|
-
const shouldExecute = conditionFn(content, filePath);
|
|
555
|
-
if (!shouldExecute) {
|
|
556
|
-
return {
|
|
557
|
-
spell,
|
|
558
|
-
file: filePath,
|
|
559
|
-
success: true,
|
|
560
|
-
message: "Condition not met, skipping execution"
|
|
561
|
-
};
|
|
562
|
-
}
|
|
563
|
-
if (!spell.dependsOn?.length) {
|
|
564
|
-
return {
|
|
565
|
-
spell,
|
|
566
|
-
file: filePath,
|
|
567
|
-
success: false,
|
|
568
|
-
message: "No dependent spells specified"
|
|
569
|
-
};
|
|
570
|
-
}
|
|
571
|
-
const results = [];
|
|
572
|
-
for (const dependentSpell of spell.dependsOn) {
|
|
573
|
-
const result = await executeSpell(dependentSpell, filePath, content);
|
|
574
|
-
results.push(result);
|
|
575
|
-
}
|
|
576
|
-
const allSuccessful = results.every((r) => r.success);
|
|
577
|
-
return {
|
|
578
|
-
spell,
|
|
579
|
-
file: filePath,
|
|
580
|
-
success: allSuccessful,
|
|
581
|
-
message: allSuccessful ? "All dependent spells executed successfully" : "Some dependent spells failed",
|
|
582
|
-
details: {
|
|
583
|
-
filesAffected: results.map((r) => r.file)
|
|
584
|
-
}
|
|
585
|
-
};
|
|
586
|
-
} catch (error) {
|
|
587
|
-
return {
|
|
588
|
-
spell,
|
|
589
|
-
file: filePath,
|
|
590
|
-
success: false,
|
|
591
|
-
message: `Failed to execute condition: ${error}`
|
|
592
|
-
};
|
|
593
|
-
}
|
|
594
|
-
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const SPELL_REGEX =
|
|
1
|
+
const SPELL_REGEX = /<dler-([a-z-]+)-(?:"([^"]+)")?-?(?:{([^}]+)})?>/;
|
|
2
2
|
export const parseParams = (paramsStr) => {
|
|
3
3
|
const defaultParams = {
|
|
4
|
-
hooked:
|
|
4
|
+
hooked: false
|
|
5
5
|
};
|
|
6
6
|
if (!paramsStr) return defaultParams;
|
|
7
7
|
const params = { ...defaultParams };
|
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
export type SpellType = "replace-line" | "
|
|
1
|
+
export type SpellType = "replace-line" | "rename-file" | "remove-comment" | "remove-line" | "remove-file" | "transform-content" | "copy-file" | "move-file" | "insert-at";
|
|
2
2
|
export type SpellParams = {
|
|
3
|
-
/** Whether the spell should be executed manually (true) or automatically at postbuild (false) */
|
|
4
3
|
hooked: boolean;
|
|
5
|
-
/** Line number to start the operation (for range operations) */
|
|
6
|
-
startLine?: number;
|
|
7
|
-
/** Line number to end the operation (for range operations) */
|
|
8
|
-
endLine?: number;
|
|
9
|
-
/** Condition to check before executing the spell */
|
|
10
|
-
condition?: string;
|
|
11
|
-
/** Whether to skip the spell if the target file doesn't exist */
|
|
12
|
-
skipIfMissing?: boolean;
|
|
13
|
-
/** Whether to create the target directory if it doesn't exist */
|
|
14
|
-
createDir?: boolean;
|
|
15
|
-
/** Custom parameters for specific spell types */
|
|
16
4
|
[key: string]: any;
|
|
17
5
|
};
|
|
18
6
|
export type Spell = {
|
|
@@ -22,25 +10,17 @@ export type Spell = {
|
|
|
22
10
|
lineNumber?: number;
|
|
23
11
|
fullMatch?: string;
|
|
24
12
|
fileName?: string;
|
|
25
|
-
/** Optional array of spells that must be executed before this one */
|
|
26
|
-
dependsOn?: Spell[];
|
|
27
13
|
};
|
|
28
14
|
export type SpellExecutionOptions = {
|
|
29
15
|
spells?: (SpellType | "all")[];
|
|
30
16
|
files?: string[];
|
|
31
17
|
dryRun?: boolean;
|
|
32
|
-
/** Whether to show detailed changes in the output */
|
|
33
|
-
showChanges?: boolean;
|
|
34
|
-
/** Whether to validate spell parameters before execution */
|
|
35
|
-
validate?: boolean;
|
|
36
18
|
};
|
|
37
19
|
export type FileOperation = {
|
|
38
20
|
type: "read" | "write" | "rename" | "remove" | "copy" | "move";
|
|
39
21
|
sourcePath: string;
|
|
40
22
|
targetPath?: string;
|
|
41
23
|
content?: string;
|
|
42
|
-
/** Whether to create parent directories if they don't exist */
|
|
43
|
-
createDir?: boolean;
|
|
44
24
|
};
|
|
45
25
|
export type SpellResult = {
|
|
46
26
|
spell: Spell;
|
|
@@ -51,10 +31,4 @@ export type SpellResult = {
|
|
|
51
31
|
before: string;
|
|
52
32
|
after: string;
|
|
53
33
|
};
|
|
54
|
-
/** Detailed information about the changes made */
|
|
55
|
-
details?: {
|
|
56
|
-
linesAffected?: number[];
|
|
57
|
-
filesAffected?: string[];
|
|
58
|
-
validationErrors?: string[];
|
|
59
|
-
};
|
|
60
34
|
};
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
export type { LibraryBuildOptions } from "./sdk-impl/build/build-library
|
|
2
|
-
export { library_buildLibrary } from "./sdk-impl/build/build-library
|
|
3
|
-
export { regular_buildJsrDist, regular_buildNpmDist, } from "./sdk-impl/build/build-regular
|
|
4
|
-
export { autoPreset } from "./sdk-impl/build/bundlers/unified/auto
|
|
5
|
-
export { unifiedBuild } from "./sdk-impl/build/bundlers/unified/build
|
|
6
|
-
export { copyBuild } from "./sdk-impl/build/bundlers/unified/copy/copy
|
|
7
|
-
export { mkdistBuild } from "./sdk-impl/build/bundlers/unified/mkdist/mkdist
|
|
8
|
-
export { rollupBuild } from "./sdk-impl/build/bundlers/unified/rollup/build
|
|
9
|
-
export { getRollupOptions } from "./sdk-impl/build/bundlers/unified/rollup/config
|
|
10
|
-
export { cjsPlugin, fixCJSExportTypePlugin, } from "./sdk-impl/build/bundlers/unified/rollup/plugins/cjs
|
|
11
|
-
export { esbuild } from "./sdk-impl/build/bundlers/unified/rollup/plugins/esbuild
|
|
12
|
-
export { JSONPlugin } from "./sdk-impl/build/bundlers/unified/rollup/plugins/json
|
|
13
|
-
export { rawPlugin } from "./sdk-impl/build/bundlers/unified/rollup/plugins/raw
|
|
14
|
-
export { getShebang, makeExecutable, removeShebangPlugin, shebangPlugin, } from "./sdk-impl/build/bundlers/unified/rollup/plugins/shebang
|
|
15
|
-
export { rollupStub } from "./sdk-impl/build/bundlers/unified/rollup/stub
|
|
16
|
-
export { DEFAULT_EXTENSIONS, getChunkFilename, resolveAliases, } from "./sdk-impl/build/bundlers/unified/rollup/utils
|
|
17
|
-
export { rollupWatch } from "./sdk-impl/build/bundlers/unified/rollup/watch
|
|
18
|
-
export { typesBuild } from "./sdk-impl/build/bundlers/unified/untyped/index
|
|
19
|
-
export { arrayIncludes, dumpObject, extractExportFilenames, getpkg, inferPkgExternals, listRecursively, removeExtension, resolvePreset, rmdir, symlink, warn, withTrailingSlash, } from "./sdk-impl/build/bundlers/unified/utils
|
|
20
|
-
export { validateDependencies, validatePackage, } from "./sdk-impl/build/bundlers/unified/validate
|
|
21
|
-
export { processLibraryFlow, libraries_buildPublish, } from "./sdk-impl/library-flow
|
|
22
|
-
export { library_publishLibrary } from "./sdk-impl/pub/pub-library
|
|
23
|
-
export { regular_pubToJsr, regular_pubToNpm, } from "./sdk-impl/pub/pub-regular
|
|
24
|
-
export { processRegularFlow } from "./sdk-impl/regular-flow
|
|
25
|
-
export { replaceLineExecutor, renameFileExecutor, removeCommentExecutor, removeLineExecutor, removeFileExecutor, copyFileExecutor, moveFileExecutor, transformContentExecutor, insertAtExecutor, } from "./sdk-impl/spell/spell-executors
|
|
26
|
-
export { fileExists, readFile, writeFile, removeFile, renameFile, copyFile, findFiles, } from "./sdk-impl/spell/spell-filesystem
|
|
27
|
-
export { executeSpell, processFile, spells, } from "./sdk-impl/spell/spell-mod
|
|
28
|
-
export { parseParams, parseSpellFromComment, extractSpellsFromFile, } from "./sdk-impl/spell/spell-parser
|
|
29
|
-
export type { SpellType, SpellParams, Spell, SpellExecutionOptions, FileOperation, SpellResult, } from "./sdk-impl/spell/spell-types
|
|
30
|
-
export { useAggregator } from "./sdk-impl/utils/tools/tools-agg
|
|
31
|
-
export { printUsage } from "./sdk-impl/utils/tools/tools-impl
|
|
32
|
-
export { getBunSourcemapOption, getUnifiedSourcemapOption, renameEntryFile, } from "./sdk-impl/utils/utils-build
|
|
33
|
-
export { removeDistFolders } from "./sdk-impl/utils/utils-clean
|
|
34
|
-
export { PROJECT_ROOT, CONCURRENCY_DEFAULT, tsconfigJson, cliDomainDocs, validExtensions, SHOW_VERBOSE, } from "./sdk-impl/utils/utils-consts
|
|
35
|
-
export { validateDevCwd, withWorkingDirectory, } from "./sdk-impl/utils/utils-cwd
|
|
36
|
-
export { filterDeps } from "./sdk-impl/utils/utils-deps
|
|
37
|
-
export { determineDistName } from "./sdk-impl/utils/utils-determine
|
|
38
|
-
export { handleDlerError } from "./sdk-impl/utils/utils-error
|
|
39
|
-
export { copyRootFile, getDirectorySize, outDirBinFilesCount, deleteSpecificFiles, readFileSafe, writeFileSafe, } from "./sdk-impl/utils/utils-fs
|
|
40
|
-
export { finalizeBuildPub } from "./sdk-impl/utils/finalize
|
|
41
|
-
export { createJsrJSON, renameTsxFiles, } from "./sdk-impl/utils/utils-jsr-json
|
|
42
|
-
export { extractPackageName } from "./sdk-impl/utils/utils-misc
|
|
43
|
-
export { createPerfTimer, getElapsedPerfTime, pausePerfTimer, resumePerfTimer, } from "./sdk-impl/utils/utils-perf
|
|
44
|
-
export { library_createPackageJSON } from "./sdk-impl/utils/utils-pkg-json-libs
|
|
45
|
-
export { regular_createPackageJSON } from "./sdk-impl/utils/utils-pkg-json-reg
|
|
46
|
-
export { createTSConfig } from "./sdk-impl/utils/utils-tsconfig
|
|
47
|
-
export type { CopyHooks, MkdistHooks, RollupBuildEntry, RollupBuildOptions, RollupHooks, UntypedHooks, UntypedOutput, BaseBuildEntry, BuildHooks, } from "./sdk-types
|
|
1
|
+
export type { LibraryBuildOptions } from "./sdk-impl/build/build-library";
|
|
2
|
+
export { library_buildLibrary } from "./sdk-impl/build/build-library";
|
|
3
|
+
export { regular_buildJsrDist, regular_buildNpmDist, } from "./sdk-impl/build/build-regular";
|
|
4
|
+
export { autoPreset } from "./sdk-impl/build/bundlers/unified/auto";
|
|
5
|
+
export { unifiedBuild } from "./sdk-impl/build/bundlers/unified/build";
|
|
6
|
+
export { copyBuild } from "./sdk-impl/build/bundlers/unified/copy/copy";
|
|
7
|
+
export { mkdistBuild } from "./sdk-impl/build/bundlers/unified/mkdist/mkdist";
|
|
8
|
+
export { rollupBuild } from "./sdk-impl/build/bundlers/unified/rollup/build";
|
|
9
|
+
export { getRollupOptions } from "./sdk-impl/build/bundlers/unified/rollup/config";
|
|
10
|
+
export { cjsPlugin, fixCJSExportTypePlugin, } from "./sdk-impl/build/bundlers/unified/rollup/plugins/cjs";
|
|
11
|
+
export { esbuild } from "./sdk-impl/build/bundlers/unified/rollup/plugins/esbuild";
|
|
12
|
+
export { JSONPlugin } from "./sdk-impl/build/bundlers/unified/rollup/plugins/json";
|
|
13
|
+
export { rawPlugin } from "./sdk-impl/build/bundlers/unified/rollup/plugins/raw";
|
|
14
|
+
export { getShebang, makeExecutable, removeShebangPlugin, shebangPlugin, } from "./sdk-impl/build/bundlers/unified/rollup/plugins/shebang";
|
|
15
|
+
export { rollupStub } from "./sdk-impl/build/bundlers/unified/rollup/stub";
|
|
16
|
+
export { DEFAULT_EXTENSIONS, getChunkFilename, resolveAliases, } from "./sdk-impl/build/bundlers/unified/rollup/utils";
|
|
17
|
+
export { rollupWatch } from "./sdk-impl/build/bundlers/unified/rollup/watch";
|
|
18
|
+
export { typesBuild } from "./sdk-impl/build/bundlers/unified/untyped/index";
|
|
19
|
+
export { arrayIncludes, dumpObject, extractExportFilenames, getpkg, inferPkgExternals, listRecursively, removeExtension, resolvePreset, rmdir, symlink, warn, withTrailingSlash, } from "./sdk-impl/build/bundlers/unified/utils";
|
|
20
|
+
export { validateDependencies, validatePackage, } from "./sdk-impl/build/bundlers/unified/validate";
|
|
21
|
+
export { processLibraryFlow, libraries_buildPublish, } from "./sdk-impl/library-flow";
|
|
22
|
+
export { library_publishLibrary } from "./sdk-impl/pub/pub-library";
|
|
23
|
+
export { regular_pubToJsr, regular_pubToNpm, } from "./sdk-impl/pub/pub-regular";
|
|
24
|
+
export { processRegularFlow } from "./sdk-impl/regular-flow";
|
|
25
|
+
export { replaceLineExecutor, renameFileExecutor, removeCommentExecutor, removeLineExecutor, removeFileExecutor, copyFileExecutor, moveFileExecutor, transformContentExecutor, insertAtExecutor, } from "./sdk-impl/spell/spell-executors";
|
|
26
|
+
export { fileExists, readFile, writeFile, removeFile, renameFile, copyFile, findFiles, } from "./sdk-impl/spell/spell-filesystem";
|
|
27
|
+
export { executeSpell, processFile, spells, } from "./sdk-impl/spell/spell-mod";
|
|
28
|
+
export { parseParams, parseSpellFromComment, extractSpellsFromFile, } from "./sdk-impl/spell/spell-parser";
|
|
29
|
+
export type { SpellType, SpellParams, Spell, SpellExecutionOptions, FileOperation, SpellResult, } from "./sdk-impl/spell/spell-types";
|
|
30
|
+
export { useAggregator } from "./sdk-impl/utils/tools/tools-agg";
|
|
31
|
+
export { printUsage } from "./sdk-impl/utils/tools/tools-impl";
|
|
32
|
+
export { getBunSourcemapOption, getUnifiedSourcemapOption, renameEntryFile, } from "./sdk-impl/utils/utils-build";
|
|
33
|
+
export { removeDistFolders } from "./sdk-impl/utils/utils-clean";
|
|
34
|
+
export { PROJECT_ROOT, CONCURRENCY_DEFAULT, tsconfigJson, cliDomainDocs, validExtensions, SHOW_VERBOSE, } from "./sdk-impl/utils/utils-consts";
|
|
35
|
+
export { validateDevCwd, withWorkingDirectory, } from "./sdk-impl/utils/utils-cwd";
|
|
36
|
+
export { filterDeps } from "./sdk-impl/utils/utils-deps";
|
|
37
|
+
export { determineDistName } from "./sdk-impl/utils/utils-determine";
|
|
38
|
+
export { handleDlerError } from "./sdk-impl/utils/utils-error";
|
|
39
|
+
export { copyRootFile, getDirectorySize, outDirBinFilesCount, deleteSpecificFiles, readFileSafe, writeFileSafe, } from "./sdk-impl/utils/utils-fs";
|
|
40
|
+
export { finalizeBuildPub } from "./sdk-impl/utils/finalize";
|
|
41
|
+
export { createJsrJSON, renameTsxFiles, } from "./sdk-impl/utils/utils-jsr-json";
|
|
42
|
+
export { extractPackageName } from "./sdk-impl/utils/utils-misc";
|
|
43
|
+
export { createPerfTimer, getElapsedPerfTime, pausePerfTimer, resumePerfTimer, } from "./sdk-impl/utils/utils-perf";
|
|
44
|
+
export { library_createPackageJSON } from "./sdk-impl/utils/utils-pkg-json-libs";
|
|
45
|
+
export { regular_createPackageJSON } from "./sdk-impl/utils/utils-pkg-json-reg";
|
|
46
|
+
export { createTSConfig } from "./sdk-impl/utils/utils-tsconfig";
|
|
47
|
+
export type { CopyHooks, MkdistHooks, RollupBuildEntry, RollupBuildOptions, RollupHooks, UntypedHooks, UntypedOutput, BaseBuildEntry, BuildHooks, } from "./sdk-types";
|
|
@@ -323,6 +323,13 @@ export type BuildPublishConfig = {
|
|
|
323
323
|
jsr: string[];
|
|
324
324
|
}>;
|
|
325
325
|
};
|
|
326
|
+
/**
|
|
327
|
+
* When `true`, fails the build if warnings are detected.
|
|
328
|
+
* Use with caution, as it may lead to inconsistent published versions.
|
|
329
|
+
*
|
|
330
|
+
* @default false
|
|
331
|
+
*/
|
|
332
|
+
transpileFailOnWarn: boolean;
|
|
326
333
|
/**
|
|
327
334
|
* The transpileTarget runtime environment for the built package.
|
|
328
335
|
*
|
|
@@ -709,7 +716,7 @@ export type BuildOptions = {
|
|
|
709
716
|
/**
|
|
710
717
|
* Terminate the build process when a warning appears
|
|
711
718
|
*/
|
|
712
|
-
|
|
719
|
+
transpileFailOnWarn?: boolean;
|
|
713
720
|
/**
|
|
714
721
|
* Whether the current build is for a library.
|
|
715
722
|
*/
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
3
|
"@reliverse/bleump": "^1.1.4",
|
|
4
|
-
"@reliverse/pathkit": "^1.
|
|
4
|
+
"@reliverse/pathkit": "^1.2.0",
|
|
5
5
|
"@reliverse/reglob": "^1.0.0",
|
|
6
6
|
"@reliverse/relico": "^1.1.2",
|
|
7
|
-
"@reliverse/relifso": "^1.3.
|
|
7
|
+
"@reliverse/relifso": "^1.3.1",
|
|
8
8
|
"@reliverse/relinka": "^1.4.7",
|
|
9
9
|
"@reliverse/rempts": "^1.7.12",
|
|
10
10
|
"@rollup/plugin-alias": "^5.1.1",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"chalk": "^5.4.1",
|
|
17
17
|
"defu": "^6.1.4",
|
|
18
18
|
"esbuild": "^0.25.4",
|
|
19
|
-
"execa": "^9.
|
|
19
|
+
"execa": "^9.6.0",
|
|
20
20
|
"fix-dts-default-cjs-exports": "^1.0.1",
|
|
21
21
|
"glob": "^11.0.2",
|
|
22
22
|
"hookable": "^5.5.3",
|
|
@@ -34,14 +34,15 @@
|
|
|
34
34
|
"scule": "^1.3.0",
|
|
35
35
|
"tinyglobby": "^0.2.14",
|
|
36
36
|
"ts-morph": "^26.0.0",
|
|
37
|
-
"untyped": "^2.0.0"
|
|
37
|
+
"untyped": "^2.0.0",
|
|
38
|
+
"vue-sfc-transformer": "^0.1.16"
|
|
38
39
|
},
|
|
39
40
|
"description": "@reliverse/dler is a flexible, unified, and fully automated bundler for typescript and javascript projects, as well as an npm and jsr publishing tool. dler is not only a bundler, it also tries to serve as the most powerful codemod toolkit for js/ts.",
|
|
40
41
|
"homepage": "https://docs.reliverse.org",
|
|
41
42
|
"license": "MIT",
|
|
42
43
|
"name": "@reliverse/dler",
|
|
43
44
|
"type": "module",
|
|
44
|
-
"version": "1.
|
|
45
|
+
"version": "1.6.0",
|
|
45
46
|
"keywords": [
|
|
46
47
|
"reliverse",
|
|
47
48
|
"cli",
|