Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ImportAttributesKey to choose keyword ("with" | "assert") (#5474)
* Add ImportAttributesKey to choose keyword ("with" | "assert") * Revert settings.json change * Added documentation for importAttributesKey * Revert wasm bindings * Fix lint issue * Remove space * Revert bindings_wasm_bg.wasm.d.ts * Revert test/form/index.js --------- Co-authored-by: Lukas Taegert-Atkinson <lukastaegert@users.noreply.github.com>
- Loading branch information
1 parent
0bf4675
commit f24679e
Showing
35 changed files
with
667 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
test/form/samples/import-attributes/keeps-static-attributes-key-assert/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module.exports = defineTest({ | ||
description: 'keeps any import attributes on input using import attributes with "with" key', | ||
expectedWarnings: ['UNRESOLVED_IMPORT'], | ||
options: { | ||
external: id => { | ||
if (id === 'unresolved') return null; | ||
return true; | ||
}, | ||
output: { | ||
name: 'bundle', | ||
importAttributesKey: 'assert' | ||
} | ||
} | ||
}); |
35 changes: 35 additions & 0 deletions
35
test/form/samples/import-attributes/keeps-static-attributes-key-assert/_expected/amd.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
define(['exports', 'a', 'b', 'c', 'd', 'unresolved'], (function (exports, a, b, c, d$1, unresolved) { 'use strict'; | ||
|
||
function _interopNamespaceDefault(e) { | ||
var n = Object.create(null); | ||
if (e) { | ||
Object.keys(e).forEach(function (k) { | ||
if (k !== 'default') { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { return e[k]; } | ||
}); | ||
} | ||
}); | ||
} | ||
n.default = e; | ||
return Object.freeze(n); | ||
} | ||
|
||
var b__namespace = /*#__PURE__*/_interopNamespaceDefault(b); | ||
|
||
console.log(a.a, b__namespace, d); | ||
|
||
Object.defineProperty(exports, "c", { | ||
enumerable: true, | ||
get: function () { return c.c; } | ||
}); | ||
Object.keys(d$1).forEach(function (k) { | ||
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, { | ||
enumerable: true, | ||
get: function () { return d$1[k]; } | ||
}); | ||
}); | ||
|
||
})); |
39 changes: 39 additions & 0 deletions
39
test/form/samples/import-attributes/keeps-static-attributes-key-assert/_expected/cjs.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
'use strict'; | ||
|
||
var a = require('a'); | ||
var b = require('b'); | ||
var c = require('c'); | ||
var d$1 = require('d'); | ||
require('unresolved'); | ||
|
||
function _interopNamespaceDefault(e) { | ||
var n = Object.create(null); | ||
if (e) { | ||
Object.keys(e).forEach(function (k) { | ||
if (k !== 'default') { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { return e[k]; } | ||
}); | ||
} | ||
}); | ||
} | ||
n.default = e; | ||
return Object.freeze(n); | ||
} | ||
|
||
var b__namespace = /*#__PURE__*/_interopNamespaceDefault(b); | ||
|
||
console.log(a.a, b__namespace, d); | ||
|
||
Object.defineProperty(exports, "c", { | ||
enumerable: true, | ||
get: function () { return c.c; } | ||
}); | ||
Object.keys(d$1).forEach(function (k) { | ||
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, { | ||
enumerable: true, | ||
get: function () { return d$1[k]; } | ||
}); | ||
}); |
7 changes: 7 additions & 0 deletions
7
test/form/samples/import-attributes/keeps-static-attributes-key-assert/_expected/es.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { a } from 'a' assert { type: 'a', extra: 'extra' }; | ||
import * as b from 'b' assert { type: 'b' }; | ||
export { c } from 'c' assert { type: 'c' }; | ||
export * from 'd' assert { type: 'd' }; | ||
import 'unresolved' assert { type: 'e' }; | ||
|
||
console.log(a, b, d); |
38 changes: 38 additions & 0 deletions
38
test/form/samples/import-attributes/keeps-static-attributes-key-assert/_expected/iife.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
var bundle = (function (exports, a, b, c, d$1) { | ||
'use strict'; | ||
|
||
function _interopNamespaceDefault(e) { | ||
var n = Object.create(null); | ||
if (e) { | ||
Object.keys(e).forEach(function (k) { | ||
if (k !== 'default') { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { return e[k]; } | ||
}); | ||
} | ||
}); | ||
} | ||
n.default = e; | ||
return Object.freeze(n); | ||
} | ||
|
||
var b__namespace = /*#__PURE__*/_interopNamespaceDefault(b); | ||
|
||
console.log(a.a, b__namespace, d); | ||
|
||
Object.defineProperty(exports, "c", { | ||
enumerable: true, | ||
get: function () { return c.c; } | ||
}); | ||
Object.keys(d$1).forEach(function (k) { | ||
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, { | ||
enumerable: true, | ||
get: function () { return d$1[k]; } | ||
}); | ||
}); | ||
|
||
return exports; | ||
|
||
})({}, a, b, c, d$1); |
29 changes: 29 additions & 0 deletions
29
test/form/samples/import-attributes/keeps-static-attributes-key-assert/_expected/system.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
System.register('bundle', ['a', 'b', 'c', 'd', 'unresolved'], (function (exports) { | ||
'use strict'; | ||
var _starExcludes = { | ||
__proto__: null, | ||
default: 1, | ||
c: 1 | ||
}; | ||
var a, b; | ||
return { | ||
setters: [function (module) { | ||
a = module.a; | ||
}, function (module) { | ||
b = module; | ||
}, function (module) { | ||
exports("c", module.c); | ||
}, function (module) { | ||
var setter = { __proto__: null }; | ||
for (var name in module) { | ||
if (!_starExcludes[name]) setter[name] = module[name]; | ||
} | ||
exports(setter); | ||
}, null], | ||
execute: (function () { | ||
|
||
console.log(a, b, d); | ||
|
||
}) | ||
}; | ||
})); |
39 changes: 39 additions & 0 deletions
39
test/form/samples/import-attributes/keeps-static-attributes-key-assert/_expected/umd.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('a'), require('b'), require('c'), require('d'), require('unresolved')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'a', 'b', 'c', 'd', 'unresolved'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.bundle = {}, global.a, global.b, global.c, global.d$1)); | ||
})(this, (function (exports, a, b, c, d$1) { 'use strict'; | ||
|
||
function _interopNamespaceDefault(e) { | ||
var n = Object.create(null); | ||
if (e) { | ||
Object.keys(e).forEach(function (k) { | ||
if (k !== 'default') { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { return e[k]; } | ||
}); | ||
} | ||
}); | ||
} | ||
n.default = e; | ||
return Object.freeze(n); | ||
} | ||
|
||
var b__namespace = /*#__PURE__*/_interopNamespaceDefault(b); | ||
|
||
console.log(a.a, b__namespace, d); | ||
|
||
Object.defineProperty(exports, "c", { | ||
enumerable: true, | ||
get: function () { return c.c; } | ||
}); | ||
Object.keys(d$1).forEach(function (k) { | ||
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, { | ||
enumerable: true, | ||
get: function () { return d$1[k]; } | ||
}); | ||
}); | ||
|
||
})); |
9 changes: 9 additions & 0 deletions
9
test/form/samples/import-attributes/keeps-static-attributes-key-assert/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { a } from 'a' with { type: 'a', extra: 'extra' }; | ||
import * as b from 'b' with { type: 'b' }; | ||
export { c } from 'c' with { type: 'c' }; | ||
export * from 'd' with { type: 'd' }; | ||
import 'unresolved' with { type: 'e' }; | ||
|
||
console.log(a, b, d); | ||
|
||
|
13 changes: 13 additions & 0 deletions
13
test/form/samples/import-attributes/keeps-static-attributes-key-default/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = defineTest({ | ||
description: 'keeps any import attributes on input using import attributes with "with" key', | ||
expectedWarnings: ['UNRESOLVED_IMPORT'], | ||
options: { | ||
external: id => { | ||
if (id === 'unresolved') return null; | ||
return true; | ||
}, | ||
output: { | ||
name: 'bundle' | ||
} | ||
} | ||
}); |
Oops, something went wrong.