From 7bfb73fe5ac3c3ce91ef19af8673e8c0c6c03eb9 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Sat, 29 Oct 2022 06:50:02 +0200 Subject: [PATCH] Test for wrong import-meta slashes --- .../samples/import-meta-numeric-paths/0/1/nested.js | 1 + .../samples/import-meta-numeric-paths/_config.js | 6 ++++++ .../_expected/amd/0/1/nested.js | 7 +++++++ .../import-meta-numeric-paths/_expected/amd/main.js | 7 +++++++ .../_expected/cjs/0/1/nested.js | 5 +++++ .../import-meta-numeric-paths/_expected/cjs/main.js | 7 +++++++ .../_expected/es/0/1/nested.js | 3 +++ .../import-meta-numeric-paths/_expected/es/main.js | 1 + .../_expected/system/0/1/nested.js | 10 ++++++++++ .../_expected/system/main.js | 13 +++++++++++++ .../samples/import-meta-numeric-paths/main.js | 1 + 11 files changed, 61 insertions(+) create mode 100644 test/chunking-form/samples/import-meta-numeric-paths/0/1/nested.js create mode 100644 test/chunking-form/samples/import-meta-numeric-paths/_config.js create mode 100644 test/chunking-form/samples/import-meta-numeric-paths/_expected/amd/0/1/nested.js create mode 100644 test/chunking-form/samples/import-meta-numeric-paths/_expected/amd/main.js create mode 100644 test/chunking-form/samples/import-meta-numeric-paths/_expected/cjs/0/1/nested.js create mode 100644 test/chunking-form/samples/import-meta-numeric-paths/_expected/cjs/main.js create mode 100644 test/chunking-form/samples/import-meta-numeric-paths/_expected/es/0/1/nested.js create mode 100644 test/chunking-form/samples/import-meta-numeric-paths/_expected/es/main.js create mode 100644 test/chunking-form/samples/import-meta-numeric-paths/_expected/system/0/1/nested.js create mode 100644 test/chunking-form/samples/import-meta-numeric-paths/_expected/system/main.js create mode 100644 test/chunking-form/samples/import-meta-numeric-paths/main.js diff --git a/test/chunking-form/samples/import-meta-numeric-paths/0/1/nested.js b/test/chunking-form/samples/import-meta-numeric-paths/0/1/nested.js new file mode 100644 index 00000000000..bdeb009362b --- /dev/null +++ b/test/chunking-form/samples/import-meta-numeric-paths/0/1/nested.js @@ -0,0 +1 @@ +export const url = import.meta.url; diff --git a/test/chunking-form/samples/import-meta-numeric-paths/_config.js b/test/chunking-form/samples/import-meta-numeric-paths/_config.js new file mode 100644 index 00000000000..00207f7d6e0 --- /dev/null +++ b/test/chunking-form/samples/import-meta-numeric-paths/_config.js @@ -0,0 +1,6 @@ +module.exports = { + description: 'supports nested numeric paths without issues on Windows', + options: { + output: { preserveModules: true } + } +}; diff --git a/test/chunking-form/samples/import-meta-numeric-paths/_expected/amd/0/1/nested.js b/test/chunking-form/samples/import-meta-numeric-paths/_expected/amd/0/1/nested.js new file mode 100644 index 00000000000..69562cb0eb6 --- /dev/null +++ b/test/chunking-form/samples/import-meta-numeric-paths/_expected/amd/0/1/nested.js @@ -0,0 +1,7 @@ +define(['module', 'exports'], (function (module, exports) { 'use strict'; + + const url = new URL(module.uri, document.baseURI).href; + + exports.url = url; + +})); diff --git a/test/chunking-form/samples/import-meta-numeric-paths/_expected/amd/main.js b/test/chunking-form/samples/import-meta-numeric-paths/_expected/amd/main.js new file mode 100644 index 00000000000..386d534b366 --- /dev/null +++ b/test/chunking-form/samples/import-meta-numeric-paths/_expected/amd/main.js @@ -0,0 +1,7 @@ +define(['exports', './0/1/nested'], (function (exports, nested) { 'use strict'; + + + + exports.url = nested.url; + +})); diff --git a/test/chunking-form/samples/import-meta-numeric-paths/_expected/cjs/0/1/nested.js b/test/chunking-form/samples/import-meta-numeric-paths/_expected/cjs/0/1/nested.js new file mode 100644 index 00000000000..bd090200b2a --- /dev/null +++ b/test/chunking-form/samples/import-meta-numeric-paths/_expected/cjs/0/1/nested.js @@ -0,0 +1,5 @@ +'use strict'; + +const url = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('0/1/nested.js', document.baseURI).href)); + +exports.url = url; diff --git a/test/chunking-form/samples/import-meta-numeric-paths/_expected/cjs/main.js b/test/chunking-form/samples/import-meta-numeric-paths/_expected/cjs/main.js new file mode 100644 index 00000000000..7b739791d3d --- /dev/null +++ b/test/chunking-form/samples/import-meta-numeric-paths/_expected/cjs/main.js @@ -0,0 +1,7 @@ +'use strict'; + +var nested = require('./0/1/nested.js'); + + + +exports.url = nested.url; diff --git a/test/chunking-form/samples/import-meta-numeric-paths/_expected/es/0/1/nested.js b/test/chunking-form/samples/import-meta-numeric-paths/_expected/es/0/1/nested.js new file mode 100644 index 00000000000..ee0310bf234 --- /dev/null +++ b/test/chunking-form/samples/import-meta-numeric-paths/_expected/es/0/1/nested.js @@ -0,0 +1,3 @@ +const url = import.meta.url; + +export { url }; diff --git a/test/chunking-form/samples/import-meta-numeric-paths/_expected/es/main.js b/test/chunking-form/samples/import-meta-numeric-paths/_expected/es/main.js new file mode 100644 index 00000000000..0b111561502 --- /dev/null +++ b/test/chunking-form/samples/import-meta-numeric-paths/_expected/es/main.js @@ -0,0 +1 @@ +export { url } from './0/1/nested.js'; diff --git a/test/chunking-form/samples/import-meta-numeric-paths/_expected/system/0/1/nested.js b/test/chunking-form/samples/import-meta-numeric-paths/_expected/system/0/1/nested.js new file mode 100644 index 00000000000..17dd3b000c0 --- /dev/null +++ b/test/chunking-form/samples/import-meta-numeric-paths/_expected/system/0/1/nested.js @@ -0,0 +1,10 @@ +System.register([], (function (exports, module) { + 'use strict'; + return { + execute: (function () { + + const url = exports('url', module.meta.url); + + }) + }; +})); diff --git a/test/chunking-form/samples/import-meta-numeric-paths/_expected/system/main.js b/test/chunking-form/samples/import-meta-numeric-paths/_expected/system/main.js new file mode 100644 index 00000000000..0be3e5010b5 --- /dev/null +++ b/test/chunking-form/samples/import-meta-numeric-paths/_expected/system/main.js @@ -0,0 +1,13 @@ +System.register(['./0/1/nested.js'], (function (exports) { + 'use strict'; + return { + setters: [function (module) { + exports('url', module.url); + }], + execute: (function () { + + + + }) + }; +})); diff --git a/test/chunking-form/samples/import-meta-numeric-paths/main.js b/test/chunking-form/samples/import-meta-numeric-paths/main.js new file mode 100644 index 00000000000..0b111561502 --- /dev/null +++ b/test/chunking-form/samples/import-meta-numeric-paths/main.js @@ -0,0 +1 @@ +export { url } from './0/1/nested.js';