-
Notifications
You must be signed in to change notification settings - Fork 522
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
All CommonJS and AMD modules to be transpiled #1513
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -692,10 +692,11 @@ addStealExtension(function addMetaDeps(loader) { | |
} | ||
|
||
loader.transpile = function (load) { | ||
// TODO this needs to change | ||
prependDeps(this, load, createImport); | ||
var result = superTranspile.apply(this, arguments); | ||
return result; | ||
} | ||
}; | ||
|
||
loader._determineFormat = function (load) { | ||
if(load.metadata.format === 'cjs') { | ||
|
@@ -1356,6 +1357,31 @@ addStealExtension(function addMJS(loader){ | |
}; | ||
}); | ||
|
||
// This extension allows you to define metadata that should appear on | ||
// Any subdependencies. For example we can add the { foo: true } bool | ||
// to a module's metadata, and it will be forwarded to any subdependency. | ||
addStealExtension(function forwardMetadata(loader){ | ||
loader._forwardedMetadata = {}; | ||
loader.setForwardedMetadata = function(prop) { | ||
loader._forwardedMetadata[prop] = true; | ||
}; | ||
|
||
loader.forwardMetadata = function(load, parentName) { | ||
if(parentName) { | ||
var parentLoad = this.getModuleLoad(parentName); | ||
|
||
if(parentLoad) { | ||
// TODO use Object.assign instead? | ||
for(var p in this._forwardedMetadata) { | ||
if(p in parentLoad.metadata) { | ||
load.metadata[p] = parentLoad.metadata[p]; | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
}); | ||
|
||
addStealExtension(function applyTraceExtension(loader) { | ||
loader._traceData = { | ||
loads: {}, | ||
|
@@ -1735,6 +1761,7 @@ addStealExtension(function addCacheBust(loader) { | |
System.ext = Object.create(null); | ||
System.logLevel = 0; | ||
System.forceES5 = true; | ||
System.transpileAllFormats = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if this is the right option. In the PR we said Also this has to default to false or it will be a breaking change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
var cssBundlesNameGlob = "bundles/*.css", | ||
jsBundlesNameGlob = "bundles/*"; | ||
setIfNotPresent(System.paths,cssBundlesNameGlob, "dist/bundles/*css"); | ||
|
@@ -1988,9 +2015,11 @@ addStealExtension(function addCacheBust(loader) { | |
this.paths["@@babel-code-frame"] = dirname+"/ext/babel-code-frame.js"; | ||
setIfNotPresent(this.meta,"traceur",{"exports":"traceur"}); | ||
setIfNotPresent(this.meta, "@@babel-code-frame", {"format":"global","exports":"BabelCodeFrame"}); | ||
setIfNotPresent(this.meta, "babel", {"shouldTranspile": false}); | ||
|
||
// steal-clone is contextual so it can override modules using relative paths | ||
this.setContextual('steal-clone', 'steal-clone'); | ||
this.setForwardedMetadata("shouldTranspile"); | ||
|
||
if(isNode) { | ||
if(this.configMain === "@config" && last(parts) === "steal") { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// This extension allows you to define metadata that should appear on | ||
// Any subdependencies. For example we can add the { foo: true } bool | ||
// to a module's metadata, and it will be forwarded to any subdependency. | ||
addStealExtension(function forwardMetadata(loader){ | ||
loader._forwardedMetadata = {}; | ||
loader.setForwardedMetadata = function(prop) { | ||
loader._forwardedMetadata[prop] = true; | ||
}; | ||
|
||
loader.forwardMetadata = function(load, parentName) { | ||
if(parentName) { | ||
var parentLoad = this.getModuleLoad(parentName); | ||
|
||
if(parentLoad) { | ||
// TODO use Object.assign instead? | ||
for(var p in this._forwardedMetadata) { | ||
if(p in parentLoad.metadata) { | ||
load.metadata[p] = parentLoad.metadata[p]; | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that
.transpile()
is called on all formats, prependDeps needs to check the load.format.