summaryrefslogtreecommitdiff
path: root/cli/tests/testdata/commonjs/node_modules/imports_exports
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-08-09 21:06:01 +0200
committerGitHub <noreply@github.com>2022-08-09 21:06:01 +0200
commit1f54d877895ea25258a941818f07c6e84d44a7a2 (patch)
tree1999d04ec926d464c94ed2c5a9fe10fb84f3de24 /cli/tests/testdata/commonjs/node_modules/imports_exports
parentaf618e3b8fb11f3947ab5ded9523cdca9cf77ced (diff)
feat: add ext/node for require support (#15362)
This commit adds "ext/node" extension that implementes CommonJS module system. In the future this extension might be extended to actually contain implementation of Node compatibility layer in favor of "deno_std/node". Currently this functionality is not publicly exposed, it is available via "Deno[Deno.internal].require" namespace and is meant to be used by other functionality to be landed soon. This is a minimal first pass, things that still don't work: support for dynamic imports in CJS conditional exports
Diffstat (limited to 'cli/tests/testdata/commonjs/node_modules/imports_exports')
-rw-r--r--cli/tests/testdata/commonjs/node_modules/imports_exports/import_export.js6
-rw-r--r--cli/tests/testdata/commonjs/node_modules/imports_exports/import_polyfill.js3
-rw-r--r--cli/tests/testdata/commonjs/node_modules/imports_exports/package.json17
-rw-r--r--cli/tests/testdata/commonjs/node_modules/imports_exports/require_export.cjs6
-rw-r--r--cli/tests/testdata/commonjs/node_modules/imports_exports/require_polyfill.js3
5 files changed, 35 insertions, 0 deletions
diff --git a/cli/tests/testdata/commonjs/node_modules/imports_exports/import_export.js b/cli/tests/testdata/commonjs/node_modules/imports_exports/import_export.js
new file mode 100644
index 000000000..3ebd222ea
--- /dev/null
+++ b/cli/tests/testdata/commonjs/node_modules/imports_exports/import_export.js
@@ -0,0 +1,6 @@
+import dep from "#dep";
+
+export default {
+ bar: "bar",
+ dep,
+};
diff --git a/cli/tests/testdata/commonjs/node_modules/imports_exports/import_polyfill.js b/cli/tests/testdata/commonjs/node_modules/imports_exports/import_polyfill.js
new file mode 100644
index 000000000..76716a3ef
--- /dev/null
+++ b/cli/tests/testdata/commonjs/node_modules/imports_exports/import_polyfill.js
@@ -0,0 +1,3 @@
+export default {
+ polyfill: "import",
+};
diff --git a/cli/tests/testdata/commonjs/node_modules/imports_exports/package.json b/cli/tests/testdata/commonjs/node_modules/imports_exports/package.json
new file mode 100644
index 000000000..5d26359db
--- /dev/null
+++ b/cli/tests/testdata/commonjs/node_modules/imports_exports/package.json
@@ -0,0 +1,17 @@
+{
+ "version": "1.0.0",
+ "name": "imports_exports",
+ "main": "./require_export.cjs",
+ "imports": {
+ "#dep": {
+ "import": "./import_polyfill.js",
+ "require": "./require_polyfill.js"
+ }
+ },
+ "exports": {
+ ".": {
+ "import": "./import_export.js",
+ "require": "./require_export.cjs"
+ }
+ }
+}
diff --git a/cli/tests/testdata/commonjs/node_modules/imports_exports/require_export.cjs b/cli/tests/testdata/commonjs/node_modules/imports_exports/require_export.cjs
new file mode 100644
index 000000000..48923b8d8
--- /dev/null
+++ b/cli/tests/testdata/commonjs/node_modules/imports_exports/require_export.cjs
@@ -0,0 +1,6 @@
+const dep = require("#dep");
+
+module.exports = {
+ foo: "foo",
+ dep,
+};
diff --git a/cli/tests/testdata/commonjs/node_modules/imports_exports/require_polyfill.js b/cli/tests/testdata/commonjs/node_modules/imports_exports/require_polyfill.js
new file mode 100644
index 000000000..1023fd65c
--- /dev/null
+++ b/cli/tests/testdata/commonjs/node_modules/imports_exports/require_polyfill.js
@@ -0,0 +1,3 @@
+module.exports = {
+ polyfill: "require",
+};