Skip to content

Commit

Permalink
Merge branch 'master' into scope-hoisting-destructuring
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic committed May 9, 2019
2 parents 414f426 + ee0acf2 commit fea21c1
Show file tree
Hide file tree
Showing 37 changed files with 2,451 additions and 2,146 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 .prettierrc
@@ -1,4 +1,5 @@
{
"singleQuote": true,
"bracketSpacing": false,
"endOfLine": "lf"
}
24 changes: 21 additions & 3 deletions CHANGELOG.md
@@ -1,11 +1,29 @@
# Changelog

All notable changes to parcel will be documented in this file.
All notable changes to Parcel will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and parcel adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
and Parcel adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.12.0] - 2019-02-06
## [1.12.3] - 2019-03-20

- Downgrade all internal Babel packages to `<7.4.0` because of bugs in that release.

## [1.12.2] - 2019-03-13

- Fix depth option for detailed report

## [1.12.1] - 2019-03-12

### Fixed

- Correctly build dependency URLs (for CSS) [Details](https://github.com/parcel-bundler/parcel/pull/2740)
- Fix bug with original null mappings [Details](https://github.com/parcel-bundler/parcel/pull/2748)
- Regenerate all bundles and trigger an HMR page reload when a new bundle is created [Details](https://github.com/parcel-bundler/parcel/pull/2762)
- Unescaped "." in regex for JSAsset [Details](https://github.com/parcel-bundler/parcel/pull/2759)
- Open the specified host [Details](https://github.com/parcel-bundler/parcel/pull/2763)

## [1.12.0] - 2019-03-06

### Added

Expand Down
20 changes: 10 additions & 10 deletions PARCEL_2_RFC.md
Expand Up @@ -1030,16 +1030,16 @@ system.

All plugins must follow a naming system:

| | Official package | Community packages | Private company/scoped team packages |
| ---------- | -------------------------- | ------------------------- | ------------------------------------ |
| Configs | `@parcel/config-{name}` | `parcel-config-{name}` | `@scope/parcel-config-{name}` |
| Resolvers | `@parcel/resolver-{name}` | `parcel-resolver-{name}` | `@scope/parcel-resolver-{name}` |
| Transforms | `@parcel/transform-{name}` | `parcel-transform-{name}` | `@scope/parcel-transform-{name}` |
| Loaders | `@parcel/loader-{name}` | `parcel-loader-{name}` | `@scope/parcel-loader-{name}` |
| Bundlers | `@parcel/bundler-{name}` | `parcel-bundler-{name}` | `@scope/parcel-bundler-{name}` |
| Packagers | `@parcel/packager-{name}` | `parcel-packager-{name}` | `@scope/parcel-packager-{name}` |
| Namers | `@parcel/namer-{name}` | `parcel-namer-{name}` | `@scope/parcel-namer-{name}` |
| Reporters | `@parcel/reporter-{name}` | `parcel-reporter-{name}` | `@scope/parcel-reporter-{name}` |
| | Official package | Community packages | Private company/scoped team packages |
| ---------- | -------------------------- | ------------------------- | -------------------------------------- |
| Configs | `@parcel/config-{name}` | `parcel-config-{name}` | `@scope/parcel-config[-{name}]` |
| Resolvers | `@parcel/resolver-{name}` | `parcel-resolver-{name}` | `@scope/parcel-resolver[-{name}]` |
| Transforms | `@parcel/transform-{name}` | `parcel-transform-{name}` | `@scope/parcel-transform[-{name}]` |
| Loaders | `@parcel/loader-{name}` | `parcel-loader-{name}` | `@scope/parcel-loader[-{name}]` |
| Bundlers | `@parcel/bundler-{name}` | `parcel-bundler-{name}` | `@scope/parcel-bundler[-{name}]` |
| Packagers | `@parcel/packager-{name}` | `parcel-packager-{name}` | `@scope/parcel-packager[-{name}]` |
| Namers | `@parcel/namer-{name}` | `parcel-namer-{name}` | `@scope/parcel-namer[-{name}]` |
| Reporters | `@parcel/reporter-{name}` | `parcel-reporter-{name}` | `@scope/parcel-reporter[-{name}]` |

The `{name}` must be descriptive and directly related to the purpose of the
package. Someone should be able to have an idea of what the package does simply
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"
}
}
6 changes: 3 additions & 3 deletions packages/core/integration-tests/package.json
@@ -1,6 +1,6 @@
{
"name": "@parcel/integration-tests",
"version": "1.12.0",
"version": "1.12.3",
"private": true,
"license": "MIT",
"repository": {
Expand All @@ -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 All @@ -27,7 +27,7 @@
"mocha-multi-reporters": "^1.1.7",
"ncp": "^2.0.0",
"nyc": "^11.1.0",
"parcel-bundler": "^1.12.0",
"parcel-bundler": "^1.12.3",
"rimraf": "^2.6.1",
"sinon": "^5.0.1",
"sourcemap-validator": "^1.0.6",
Expand Down
17 changes: 8 additions & 9 deletions packages/core/integration-tests/test/css.js
Expand Up @@ -166,7 +166,7 @@ describe('css', function() {
path.join(__dirname, '/dist/index.css'),
'utf8'
);
assert(/url\("test\.[0-9a-f]+\.woff2"\)/.test(css));
assert(/url\("\/test\.[0-9a-f]+\.woff2"\)/.test(css));
assert(css.includes('url("http://google.com")'));
assert(css.includes('.index'));
assert(css.includes('url("data:image/gif;base64,quotes")'));
Expand All @@ -179,7 +179,7 @@ describe('css', function() {
path.join(
__dirname,
'/dist/',
css.match(/url\("(test\.[0-9a-f]+\.woff2)"\)/)[1]
css.match(/url\("(\/test\.[0-9a-f]+\.woff2)"\)/)[1]
)
)
);
Expand Down Expand Up @@ -225,7 +225,10 @@ describe('css', function() {
path.join(__dirname, '/dist/index.css'),
'utf8'
);
assert(/url\(test\.[0-9a-f]+\.woff2\)/.test(css), 'woff ext found in css');
assert(
/url\(\/test\.[0-9a-f]+\.woff2\)/.test(css),
'woff ext found in css'
);
assert(css.includes('url(http://google.com)'), 'url() found');
assert(css.includes('.index'), '.index found');
assert(css.includes('url("data:image/gif;base64,quotes")'));
Expand All @@ -238,7 +241,7 @@ describe('css', function() {
path.join(
__dirname,
'/dist/',
css.match(/url\((test\.[0-9a-f]+\.woff2)\)/)[1]
css.match(/url\((\/test\.[0-9a-f]+\.woff2)\)/)[1]
)
)
);
Expand Down Expand Up @@ -282,11 +285,7 @@ describe('css', function() {

assert(
await fs.exists(
path.join(
__dirname,
path.dirname('/dist/a/style1.css'),
css.match(/url\(([^)]*)\)/)[1]
)
path.join(__dirname, 'dist', css.match(/url\(([^)]*)\)/)[1])
),
'path specified in url() exists'
);
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,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
4 changes: 2 additions & 2 deletions packages/core/integration-tests/test/sass.js
Expand Up @@ -188,7 +188,7 @@ describe('sass', function() {
path.join(__dirname, '/dist/index.css'),
'utf8'
);
assert(/url\("test\.[0-9a-f]+\.woff2"\)/.test(css));
assert(/url\("\/test\.[0-9a-f]+\.woff2"\)/.test(css));
assert(css.includes('url("http://google.com")'));
assert(css.includes('.index'));

Expand All @@ -197,7 +197,7 @@ describe('sass', function() {
path.join(
__dirname,
'/dist/',
css.match(/url\("(test\.[0-9a-f]+\.woff2)"\)/)[1]
css.match(/url\("(\/test\.[0-9a-f]+\.woff2)"\)/)[1]
)
)
);
Expand Down
59 changes: 58 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 @@ -1173,6 +1205,31 @@ describe('scope hoisting', function() {
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(
Expand Down

0 comments on commit fea21c1

Please sign in to comment.