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

Move meteorBabelHelpers to modules package, and restrict to legacy bundle. #10596

Merged
merged 1 commit into from
Jun 25, 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
1 change: 0 additions & 1 deletion packages/babel-runtime/.npm/package/.gitignore

This file was deleted.

7 changes: 0 additions & 7 deletions packages/babel-runtime/.npm/package/README

This file was deleted.

10 changes: 0 additions & 10 deletions packages/babel-runtime/.npm/package/npm-shrinkwrap.json

This file was deleted.

2 changes: 0 additions & 2 deletions packages/babel-runtime/babel-runtime.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
exports.meteorBabelHelpers = require("meteor-babel-helpers");

try {
var babelRuntimeVersion = require("@babel/runtime/package.json").version;
} catch (e) {
Expand Down
7 changes: 1 addition & 6 deletions packages/babel-runtime/package.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
Package.describe({
name: "babel-runtime",
summary: "Runtime support for output of Babel transpiler",
version: '1.3.0',
version: '1.4.0',
documentation: 'README.md'
});

Npm.depends({
"meteor-babel-helpers": "0.0.3"
});

Package.onUse(function (api) {
api.use("modules");
api.mainModule("babel-runtime.js");
api.export("meteorBabelHelpers");
});
6 changes: 4 additions & 2 deletions packages/ecmascript/runtime-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,10 @@ Tinytest.add("ecmascript - runtime - destructuring", (test) => {

Tinytest.addAsync("ecmascript - runtime - misc support", (test, done) => {
// Verify that the runtime was installed.
test.equal(typeof meteorBabelHelpers, "object");
test.equal(typeof meteorBabelHelpers.sanitizeForInObject, "function");
if (Meteor.isLegacy) {
test.equal(typeof meteorBabelHelpers, "object");
test.equal(typeof meteorBabelHelpers.sanitizeForInObject, "function");
}

class Base {
constructor(...args) {
Expand Down
5 changes: 5 additions & 0 deletions packages/modules/.npm/package/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions packages/modules/legacy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// The meteor-babel/plugins/sanitize-for-in-objects plugin generates code
// that uses meteorBabelHelpers.sanitizeForInObject, but only when
// compiling code for the web.browser.legacy bundle. See #10595.
meteorBabelHelpers = require("meteor-babel-helpers");
11 changes: 10 additions & 1 deletion packages/modules/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@ Package.describe({
});

Npm.depends({
reify: "0.20.6"
reify: "0.20.6",
"meteor-babel-helpers": "0.0.3"
});

Package.onUse(function(api) {
api.use("modules-runtime");
api.mainModule("client.js", "client");
api.mainModule("server.js", "server");
api.export("meteorInstall");

// When compiling legacy code, the babel-compiler and meteor-babel
// packages assume meteorBabelHelpers.sanitizeForInObject is defined.
// Since the modules package is responsible for code from node_modules,
// it must also be responsible for exposing this runtime helper, but
// only in the legacy bundle.
api.addFiles("legacy.js", "legacy");
api.export("meteorBabelHelpers", "legacy");
});