Skip to content

Commit

Permalink
refactor(esm-shim): use prefix for build in module imports (#1622)
Browse files Browse the repository at this point in the history
* fix(esm-shim): use 'node:' prefix for build in module imports

* fix(esm-shim): Update snapshots
  • Loading branch information
Peeterush committed Nov 5, 2023
1 parent 23c5ca7 commit a72d786
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions packages/esm-shim/src/constants.ts
Expand Up @@ -2,9 +2,9 @@ export const CJSyntaxRegex = /__filename|__dirname|require\(|require\.resolve\(/

export const ESMShim = `
// -- Shims --
import cjsUrl from 'url';
import cjsPath from 'path';
import cjsModule from 'module';
import cjsUrl from 'node:url';
import cjsPath from 'node:path';
import cjsModule from 'node:module';
const __filename = cjsUrl.fileURLToPath(import.meta.url);
const __dirname = cjsPath.dirname(__filename);
const require = cjsModule.createRequire(import.meta.url);
Expand Down
24 changes: 12 additions & 12 deletions packages/esm-shim/test/snapshots/test.js.md
Expand Up @@ -10,9 +10,9 @@ Generated by [AVA](https://avajs.dev).
`␊
// -- Shims --␊
import cjsUrl from 'url';␊
import cjsPath from 'path';␊
import cjsModule from 'module';␊
import cjsUrl from 'node:url';␊
import cjsPath from 'node:path';␊
import cjsModule from 'node:module';␊
const __filename = cjsUrl.fileURLToPath(import.meta.url);␊
const __dirname = cjsPath.dirname(__filename);␊
const require = cjsModule.createRequire(import.meta.url);␊
Expand All @@ -27,9 +27,9 @@ Generated by [AVA](https://avajs.dev).
`␊
// -- Shims --␊
import cjsUrl from 'url';␊
import cjsPath from 'path';␊
import cjsModule from 'module';␊
import cjsUrl from 'node:url';␊
import cjsPath from 'node:path';␊
import cjsModule from 'node:module';␊
const __filename = cjsUrl.fileURLToPath(import.meta.url);␊
const __dirname = cjsPath.dirname(__filename);␊
const require = cjsModule.createRequire(import.meta.url);␊
Expand Down Expand Up @@ -58,9 +58,9 @@ Generated by [AVA](https://avajs.dev).
␊
␊
// -- Shims --␊
import cjsUrl from 'url';␊
import cjsPath from 'path';␊
import cjsModule from 'module';␊
import cjsUrl from 'node:url';␊
import cjsPath from 'node:path';␊
import cjsModule from 'node:module';␊
const __filename = cjsUrl.fileURLToPath(import.meta.url);␊
const __dirname = cjsPath.dirname(__filename);␊
const require = cjsModule.createRequire(import.meta.url);␊
Expand All @@ -80,9 +80,9 @@ Generated by [AVA](https://avajs.dev).
␊
␊
// -- Shims --␊
import cjsUrl from 'url';␊
import cjsPath from 'path';␊
import cjsModule from 'module';␊
import cjsUrl from 'node:url';␊
import cjsPath from 'node:path';␊
import cjsModule from 'node:module';␊
const __filename = cjsUrl.fileURLToPath(import.meta.url);␊
const __dirname = cjsPath.dirname(__filename);␊
const require = cjsModule.createRequire(import.meta.url);␊
Expand Down
Binary file modified packages/esm-shim/test/snapshots/test.js.snap
Binary file not shown.

0 comments on commit a72d786

Please sign in to comment.