From dfc5eec43c481b1eeaa0ad069aeba8b7559d4440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 5 Sep 2024 08:59:12 +0100 Subject: feat: Allow importing .cjs files (#25426) This commit adds support for executing top-level `.cjs` files, as well as import `.cjs` files from within npm packages. This works only for `.cjs` files, the contents of sibling `package.json` are not consulted for the `"type"` field. Closes https://github.com/denoland/deno/issues/25384 --------- Signed-off-by: David Sherret Co-authored-by: Luca Casonato Co-authored-by: David Sherret --- tests/testdata/run/cjs_imports/commonjs.cjs | 1 - tests/testdata/run/cjs_imports/main.out | 1 - tests/testdata/run/cjs_imports/main.ts | 1 - 3 files changed, 3 deletions(-) delete mode 100644 tests/testdata/run/cjs_imports/commonjs.cjs delete mode 100644 tests/testdata/run/cjs_imports/main.out delete mode 100644 tests/testdata/run/cjs_imports/main.ts (limited to 'tests/testdata/run') diff --git a/tests/testdata/run/cjs_imports/commonjs.cjs b/tests/testdata/run/cjs_imports/commonjs.cjs deleted file mode 100644 index accefceba..000000000 --- a/tests/testdata/run/cjs_imports/commonjs.cjs +++ /dev/null @@ -1 +0,0 @@ -console.log("Hello World"); diff --git a/tests/testdata/run/cjs_imports/main.out b/tests/testdata/run/cjs_imports/main.out deleted file mode 100644 index 557db03de..000000000 --- a/tests/testdata/run/cjs_imports/main.out +++ /dev/null @@ -1 +0,0 @@ -Hello World diff --git a/tests/testdata/run/cjs_imports/main.ts b/tests/testdata/run/cjs_imports/main.ts deleted file mode 100644 index d8b77c22e..000000000 --- a/tests/testdata/run/cjs_imports/main.ts +++ /dev/null @@ -1 +0,0 @@ -import "./commonjs.cjs"; -- cgit v1.2.3