Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit caf2aab

Browse files
authored
feat: change expected module API
BREAKING CHANGE: This commit introduces a major refactoring of the loader. - Remove node 0.10 and node 0.12 support - The loaded module must now export a function - This function will be called with the loader options - This function must return an object with this structure Property | Type | Description :--------|:-----|:----------- `code` | `string|Buffer` | **Required**. The code that is passed to the next loader or to webpack. `sourceMap` | [`SourceMap`](https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit) | **Optional**. Will be pased to the next loader or to webpack. `ast` | `any` | **Optional**. An [Abstract Syntax Tree](https://en.wikipedia.org/wiki/Abstract_syntax_tree) that will be passed to the next loader. Useful to speed up the build time if the next loader uses the same AST. `dependencies` | `Array<string>` | **Default: `[]`**. An array of absolute, native paths to file dependencies that need to be watched for changes. `cacheable` | `boolean` | **Default: `false`**. Flag whether the code can be re-used in watch mode if none of the `dependencies` have changed. - The function may also return a promise for async results - Switch tooling to webpack-defaults #11
1 parent d873c86 commit caf2aab

37 files changed

+6043
-71
lines changed

.babelrc

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"presets": [
3+
[
4+
"env",
5+
{
6+
"modules": false,
7+
"useBuiltIns": true,
8+
"targets": {
9+
"node": 4.3
10+
},
11+
"exclude": [
12+
"transform-async-to-generator",
13+
"transform-regenerator"
14+
]
15+
}
16+
]
17+
],
18+
"env": {
19+
"test": {
20+
"presets": [
21+
"env"
22+
]
23+
}
24+
}
25+
}

.editorconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
end_of_line = lf
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
12+
[package.json]
13+
indent_size = 2
14+
15+
[.md]
16+
insert_final_newline = false
17+
trim_trailing_whitespace = false

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/node_modules
2+
/dist
3+
/test/output

.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "webpack"
3+
}

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
yarn.lock -diff
2+
* text=auto
3+
bin/* eol=lf

.github/ISSUE_TEMPLATE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
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+
2. If the issue is still there, write a minimal project showing the problem and expected output.
3+
3. Link to the project and mention Node version and OS in your report.
4+
5+
**IMPORTANT! You should use [Stack Overflow](https://stackoverflow.com/) for support related questions.**

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<!--
2+
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.
3+
2. Check out the [development guide](https://webpack.js.org/development/) for the API and development guidelines.
4+
3. Read through the PR diff carefully as sometimes this can reveal issues. The work will be reviewed, but this can save some effort.
5+
-->

.gitignore

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,14 @@
1-
node_modules
1+
yarn-debug.log*
2+
.eslintcache
3+
/coverage
4+
/dist
5+
/local
6+
/reports
7+
/node_modules
8+
.DS_Store
9+
Thumbs.db
10+
.idea
11+
.vscode
12+
*.sublime-project
13+
*.sublime-workspace
14+
/test/output

.travis.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
sudo: false
2+
language: node_js
3+
branches:
4+
only:
5+
- master
6+
matrix:
7+
fast_finish: true
8+
include:
9+
- os: linux
10+
node_js: '7'
11+
env: WEBPACK_VERSION="2.2.0" JOB_PART=lint
12+
- os: linux
13+
node_js: '4.3'
14+
env: WEBPACK_VERSION="2.2.0" JOB_PART=test
15+
- os: linux
16+
node_js: '6'
17+
env: WEBPACK_VERSION="2.2.0" JOB_PART=test
18+
- os: linux
19+
node_js: '7'
20+
env: WEBPACK_VERSION="2.2.0" JOB_PART=coverage
21+
before_install:
22+
- nvm --version
23+
- node --version
24+
before_script:
25+
- |-
26+
if [ "$WEBPACK_VERSION" ]; then
27+
yarn add webpack@^$WEBPACK_VERSION
28+
fi
29+
script:
30+
- 'yarn run travis:$JOB_PART'
31+
after_success:
32+
- 'bash <(curl -s https://codecov.io/bash)'

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Change Log
2+
3+
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.
4+
5+
x.x.x / <year>-<month>-<day>
6+
==================
7+
8+
* Bug fix -
9+
* Feature -
10+
* Chore -
11+
* Docs -

0 commit comments

Comments
 (0)