Skip to content

Commit

Permalink
Update rollup and magic-string (#538)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmatown committed Apr 10, 2023
1 parent 261140b commit d2cd411
Show file tree
Hide file tree
Showing 18 changed files with 707 additions and 562 deletions.
5 changes: 5 additions & 0 deletions .changeset/good-years-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@preconstruct/cli": patch
---

Update rollup and magic-string
4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"is-ci": "^2.0.0",
"is-reference": "^1.2.1",
"jest-worker": "^26.3.0",
"magic-string": "^0.25.7",
"magic-string": "^0.30.0",
"meow": "^7.1.0",
"ms": "^2.1.2",
"normalize-path": "^3.0.0",
Expand All @@ -48,7 +48,7 @@
"quick-lru": "^5.1.1",
"resolve": "^1.17.0",
"resolve-from": "^5.0.0",
"rollup": "^2.32.0",
"rollup": "^2.79.1",
"semver": "^7.3.4",
"terser": "^5.16.8",
"v8-compile-cache": "^2.1.1"
Expand Down
30 changes: 15 additions & 15 deletions packages/cli/src/build/__tests__/__snapshots__/basic.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
var index = "something";
exports.default = index;
exports["default"] = index;
"
`;

Expand All @@ -29,14 +29,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
var index = "something";
exports.default = index;
exports["default"] = index;
"
`;

exports[`basic: valid-package.esm.js 1`] = `
"var index = "something";
export default index;
export { index as default };
"
`;

Expand Down Expand Up @@ -79,13 +79,13 @@ exports[`typescript thing: weird-typescript-thing.cjs.dev.js 1`] = `
Object.defineProperty(exports, '__esModule', { value: true });
const thing = () => "wow";
const thing$1 = () => "wow";
const makeThing = () => thing();
const makeThing = () => thing$1();
const thing$1 = makeThing();
const thing = makeThing();
exports.thing = thing$1;
exports.thing = thing;
"
`;

Expand All @@ -105,23 +105,23 @@ exports[`typescript thing: weird-typescript-thing.cjs.prod.js 1`] = `
Object.defineProperty(exports, '__esModule', { value: true });
const thing = () => "wow";
const thing$1 = () => "wow";
const makeThing = () => thing();
const makeThing = () => thing$1();
const thing$1 = makeThing();
const thing = makeThing();
exports.thing = thing$1;
exports.thing = thing;
"
`;

exports[`typescript thing: weird-typescript-thing.esm.js 1`] = `
"const thing = () => "wow";
"const thing$1 = () => "wow";
const makeThing = () => thing();
const makeThing = () => thing$1();
const thing$1 = makeThing();
const thing = makeThing();
export { thing$1 as thing };
export { thing };
"
`;
37 changes: 18 additions & 19 deletions packages/cli/src/build/__tests__/__snapshots__/build.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function doSomething(arg) {
}
var index = "wow";
exports.default = index;
exports["default"] = index;
exports.doSomething = doSomething;
"
`;
Expand Down Expand Up @@ -103,7 +103,7 @@ function doSomething(arg) {
}
var index = "wow";
exports.default = index;
exports["default"] = index;
exports.doSomething = doSomething;
"
`;
Expand All @@ -114,8 +114,7 @@ exports[`flow: flow-export-default.esm.js 1`] = `
}
var index = "wow";
export default index;
export { doSomething };
export { index as default, doSomething };
"
`;

Expand All @@ -126,7 +125,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
var index = 2;
exports.default = index;
exports["default"] = index;
"
`;

Expand All @@ -148,14 +147,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
var index = 2;
exports.default = index;
exports["default"] = index;
"
`;

exports[`monorepo single package: some-scope-package-two-single-package.esm.js 1`] = `
"var index = 2;
export default index;
export { index as default };
"
`;

Expand Down Expand Up @@ -192,7 +191,7 @@ exports[`monorepo umd with dep on other module: some-scope-package-four-umd-with
"
`;

exports[`monorepo umd with dep on other module: some-scope-package-four-umd-with-dep.umd.min.js.map 1`] = `"{"version":3,"file":"some-scope-package-four-umd-with-dep.umd.min.js","sources":["../../package-one/src/index.js"],"sourcesContent":["import { createElement } from \\"react\\";\\n\\ncreateElement(\\"div\\", null);"],"names":[],"mappings":"iQAEc,MAAO"}"`;
exports[`monorepo umd with dep on other module: some-scope-package-four-umd-with-dep.umd.min.js.map 1`] = `"{"version":3,"file":"some-scope-package-four-umd-with-dep.umd.min.js","sources":["../../package-one/src/index.js"],"sourcesContent":["import { createElement } from \\"react\\";\\n\\ncreateElement(\\"div\\", null);"],"names":["createElement"],"mappings":"iPAEAA,EAAAA,cAAc,MAAO"}"`;

exports[`monorepo umd with dep on other module: some-scope-package-one-umd-with-dep.cjs.dev.js 1`] = `
"'use strict';
Expand Down Expand Up @@ -229,7 +228,7 @@ exports[`monorepo umd with dep on other module: some-scope-package-one-umd-with-
"
`;

exports[`monorepo umd with dep on other module: some-scope-package-one-umd-with-dep.umd.min.js.map 1`] = `"{"version":3,"file":"some-scope-package-one-umd-with-dep.umd.min.js","sources":["../src/index.js"],"sourcesContent":["import { createElement } from \\"react\\";\\n\\ncreateElement(\\"div\\", null);"],"names":[],"mappings":"iQAEc,MAAO"}"`;
exports[`monorepo umd with dep on other module: some-scope-package-one-umd-with-dep.umd.min.js.map 1`] = `"{"version":3,"file":"some-scope-package-one-umd-with-dep.umd.min.js","sources":["../src/index.js"],"sourcesContent":["import { createElement } from \\"react\\";\\n\\ncreateElement(\\"div\\", null);"],"names":["createElement"],"mappings":"iPAEAA,EAAAA,cAAc,MAAO"}"`;

exports[`monorepo umd with dep on other module: some-scope-package-three-umd-with-dep.cjs.dev.js 1`] = `
"'use strict';
Expand Down Expand Up @@ -301,7 +300,7 @@ exports[`monorepo umd with dep on other module: some-scope-package-two-umd-with-
"
`;

exports[`monorepo umd with dep on other module: some-scope-package-two-umd-with-dep.umd.min.js.map 1`] = `"{"version":3,"file":"some-scope-package-two-umd-with-dep.umd.min.js","sources":["../src/index.js"],"sourcesContent":["import { createElement } from \\"react\\";\\n\\ncreateElement(\\"h1\\", null);"],"names":[],"mappings":"iQAEc,KAAM"}"`;
exports[`monorepo umd with dep on other module: some-scope-package-two-umd-with-dep.umd.min.js.map 1`] = `"{"version":3,"file":"some-scope-package-two-umd-with-dep.umd.min.js","sources":["../src/index.js"],"sourcesContent":["import { createElement } from \\"react\\";\\n\\ncreateElement(\\"h1\\", null);"],"names":["createElement"],"mappings":"iPAEAA,EAAAA,cAAc,KAAM"}"`;

exports[`monorepo: some-scope-package-one.cjs.dev.js 1`] = `
"'use strict';
Expand All @@ -310,7 +309,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
var index = 1;
exports.default = index;
exports["default"] = index;
"
`;

Expand All @@ -332,14 +331,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
var index = 1;
exports.default = index;
exports["default"] = index;
"
`;

exports[`monorepo: some-scope-package-one.esm.js 1`] = `
"var index = 1;
export default index;
export { index as default };
"
`;

Expand All @@ -350,7 +349,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
var index = 2;
exports.default = index;
exports["default"] = index;
"
`;

Expand All @@ -372,14 +371,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
var index = 2;
exports.default = index;
exports["default"] = index;
"
`;

exports[`monorepo: some-scope-package-two.esm.js 1`] = `
"var index = 2;
export default index;
export { index as default };
"
`;

Expand All @@ -390,7 +389,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
var index = "this does not have a module build";
exports.default = index;
exports["default"] = index;
"
`;

Expand All @@ -412,7 +411,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
var index = "this does not have a module build";
exports.default = index;
exports["default"] = index;
"
`;

Expand Down Expand Up @@ -491,4 +490,4 @@ exports[`umd with dep on other module: umd-with-dep.umd.min.js 1`] = `
"
`;

exports[`umd with dep on other module: umd-with-dep.umd.min.js.map 1`] = `"{"version":3,"file":"umd-with-dep.umd.min.js","sources":["../src/index.js"],"sourcesContent":["import { createElement } from \\"react\\";\\n\\ncreateElement(\\"div\\", null);"],"names":[],"mappings":"iQAEc,MAAO"}"`;
exports[`umd with dep on other module: umd-with-dep.umd.min.js.map 1`] = `"{"version":3,"file":"umd-with-dep.umd.min.js","sources":["../src/index.js"],"sourcesContent":["import { createElement } from \\"react\\";\\n\\ncreateElement(\\"div\\", null);"],"names":["createElement"],"mappings":"iPAEAA,EAAAA,cAAc,MAAO"}"`;
66 changes: 33 additions & 33 deletions packages/cli/src/build/__tests__/__snapshots__/entrypoints.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -78,37 +78,12 @@ exports[`two entrypoints where one requires the other entrypoint: src/multiply.j
export let multiply = (a, b) => identity(a * b);"
`;

exports[`two entrypoints with a common dependency: dist/chunk-this-is-not-the-real-hash-09d8aa2cd41dd37e55ea1ca5c8546d35.esm.js 1`] = `
"let identity = x => x;
export { identity as i };
"
`;

exports[`two entrypoints with a common dependency: dist/chunk-this-is-not-the-real-hash-f57161fefd97e3101601d153708a46b8.cjs.dev.js 1`] = `
"'use strict';
let identity = x => x;
exports.identity = identity;
"
`;

exports[`two entrypoints with a common dependency: dist/chunk-this-is-not-the-real-hash-f57161fefd97e3101601d153708a46b8.cjs.prod.js 1`] = `
"'use strict';
let identity = x => x;
exports.identity = identity;
"
`;

exports[`two entrypoints with a common dependency: dist/common-dependency-two-entrypoints.cjs.dev.js 1`] = `
"'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var identity = require('./chunk-some-hash.cjs.dev.js');
var identity = require('./identity-some-hash.cjs.dev.js');
let sum = (a, b) => identity.identity(a + b);
Expand All @@ -133,7 +108,7 @@ exports[`two entrypoints with a common dependency: dist/common-dependency-two-en
Object.defineProperty(exports, '__esModule', { value: true });
var identity = require('./chunk-some-hash.cjs.prod.js');
var identity = require('./identity-some-hash.cjs.prod.js');
let sum = (a, b) => identity.identity(a + b);
Expand All @@ -143,21 +118,46 @@ exports.sum = sum;
`;

exports[`two entrypoints with a common dependency: dist/common-dependency-two-entrypoints.esm.js 1`] = `
"import { i as identity } from './chunk-some-hash.esm.js';
export { i as identity } from './chunk-some-hash.esm.js';
"import { i as identity } from './identity-some-hash.esm.js';
export { i as identity } from './identity-some-hash.esm.js';
let sum = (a, b) => identity(a + b);
export { sum };
"
`;

exports[`two entrypoints with a common dependency: dist/identity-this-is-not-the-real-hash-09d8aa2cd41dd37e55ea1ca5c8546d35.esm.js 1`] = `
"let identity = x => x;
export { identity as i };
"
`;

exports[`two entrypoints with a common dependency: dist/identity-this-is-not-the-real-hash-f57161fefd97e3101601d153708a46b8.cjs.dev.js 1`] = `
"'use strict';
let identity = x => x;
exports.identity = identity;
"
`;

exports[`two entrypoints with a common dependency: dist/identity-this-is-not-the-real-hash-f57161fefd97e3101601d153708a46b8.cjs.prod.js 1`] = `
"'use strict';
let identity = x => x;
exports.identity = identity;
"
`;

exports[`two entrypoints with a common dependency: multiply/dist/common-dependency-two-entrypoints-multiply.cjs.dev.js 1`] = `
"'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var identity = require('../../dist/chunk-some-hash.cjs.dev.js');
var identity = require('../../dist/identity-some-hash.cjs.dev.js');
let multiply = (a, b) => identity.identity(a * b);
Expand All @@ -182,7 +182,7 @@ exports[`two entrypoints with a common dependency: multiply/dist/common-dependen
Object.defineProperty(exports, '__esModule', { value: true });
var identity = require('../../dist/chunk-some-hash.cjs.prod.js');
var identity = require('../../dist/identity-some-hash.cjs.prod.js');
let multiply = (a, b) => identity.identity(a * b);
Expand All @@ -192,8 +192,8 @@ exports.multiply = multiply;
`;

exports[`two entrypoints with a common dependency: multiply/dist/common-dependency-two-entrypoints-multiply.esm.js 1`] = `
"import { i as identity } from '../../dist/chunk-some-hash.esm.js';
export { i as identity } from '../../dist/chunk-some-hash.esm.js';
"import { i as identity } from '../../dist/identity-some-hash.esm.js';
export { i as identity } from '../../dist/identity-some-hash.esm.js';
let multiply = (a, b) => identity(a * b);
Expand Down

0 comments on commit d2cd411

Please sign in to comment.