@pezkuwi/dev 0.85.5 → 0.85.6
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
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
|