@pezkuwi/dev 0.85.5 → 0.85.7
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/package.json +1 -1
- package/scripts/pezkuwi-dev-build-ts.mjs +16 -10
package/package.json
CHANGED
|
@@ -363,24 +363,24 @@ function rewriteImports (dir, pkgCwd, pkgJson, replacer) {
|
|
|
363
363
|
.filter((line) => !line.startsWith('//'))
|
|
364
364
|
.map((line) =>
|
|
365
365
|
line
|
|
366
|
-
// handle import/export
|
|
367
|
-
.replace(/(import|export) (.*) from '(
|
|
366
|
+
// handle import/export (use [^']* to avoid capturing 'json' from with { type: 'json' })
|
|
367
|
+
.replace(/(import|export) (.*) from '([^']*)'/g, (o, t, a, f) => {
|
|
368
368
|
const adjusted = replacer(pkgCwd, pkgJson, dir, f);
|
|
369
369
|
|
|
370
370
|
return adjusted
|
|
371
371
|
? `${t} ${a} from '${adjusted}'`
|
|
372
372
|
: o;
|
|
373
373
|
})
|
|
374
|
-
// handle augmented inputs
|
|
375
|
-
.replace(/(import|declare module) '(
|
|
374
|
+
// handle augmented inputs (use [^']* to avoid capturing quotes from import attributes)
|
|
375
|
+
.replace(/(import|declare module) '([^']*)'/g, (o, t, f) => {
|
|
376
376
|
const adjusted = replacer(pkgCwd, pkgJson, dir, f, t !== 'import');
|
|
377
377
|
|
|
378
378
|
return adjusted
|
|
379
379
|
? `${t} '${adjusted}'`
|
|
380
380
|
: o;
|
|
381
381
|
})
|
|
382
|
-
// handle dynamic imports
|
|
383
|
-
.replace(/( import|^import)\('(
|
|
382
|
+
// handle dynamic imports (use [^']* for consistency)
|
|
383
|
+
.replace(/( import|^import)\('([^']*)'\)/g, (o, t, f) => {
|
|
384
384
|
const adjusted = replacer(pkgCwd, pkgJson, dir, f);
|
|
385
385
|
|
|
386
386
|
return adjusted
|
|
@@ -788,11 +788,14 @@ function buildExports () {
|
|
|
788
788
|
}
|
|
789
789
|
|
|
790
790
|
if (pkg.main) {
|
|
791
|
-
|
|
791
|
+
let main = pkg.main.startsWith('./')
|
|
792
792
|
? pkg.main
|
|
793
793
|
: `./${pkg.main}`;
|
|
794
794
|
|
|
795
|
-
//
|
|
795
|
+
// Strip ./build/ prefix if present (source package.json may have ./build/cjs/index.js)
|
|
796
|
+
main = main.replace(/^\.\/build\//, './');
|
|
797
|
+
|
|
798
|
+
// Add ./cjs/ prefix if not already present (for CJS entry point)
|
|
796
799
|
pkg.main = main.startsWith('./cjs/') ? main : main.replace(/^\.\//, './cjs/');
|
|
797
800
|
pkg.module = main;
|
|
798
801
|
pkg.types = main.replace('.js', '.d.ts');
|
|
@@ -803,11 +806,14 @@ function buildExports () {
|
|
|
803
806
|
const value = pkg[k];
|
|
804
807
|
|
|
805
808
|
if (typeof value === 'string') {
|
|
806
|
-
|
|
809
|
+
let entry = value.startsWith('./')
|
|
807
810
|
? value
|
|
808
811
|
: `./${value}`;
|
|
809
812
|
|
|
810
|
-
//
|
|
813
|
+
// Strip ./build/ prefix if present
|
|
814
|
+
entry = entry.replace(/^\.\/build\//, './');
|
|
815
|
+
|
|
816
|
+
// Add ./cjs/ prefix if not already present
|
|
811
817
|
pkg[k] = entry.startsWith('./cjs/') ? entry : entry.replace(/^\.\//, './cjs/');
|
|
812
818
|
}
|
|
813
819
|
});
|