Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow import.meta.* for systemjs format #3152

Merged
merged 2 commits into from Oct 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/ast/nodes/MetaProperty.ts
Expand Up @@ -36,14 +36,14 @@ export default class MetaProperty extends NodeBase {
? parent.propertyKey
: null);
if (metaProperty) {
if (metaProperty === 'url') {
this.scope.addAccessedGlobalsByFormat(accessedMetaUrlGlobals);
} else if (
if (
metaProperty.startsWith(FILE_PREFIX) ||
metaProperty.startsWith(ASSET_PREFIX) ||
metaProperty.startsWith(CHUNK_PREFIX)
) {
this.scope.addAccessedGlobalsByFormat(accessedFileUrlGlobals);
} else {
this.scope.addAccessedGlobalsByFormat(accessedMetaUrlGlobals);
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions test/form/samples/import-meta-resolve/_config.js
@@ -0,0 +1,3 @@
module.exports = {
description: 'supports import.meta.resolve'
};
5 changes: 5 additions & 0 deletions test/form/samples/import-meta-resolve/_expected/amd.js
@@ -0,0 +1,5 @@
define(['module'], function (module) { 'use strict';

undefined('./foo.js');

});
3 changes: 3 additions & 0 deletions test/form/samples/import-meta-resolve/_expected/cjs.js
@@ -0,0 +1,3 @@
'use strict';

undefined('./foo.js');
1 change: 1 addition & 0 deletions test/form/samples/import-meta-resolve/_expected/es.js
@@ -0,0 +1 @@
import.meta.resolve('./foo.js');
6 changes: 6 additions & 0 deletions test/form/samples/import-meta-resolve/_expected/iife.js
@@ -0,0 +1,6 @@
(function () {
'use strict';

undefined('./foo.js');

}());
10 changes: 10 additions & 0 deletions test/form/samples/import-meta-resolve/_expected/system.js
@@ -0,0 +1,10 @@
System.register([], function (exports, module) {
'use strict';
return {
execute: function () {

module.meta.resolve('./foo.js');

}
};
});
8 changes: 8 additions & 0 deletions test/form/samples/import-meta-resolve/_expected/umd.js
@@ -0,0 +1,8 @@
(function (factory) {
typeof define === 'function' && define.amd ? define(factory) :
factory();
}(function () { 'use strict';

undefined('./foo.js');

}));
1 change: 1 addition & 0 deletions test/form/samples/import-meta-resolve/main.js
@@ -0,0 +1 @@
import.meta.resolve('./foo.js');