Skip to content
This repository was archived by the owner on Sep 9, 2021. It is now read-only.
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"presets": [
[
"env",
{
"useBuiltIns": true,
"targets": {
"node": "4.8"
},
"exclude": [
"transform-async-to-generator",
"transform-regenerator"
]
}
]
],
"plugins": [
[
"transform-object-rest-spread",
{
"useBuiltIns": true
}
]
],
"env": {
"test": {
"presets": [
"env"
],
"plugins": [
"transform-object-rest-spread"
]
}
}
}
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# editorconfig.org

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[.md]
insert_final_newline = false
trim_trailing_whitespace = false
8 changes: 6 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
test/fixtures
test/expected
createInlineWorker.js
test/__expected__

src/workers/InlineWorker.js

/node_modules
/dist
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@d3viant0ne Do you know .eslintrc without extension is deprecated?
http://eslint.org/docs/user-guide/configuring#configuration-file-formats

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's on the list to be changed when we switch everything over to just use Prettier in defaults 2.0

"extends": "webpack"
}
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package-lock.json -diff
* text=auto
bin/* eol=lf
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!--
1. Check the version of package you are using. If it's not the newest version, update and try again (see changelog while updating!).
2. If the issue is still there, write a minimal project showing the problem and expected output.
3. Link to the project and mention Node version and OS in your report.

**IMPORTANT! You should use [Stack Overflow](https://stackoverflow.com/) for support related questions.**
-->
5 changes: 5 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!--
1. [Read and sign the CLA](https://cla.js.foundation/webpack/webpack.js.org). This needs to be done only once. PRs that haven't signed it won't be accepted.
2. Check out the [development guide](https://webpack.js.org/development/) for the API and development guidelines.
3. Read through the PR diff carefully as sometimes this can reveal issues. The work will be reviewed, but this can save some effort.
-->
17 changes: 15 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
node_modules
test/expected
logs
*.log
npm-debug.log*
.eslintcache
/coverage
/dist
/local
/reports
/node_modules
/test/__expected__
.DS_Store
Thumbs.db
.idea
.vscode
*.sublime-project
*.sublime-workspace
50 changes: 46 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,48 @@
sudo: false
dist: trusty
language: node_js
matrix:
branches:
only:
- master
jobs:
fast_finish: true
allow_failures:
- env: WEBPACK_VERSION=canary
include:
- node_js: "7"
- node_js: "6"
- node_js: "4.3"
- &test-latest
stage: Webpack latest
node_js: 6
env: WEBPACK_VERSION=latest JOB_PART=test
script: npm run travis:$JOB_PART
- <<: *test-latest
node_js: 4.8
env: WEBPACK_VERSION=latest JOB_PART=test
script: npm run travis:$JOB_PART
- <<: *test-latest
node_js: 8
env: WEBPACK_VERSION=latest JOB_PART=lint
script: npm run travis:$JOB_PART
- <<: *test-latest
node_js: 8
env: WEBPACK_VERSION=latest JOB_PART=coverage
script: npm run travis:$JOB_PART
after_success: 'bash <(curl -s https://codecov.io/bash)'
- stage: Webpack canary
before_script: npm i --no-save git://github.com/webpack/webpack.git#master
script: npm run travis:$JOB_PART
node_js: 8
env: WEBPACK_VERSION=canary JOB_PART=test
before_install:
- 'if [[ `npm -v` != 5* ]]; then npm i -g npm@^5.0.0; fi'
- nvm --version
- node --version
- npm --version
before_script:
- |-
if [ "$WEBPACK_VERSION" ]; then
npm i --no-save webpack@$WEBPACK_VERSION
fi
script:
- 'npm run travis:$JOB_PART'
after_success:
- 'bash <(curl -s https://codecov.io/bash)'
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.


<a name="1.0.0"></a>
# [1.0.0](https://github.com/webpack-contrib/worker-loader/compare/v0.8.0...v1.0.0) (2017-09-25)
## [1.0.0](https://github.com/webpack-contrib/worker-loader/compare/v0.8.0...v1.0.0) (2017-09-25)


### Features
Expand Down
1 change: 0 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

Copyright JS Foundation and other contributors

Permission is hereby granted, free of charge, to any person obtaining
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ npm i -D worker-loader

<h2 align="center"><a href="https://webpack.js.org/concepts/loaders">Usage</a></h2>

### `Inline`
### `Inlined`

**App.js**
```js
Expand Down Expand Up @@ -191,9 +191,9 @@ ctx.addEventListener("message", (event) => console.log(event));

**App.ts**
```ts
import MyWorker = require("worker-loader!./Worker");
import Worker = require("worker-loader!./Worker");

const worker = new MyWorker();
const worker = new Worker();

worker.postMessage({ a: 1 });
worker.onmessage = (event) => {};
Expand All @@ -203,7 +203,7 @@ worker.addEventListener("message", (event) => {});

### `Cross-Origin Policy`

[`WebWorkers`](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) are restricted by a [same-origin policy](https://en.wikipedia.org/wiki/Same-origin_policy), so if your `webpack` assets are not being served from the same origin as your application, their download may be blocked by your browser. This scenario can commonly occur if you are hosting your assets under a CDN domain. Even downloads from the `webpack-dev-server` could be blocked. There are two workarounds.
[`WebWorkers`](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) are restricted by a [same-origin policy](https://en.wikipedia.org/wiki/Same-origin_policy), so if your `webpack` assets are not being served from the same origin as your application, their download may be blocked by your browser. This scenario can commonly occur if you are hosting your assets under a CDN domain. Even downloads from the `webpack-dev-server` could be blocked. There are two workarounds

Firstly, you can inline the worker as a blob instead of downloading it as an external script via the [`inline`](#inline) parameter

Expand All @@ -220,7 +220,7 @@ import Worker from './file.worker.js';
}
```

Secondly, you may override the base download URL for your worker script via the [`publicPath`](#publicpath) option.
Secondly, you may override the base download URL for your worker script via the [`publicPath`](#publicpath) option

**App.js**
```js
Expand Down
29 changes: 29 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
branches:
only:
- master
init:
- git config --global core.autocrlf input
environment:
matrix:
- nodejs_version: '8'
webpack_version: latest
job_part: test
- nodejs_version: '6'
webpack_version: latest
job_part: test
- nodejs_version: '4.8'
webpack_version: latest
job_part: test
build: 'off'
matrix:
fast_finish: true
install:
- ps: Install-Product node $env:nodejs_version x64
- npm i -g npm@latest
- npm install
before_test:
- cmd: npm install webpack@%webpack_version%
test_script:
- node --version
- npm --version
- cmd: npm run appveyor:%job_part%
76 changes: 0 additions & 76 deletions index.js

This file was deleted.

Loading