Skip to content

test(es2016): dynamic import()#1051

Closed
ghost wants to merge 1 commit intogh-pagesfrom
unknown repository
Closed

test(es2016): dynamic import()#1051
ghost wants to merge 1 commit intogh-pagesfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Mar 18, 2017

import() is proposed to work in both scripts and modules. This gives script code an easy asynchronous entry point into the module world, allowing it to start running module code.

This proposal would be a small expansion of the existing JavaScript and HTML capabilities, using the same framework of specifying syntactic forms in the JavaScript specification, which delegate to the host environment for their heavy lifting. HTML's infrastructure for fetching and resolving modules would be leveraged to define its side of the story. Similarly, Node.js would supply its own definitions for HostPrepareImportedModule and HostResolveImportedModule to make this proposal work there.

Citing: https://github.com/tc39/proposal-dynamic-import
Spec: https://tc39.github.io/proposal-dynamic-import/
See also: #1034, #316, nodejs/node-eps#39

> `import()` is proposed to work in both scripts and modules.
> This gives script code an easy asynchronous entry point into
> the module world, allowing it to start running module code.

> This proposal would be a small expansion of the existing
> JavaScript and HTML capabilities, using the same framework of
> specifying syntactic forms in the JavaScript specification,
> which delegate to the host environment for their heavy lifting.
> HTML's infrastructure for fetching and resolving modules would be
> leveraged to define its side of the story. Similarly, Node.js would
> supply its own definitions for HostPrepareImportedModule and
> HostResolveImportedModule to make this proposal work there.

Cite: https://github.com/tc39/proposal-dynamic-import

See also:

- https://tc39.github.io/proposal-dynamic-import/
- #1034
- #316
Comment thread data-es2016plus.js
{
name: 'import',
exec: function () {/*
try {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is false; import() is strictly not a function, it's a keyword followed by parens.

Comment thread data-es2016plus.js
{
name: 'throw',
exec: function () {/*
try {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't import('') potentially reject anyways, since that's not a valid path?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's up to the host environment. Testing import() is equivalent to testing import declarations...

@ljharb
Copy link
Copy Markdown
Member

ljharb commented Mar 18, 2017

@domenic i'd love your input here on what things this should be testing

Comment thread data-es2016plus.js
{
name: 'throws without params',
exec: function () {/*
try {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is grammatically disallowed, not runtime disallowed, so it needs an eval wrapper.

Comment thread data-es2016plus.js
},
{
name: 'rejects without params',
exec: function () {/*
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is invalid

@ljharb
Copy link
Copy Markdown
Member

ljharb commented Mar 18, 2017

I'm pretty sure this feature should not be tested at all except in a Modules tab (that does not yet exist), along with import/export itself.

@ljharb
Copy link
Copy Markdown
Member

ljharb commented Mar 19, 2017

Closing per #316 (comment)

@ljharb ljharb closed this Mar 19, 2017
@ghost ghost deleted the dynamic-import branch March 19, 2017 04:23
@ghost ghost restored the dynamic-import branch March 19, 2017 04:24
@ghost ghost mentioned this pull request Mar 19, 2017
@yukulele
Copy link
Copy Markdown

yukulele commented Sep 4, 2017

@ljharb is modules tab planed?

@ljharb
Copy link
Copy Markdown
Member

ljharb commented Sep 4, 2017

Loosely yes.

@ghost
Copy link
Copy Markdown
Author

ghost commented Sep 8, 2017

@yukulele it's an unnecessary complexity barrier throwing off the validity of the Node charts—very few people are aware of this

EDIT: Opinions my own.™

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants