-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
remove private api from MissingExport hook #1987
remove private api from MissingExport hook #1987
Conversation
src/Graph.ts
Outdated
@@ -63,7 +62,7 @@ export default class Graph { | |||
isPureExternalModule: (id: string) => boolean; | |||
legacy: boolean; | |||
load: (id: string) => Promise<SourceDescription | string | void>; | |||
handleMissingExport: MissingExportHook; | |||
handleMissingExport: (module: Module, name: string, otherModule: string, start?: number) => void; |
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.
I take it module
is the importer here, and start is the index in the importer? How about exportName, importingModule, importedModule, importerStart
?
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.
updated the wording and order.
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.
Much better, would be great to get this in.
I'd still be interested to hear more background on the use cases here.
https://github.com/jmurphyau/ember-truth-helpers/blob/v2.0.0/app/helpers/not-eq.js#L1 define('ember-truth-helpers/helpers/not-equal', ['exports'], function (exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.notEqualHelper = notEqualHelper;
function notEqualHelper(params) {
return params[0] !== params[1];
}
exports.default = Ember.Helper.helper(notEqualHelper);
}); define('my-app/helpers/not-eq', ['exports', 'ember-truth-helpers/helpers/not-equal'], function (exports, _notEqual) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, 'default', {
enumerable: true,
get: function () {
return _notEqual.default;
}
});
Object.defineProperty(exports, 'notEq', {
enumerable: true,
get: function () {
return _notEqual.notEq;
}
});
}); This is why I need a missing export hook, and a way to continue the graph traversal for backwards compatibility. The hook allows me to return true so rollup can continue without stopping, and a way to print a deprecation message to Ember users. Does that make sense? |
709ce83
to
81f6753
Compare
Completely, thanks for explaining it to me here! The thing to note is that this won't ever support the So ideally we should actually remove the missing export from the analysis entirely so that tracing can go on without it I think. |
Actually thinking through the cases here I believe this will output correctly even for es modules with code splitting, as we only create the import/exports where tracing succeeds. So this looks good to merge here to me. |
81f6753
to
7beb866
Compare
Closes #1973.
I don't think calling
Module
functions is going to be necessary after all.