Skip to content

Commit

Permalink
Merge branch 'master' of github.com:parcel-bundler/parcel into featur…
Browse files Browse the repository at this point in the history
…e/strip-type-module-attr

* 'master' of github.com:parcel-bundler/parcel:
  fix source maps on coffeescript assets (parcel-bundler#3423)
  Fixes parcel-bundler#3133 by upgrading serialize-to-js from 1.1.1 to 3.0.0  (parcel-bundler#3451)
  Fix up misleading usage information (parcel-bundler#3158)
  bump chokidar to get a reload fix for linux (parcel-bundler#2878)
  Use uppercase for the first letter of the issue template (parcel-bundler#3192)
  Update dotenv-expand to allow overriding of falsy values (parcel-bundler#2971)
  Fixes 3076: HMR update breaks in webworker due to window (and location.reload) not existing in web worker context. (parcel-bundler#3078)
  Scope hoisting destructuring (parcel-bundler#2742)
  Create FUNDING.yml (parcel-bundler#3074)
  Added new info command  (parcel-bundler#3068)
  Fix typo (parcel-bundler#3043)
  Update deps & gitattributes (parcel-bundler#3006)
  Fix assigning to exports from inside a function in scope hoisting (parcel-bundler#2994)
  Define __esModule interop flag when requiring ES module from CommonJS (parcel-bundler#2993)
  Replace module.require in scope hoisting (parcel-bundler#2875)
  Clear scope cache before crawling (parcel-bundler#2986)
  Fix CI (parcel-bundler#2990)
  Shake exports with pure property assignments (parcel-bundler#2979)
  Update postcss.js (parcel-bundler#2922)
  Fail immediately if yarn.lock updates are needed (parcel-bundler#2945)
  • Loading branch information
twome committed Sep 10, 2019
2 parents 78937be + fe08980 commit bae75b8
Show file tree
Hide file tree
Showing 46 changed files with 1,116 additions and 1,026 deletions.
7 changes: 7 additions & 0 deletions .gitattributes
@@ -0,0 +1,7 @@
# Always use unix style line-endings
* text eol=lf
*.jpeg binary
*.jpg binary
*.png binary
*.wasm binary
*.woff2 binary
1 change: 1 addition & 0 deletions .github/FUNDING.yml
@@ -0,0 +1 @@
open_collective: parcel
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/Feature_Request.md
Expand Up @@ -9,7 +9,7 @@ Thanks for filing an issue 😄 ! Before you submit, please read the following:
Search open/closed issues before submitting since someone might have asked the same thing before!
-->

# 🙋 feature request
# 🙋 Feature request

<!--- Provide a general summary of the issue here -->

Expand Down
1 change: 1 addition & 0 deletions .prettierrc
@@ -1,4 +1,5 @@
{
"singleQuote": true,
"bracketSpacing": false,
"endOfLine": "lf"
}
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Expand Up @@ -69,7 +69,7 @@ While contributing to parcel, you may need to run a local version of parcel and

To do this, you have multiple options:

* If you had **parcel** installed globally, you can run `yarn global remove parcel` and then `cd` to your own copy of parcel and run `yarn link`. This way, the global parcel in your PATH would reference to the local copy. To make sure you have it installed globally, just run `parcel --version`.
* If you had **parcel** installed globally, you can run `yarn global remove parcel-bundler` and then `cd` to your own copy of parcel and run `yarn link`. This way, the global parcel in your PATH would reference to the local copy. To make sure you have it installed globally, just run `parcel --version`.

* Another option would be to run `yarn link` in your own copy of parcel directory and then go to the directory, _which you want to test your copy of parcel in_, and run `yarn link parcel-bundler`, so that locally your copy of parcel is the one used in its npm scripts.

Expand Down
4 changes: 3 additions & 1 deletion azure-pipelines-template.yml
Expand Up @@ -36,7 +36,9 @@ jobs:
cargo -V
displayName: Install Rust
- script: yarn
# use `--frozen-lockfile` to fail immediately if the committed yarn.lock needs updates
# https://yarnpkg.com/lang/en/docs/cli/install/#toc-yarn-install-frozen-lockfile
- script: yarn --frozen-lockfile
displayName: 'Install dependencies'
- script: yarn test-ci
displayName: 'Run tests'
Expand Down
2 changes: 1 addition & 1 deletion packages/core/babel-register/package.json
Expand Up @@ -13,6 +13,6 @@
"@babel/core": "^7.0.0"
},
"dependencies": {
"@babel/register": "^7.0.0"
"@babel/register": "^7.4.4"
}
}
2 changes: 1 addition & 1 deletion packages/core/integration-tests/package.json
Expand Up @@ -12,7 +12,7 @@
"test-ci": "yarn test --reporter mocha-multi-reporters --reporter-options configFile=./test/mochareporters.json"
},
"devDependencies": {
"@babel/core": "^7.2.0",
"@babel/core": "^7.4.4",
"@jetbrains/kotlinc-js-api": "^1.2.12",
"@parcel/fs": "^1.11.0",
"@parcel/test-utils": "^1.12.0",
Expand Down
Expand Up @@ -6,19 +6,19 @@
"elm-version": "0.19.0",
"dependencies": {
"direct": {
"elm/browser": "1.0.0",
"elm/core": "1.0.0",
"elm/browser": "1.0.1",
"elm/core": "1.0.2",
"elm/html": "1.0.0"
},
"indirect": {
"elm/json": "1.0.0",
"elm/json": "1.1.3",
"elm/time": "1.0.0",
"elm/url": "1.0.0",
"elm/virtual-dom": "1.0.0"
"elm/virtual-dom": "1.0.2"
}
},
"test-dependencies": {
"direct": {},
"indirect": {}
}
}
}
10 changes: 5 additions & 5 deletions packages/core/integration-tests/test/integration/elm/elm.json
Expand Up @@ -6,19 +6,19 @@
"elm-version": "0.19.0",
"dependencies": {
"direct": {
"elm/browser": "1.0.0",
"elm/core": "1.0.0",
"elm/browser": "1.0.1",
"elm/core": "1.0.2",
"elm/html": "1.0.0"
},
"indirect": {
"elm/json": "1.0.0",
"elm/json": "1.1.3",
"elm/time": "1.0.0",
"elm/url": "1.0.0",
"elm/virtual-dom": "1.0.0"
"elm/virtual-dom": "1.0.2"
}
},
"test-dependencies": {
"direct": {},
"indirect": {}
}
}
}
@@ -0,0 +1,4 @@
var b = require('./b');

b.setValue(2);
module.exports = b.value;
@@ -0,0 +1,3 @@
exports.setValue = function (value) {
exports.value = value;
}
@@ -0,0 +1 @@
module.exports = require('./b');
@@ -0,0 +1 @@
export default 2;
@@ -1,6 +1,7 @@
output = {
id: module.id,
hot: module.hot,
moduleRequire: module.require,
type: typeof module,
exports: exports,
exportsType: typeof exports,
Expand Down
@@ -0,0 +1,3 @@
(function(){
output = require('./b');
})();
@@ -0,0 +1,4 @@
const x = [1, 2]
const [a, b] = x;

module.exports = [a, b];
@@ -0,0 +1,4 @@
{
"private": true,
"browserslist": ["node 8"]
}
@@ -0,0 +1,3 @@
(function(){
output = require('./b');
})();
@@ -0,0 +1,7 @@
const x = {
a: 4,
b: 2
}
const {a, b} = x;

module.exports = [a, b];
@@ -0,0 +1,4 @@
{
"private": true,
"browserslist": ["node 8"]
}
@@ -0,0 +1,2 @@
import Test from './b';
output = Test.create();
@@ -0,0 +1,9 @@
export default class Test {
constructor() {
this.foo = 'bar';
}

static create() {
return new Test();
}
}
@@ -0,0 +1,5 @@
{
"name": "default-export-class-rename",
"private": true,
"browserslist": ["last 1 Chrome version"]
}
@@ -0,0 +1,3 @@
import {foo} from './b';

output = foo;
@@ -0,0 +1,4 @@
export const foo = 2;

export function bar() {}
bar.displayName = 'hello';
2 changes: 1 addition & 1 deletion packages/core/integration-tests/test/mochareporters.json
@@ -1,5 +1,5 @@
{
"reporterEnabled": "mocha-junit-reporter",
"reporterEnabled": "spec, mocha-junit-reporter",
"mochaJunitReporterReporterOptions": {
"mochaFile": "junit-testresults.xml"
}
Expand Down
83 changes: 82 additions & 1 deletion packages/core/integration-tests/test/scope-hoisting.js
Expand Up @@ -299,7 +299,7 @@ describe('scope hoisting', function() {
);
} catch (err) {
threw = true;
assert.equal(err.message, "export 'Test' is not defined");
assert.equal(err.message, "Export 'Test' is not defined (1:8)");
}

assert(threw);
Expand Down Expand Up @@ -549,6 +549,37 @@ describe('scope hoisting', function() {
let output = await run(b);
assert.deepEqual(output, 'bar');
});

it('should shake pure property assignments', async function() {
let b = await bundle(
path.join(
__dirname,
'/integration/scope-hoisting/es6/pure-assignment/a.js'
)
);

let output = await run(b);
assert.deepEqual(output, 2);

let contents = await fs.readFile(
path.join(__dirname, 'dist/a.js'),
'utf8'
);
assert(!/bar/.test(contents));
assert(!/displayName/.test(contents));
});

it('should correctly rename references to default exported classes', async function() {
let b = await bundle(
path.join(
__dirname,
'/integration/scope-hoisting/es6/default-export-class-rename/a.js'
)
);

let output = await run(b);
assert.deepEqual(output.foo, 'bar');
});
});

describe('commonjs', function() {
Expand Down Expand Up @@ -877,6 +908,7 @@ describe('scope hoisting', function() {
let output = await run(b);
assert.equal(output.id, b.entryAsset.id);
assert.equal(output.hot, null);
assert.equal(output.moduleRequire, null);
assert.equal(output.type, 'object');
assert.deepEqual(output.exports, {});
assert.equal(output.exportsType, 'object');
Expand Down Expand Up @@ -1172,5 +1204,54 @@ describe('scope hoisting', function() {
let output = await run(b);
assert.deepEqual(output, 42);
});

it('should insert __esModule interop flag when importing from an ES module', async function() {
let b = await bundle(
path.join(
__dirname,
'/integration/scope-hoisting/commonjs/interop-require-es-module/a.js'
)
);

let output = await run(b);
assert.equal(output.__esModule, true);
assert.equal(output.default, 2);
});

it('should support assigning to exports from inside a function', async function() {
let b = await bundle(
path.join(
__dirname,
'/integration/scope-hoisting/commonjs/export-assign-scope/a.js'
)
);

let output = await run(b);
assert.deepEqual(output, 2);
});

it('should support wrapping array destructuring declarations', async function() {
let b = await bundle(
path.join(
__dirname,
'/integration/scope-hoisting/commonjs/wrap-destructuring-array/a.js'
)
);

let output = await run(b);
assert.deepEqual(output, [1, 2]);
});

it('should support wrapping object destructuring declarations', async function() {
let b = await bundle(
path.join(
__dirname,
'/integration/scope-hoisting/commonjs/wrap-destructuring-object/a.js'
)
);

let output = await run(b);
assert.deepEqual(output, [4, 2]);
});
});
});
42 changes: 22 additions & 20 deletions packages/core/parcel-bundler/package.json
Expand Up @@ -15,18 +15,18 @@
"index.js"
],
"dependencies": {
"@babel/code-frame": "^7.0.0 <7.4.0",
"@babel/core": "^7.0.0 <7.4.0",
"@babel/generator": "^7.0.0 <7.4.0",
"@babel/parser": "^7.0.0 <7.4.0",
"@babel/plugin-transform-flow-strip-types": "^7.0.0 <7.4.0",
"@babel/plugin-transform-modules-commonjs": "^7.0.0 <7.4.0",
"@babel/plugin-transform-react-jsx": "^7.0.0 <7.4.0",
"@babel/preset-env": "^7.0.0 <7.4.0",
"@babel/runtime": "^7.0.0 <7.4.0",
"@babel/template": "^7.0.0 <7.4.0",
"@babel/traverse": "^7.0.0 <7.4.0",
"@babel/types": "^7.0.0 <7.4.0",
"@babel/code-frame": "^7.0.0",
"@babel/core": "^7.4.4",
"@babel/generator": "^7.4.4",
"@babel/parser": "^7.4.4",
"@babel/plugin-transform-flow-strip-types": "^7.4.4",
"@babel/plugin-transform-modules-commonjs": "^7.4.4",
"@babel/plugin-transform-react-jsx": "^7.0.0",
"@babel/preset-env": "^7.4.4",
"@babel/runtime": "^7.4.4",
"@babel/template": "^7.4.4",
"@babel/traverse": "^7.4.4",
"@babel/types": "^7.4.4",
"@iarna/toml": "^2.2.0",
"@parcel/fs": "^1.11.0",
"@parcel/logger": "^1.11.0",
Expand All @@ -40,12 +40,14 @@
"clone": "^2.1.1",
"command-exists": "^1.2.6",
"commander": "^2.11.0",
"core-js": "^2.6.5",
"cross-spawn": "^6.0.4",
"css-modules-loader-core": "^1.1.0",
"cssnano": "^4.0.0",
"deasync": "^0.1.14",
"dotenv": "^5.0.0",
"dotenv-expand": "^4.2.0",
"dotenv-expand": "^5.1.0",
"envinfo": "^7.3.1",
"fast-glob": "^2.2.2",
"filesize": "^3.6.0",
"get-port": "^3.2.0",
Expand All @@ -66,18 +68,18 @@
"posthtml-render": "^1.1.3",
"resolve": "^1.4.0",
"semver": "^5.4.1",
"serialize-to-js": "^1.1.1",
"serialize-to-js": "^3.0.0",
"serve-static": "^1.12.4",
"source-map": "0.6.1",
"terser": "^3.7.3",
"v8-compile-cache": "^2.0.0",
"ws": "^5.1.1"
},
"devDependencies": {
"@babel/cli": "^7.0.0 <7.4.0",
"@babel/plugin-syntax-export-default-from": "^7.0.0 <7.4.0",
"@babel/plugin-syntax-export-namespace-from": "^7.0.0 <7.4.0",
"@babel/plugin-transform-runtime": "^7.0.0 <7.4.0",
"@babel/cli": "^7.4.4",
"@babel/plugin-syntax-export-default-from": "^7.0.0",
"@babel/plugin-syntax-export-namespace-from": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.4.4",
"@babel/preset-flow": "^7.0.0 <7.4.0",
"@parcel/babel-register": "^1.11.0 <7.4.0",
"@parcel/test-utils": "^1.12.0",
Expand All @@ -89,7 +91,7 @@
"codecov": "^3.0.0",
"coffeescript": "^2.0.3",
"cross-env": "^5.1.1",
"elm": "^0.19.0",
"elm": "^0.19.0-bugfix6",
"elm-hot": "^1.0.1",
"eslint": "^4.13.0",
"glslify-bundle": "^5.0.0",
Expand All @@ -104,7 +106,7 @@
"mocha-multi-reporters": "^1.1.7",
"ncp": "^2.0.0",
"nib": "^1.1.2",
"node-elm-compiler": "^5.0.1",
"node-elm-compiler": "^5.0.3",
"nyc": "^11.1.0",
"postcss-modules": "^1.4.1",
"posthtml-extend": "^0.2.1",
Expand Down

0 comments on commit bae75b8

Please sign in to comment.