Skip to content

Commit 5083be7

Browse files
author
Val
committed
initial commit. testing set up
0 parents  commit 5083be7

File tree

11 files changed

+177
-0
lines changed

11 files changed

+177
-0
lines changed

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# http://EditorConfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
indent_style = space
11+
12+
[*.{js,json,md}]
13+
indent_size = 2

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.idea/
2+
.DS_Store
3+
*.log
4+
*.swp
5+
node_modules/**/*
6+
!node_modules/__this-loader
7+
test/build/

.npmignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.idea/
2+
.DS_Store
3+
*.log
4+
*.swp
5+
node_modules/

LICENCE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 Valentyn Barmashyn
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

index.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = function (source) {
2+
console.log(source);
3+
return source;
4+
};

package.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "replace-loader",
3+
"version": "0.0.1",
4+
"description": "",
5+
"keywords": [
6+
"webpack",
7+
"webpack-loader"
8+
],
9+
"scripts": {
10+
"test": "mocha"
11+
},
12+
"main": "index.js",
13+
"dependencies": {},
14+
"devDependencies": {
15+
"chai": "^3.2.0",
16+
"mocha": "^2.3.2",
17+
"webpack": "^1.12.1"
18+
},
19+
"peerDependencies": {
20+
"webpack": "^1.9.0"
21+
},
22+
"repository": {
23+
"type": "git",
24+
"url": "https://github.com/Va1/replace-loader.git"
25+
},
26+
"homepage": "https://github.com/Va1/replace-loader",
27+
"author": "Valentyn Barmashyn <[email protected]>",
28+
"license": "MIT",
29+
"private": false
30+
}

test/index.test.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
var path = require('path');
2+
var expect = require('chai').expect;
3+
var webpack = require('webpack');
4+
5+
describe('Webpack replace loader ...', function () {
6+
7+
it('should replace', function (done) {
8+
webpack(
9+
{
10+
entry: path.join(__dirname, 'source/entry.js'),
11+
output: {
12+
path: path.join(__dirname, 'build'),
13+
filename: 'build.js'
14+
},
15+
module: {
16+
loaders: [
17+
{
18+
test: /\.js$/,
19+
loaders: [
20+
'__this'
21+
]
22+
}
23+
]
24+
}
25+
},
26+
function (error, stats) {
27+
expect(error).to.equal(null);
28+
29+
expect(1).to.equal(1);
30+
done();
31+
}
32+
);
33+
});
34+
35+
});

test/result.js

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/******/ (function(modules) { // webpackBootstrap
2+
/******/ // The module cache
3+
/******/ var installedModules = {};
4+
5+
/******/ // The require function
6+
/******/ function __webpack_require__(moduleId) {
7+
8+
/******/ // Check if module is in cache
9+
/******/ if(installedModules[moduleId])
10+
/******/ return installedModules[moduleId].exports;
11+
12+
/******/ // Create a new module (and put it into the cache)
13+
/******/ var module = installedModules[moduleId] = {
14+
/******/ exports: {},
15+
/******/ id: moduleId,
16+
/******/ loaded: false
17+
/******/ };
18+
19+
/******/ // Execute the module function
20+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21+
22+
/******/ // Flag the module as loaded
23+
/******/ module.loaded = true;
24+
25+
/******/ // Return the exports of the module
26+
/******/ return module.exports;
27+
/******/ }
28+
29+
30+
/******/ // expose the modules object (__webpack_modules__)
31+
/******/ __webpack_require__.m = modules;
32+
33+
/******/ // expose the module cache
34+
/******/ __webpack_require__.c = installedModules;
35+
36+
/******/ // __webpack_public_path__
37+
/******/ __webpack_require__.p = "";
38+
39+
/******/ // Load entry module and return exports
40+
/******/ return __webpack_require__(0);
41+
/******/ })
42+
/************************************************************************/
43+
/******/ ([
44+
/* 0 */
45+
/***/ function(module, exports) {
46+
47+
var foo = 'bar';
48+
49+
50+
/***/ }
51+
/******/ ]);

test/source/bar.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
var value = 'baz';
2+
3+
module.exports = value;

test/source/entry.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var foo = require('./foo');
2+
var bar = require('./bar');
3+
var value = 'baz';
4+
5+
console.log(foo + bar + value);

test/source/foo.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
var value = 'foo';
2+
3+
module.exports = value;

0 commit comments

Comments
 (0)