condenser 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/condenser.rb +4 -6
- data/lib/condenser/asset.rb +116 -69
- data/lib/condenser/build_cache.rb +107 -0
- data/lib/condenser/cache/file_store.rb +1 -3
- data/lib/condenser/environment.rb +1 -1
- data/lib/condenser/processors/babel_processor.rb +1 -1
- data/lib/condenser/processors/node_modules/@types/estree/LICENSE +21 -21
- data/lib/condenser/processors/node_modules/@types/estree/README.md +16 -16
- data/lib/condenser/processors/node_modules/@types/node/LICENSE +21 -21
- data/lib/condenser/processors/node_modules/@types/node/README.md +16 -16
- data/lib/condenser/processors/node_modules/@types/resolve/README.md +16 -16
- data/lib/condenser/processors/node_modules/babel-plugin-transform-class-extended-hook/test/index.js +107 -107
- data/lib/condenser/processors/node_modules/color-name/.npmignore +106 -106
- data/lib/condenser/processors/node_modules/color-name/LICENSE +7 -7
- data/lib/condenser/processors/node_modules/color-name/README.md +11 -11
- data/lib/condenser/processors/node_modules/color-name/index.js +152 -152
- data/lib/condenser/processors/node_modules/color-name/test.js +7 -7
- data/lib/condenser/processors/node_modules/is-reference/node_modules/@types/estree/LICENSE +21 -21
- data/lib/condenser/processors/node_modules/is-reference/node_modules/@types/estree/README.md +16 -16
- data/lib/condenser/processors/node_modules/is-reference/node_modules/@types/estree/index.d.ts +548 -548
- data/lib/condenser/processors/rollup_processor.rb +0 -8
- data/lib/condenser/resolve.rb +80 -60
- data/lib/condenser/transformers/sass_transformer.rb +1 -1
- data/lib/condenser/transformers/sass_transformer/importer.rb +1 -1
- data/lib/condenser/version.rb +1 -1
- data/test/cache_test.rb +72 -0
- data/test/test_helper.rb +1 -1
- data/test/transformers/scss_test.rb +2 -1
- metadata +17 -2
@@ -94,7 +94,7 @@ class Condenser::BabelProcessor < Condenser::NodeProcessor
|
|
94
94
|
else
|
95
95
|
input[:source] = result['code']
|
96
96
|
input[:map] = result['map']
|
97
|
-
input[:
|
97
|
+
input[:export_dependencies] = result['imports'].map do |i|
|
98
98
|
i.end_with?('.js') ? i : "#{i}.js"
|
99
99
|
end
|
100
100
|
input[:default_export] = result['defaultExport']
|
@@ -1,21 +1,21 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) Microsoft Corporation. All rights reserved.
|
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 all
|
13
|
-
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 THE
|
21
|
-
SOFTWARE
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE
|
@@ -1,16 +1,16 @@
|
|
1
|
-
# Installation
|
2
|
-
> `npm install --save @types/estree`
|
3
|
-
|
4
|
-
# Summary
|
5
|
-
This package contains type definitions for ESTree AST specification (https://github.com/estree/estree).
|
6
|
-
|
7
|
-
# Details
|
8
|
-
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree.
|
9
|
-
|
10
|
-
### Additional Details
|
11
|
-
* Last updated: Mon, 23 Dec 2019 20:14:46 GMT
|
12
|
-
* Dependencies: none
|
13
|
-
* Global values: none
|
14
|
-
|
15
|
-
# Credits
|
16
|
-
These definitions were written by RReverser (https://github.com/RReverser).
|
1
|
+
# Installation
|
2
|
+
> `npm install --save @types/estree`
|
3
|
+
|
4
|
+
# Summary
|
5
|
+
This package contains type definitions for ESTree AST specification (https://github.com/estree/estree).
|
6
|
+
|
7
|
+
# Details
|
8
|
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree.
|
9
|
+
|
10
|
+
### Additional Details
|
11
|
+
* Last updated: Mon, 23 Dec 2019 20:14:46 GMT
|
12
|
+
* Dependencies: none
|
13
|
+
* Global values: none
|
14
|
+
|
15
|
+
# Credits
|
16
|
+
These definitions were written by RReverser (https://github.com/RReverser).
|
@@ -1,21 +1,21 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) Microsoft Corporation. All rights reserved.
|
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 all
|
13
|
-
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 THE
|
21
|
-
SOFTWARE
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE
|
@@ -1,16 +1,16 @@
|
|
1
|
-
# Installation
|
2
|
-
> `npm install --save @types/node`
|
3
|
-
|
4
|
-
# Summary
|
5
|
-
This package contains type definitions for Node.js (http://nodejs.org/).
|
6
|
-
|
7
|
-
# Details
|
8
|
-
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
9
|
-
|
10
|
-
### Additional Details
|
11
|
-
* Last updated: Fri, 03 Jan 2020 23:33:08 GMT
|
12
|
-
* Dependencies: none
|
13
|
-
* Global values: `Buffer`, `Symbol`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
|
14
|
-
|
15
|
-
# Credits
|
16
|
-
These definitions were written by Microsoft TypeScript (https://github.com/Microsoft), DefinitelyTyped (https://github.com/DefinitelyTyped), Alberto Schiabel (https://github.com/jkomyno), Alexander T. (https://github.com/a-tarasyuk), Alvis HT Tang (https://github.com/alvis), Andrew Makarov (https://github.com/r3nya), Benjamin Toueg (https://github.com/btoueg), Bruno Scheufler (https://github.com/brunoscheufler), Chigozirim C. (https://github.com/smac89), Christian Vaagland Tellnes (https://github.com/tellnes), David Junger (https://github.com/touffy), Deividas Bakanas (https://github.com/DeividasBakanas), Eugene Y. Q. Shen (https://github.com/eyqs), Flarna (https://github.com/Flarna), Hannes Magnusson (https://github.com/Hannes-Magnusson-CK), Hoàng Văn Khải (https://github.com/KSXGitHub), Huw (https://github.com/hoo29), Kelvin Jin (https://github.com/kjin), Klaus Meinhardt (https://github.com/ajafff), Lishude (https://github.com/islishude), Mariusz Wiktorczyk (https://github.com/mwiktorczyk), Mohsen Azimi (https://github.com/mohsen1), Nicolas Even (https://github.com/n-e), Nicolas Voigt (https://github.com/octo-sniffle), Nikita Galkin (https://github.com/galkin), Parambir Singh (https://github.com/parambirs), Sebastian Silbermann (https://github.com/eps1lon), Simon Schick (https://github.com/SimonSchick), Thomas den Hollander (https://github.com/ThomasdenH), Wilco Bakker (https://github.com/WilcoBakker), wwwy3y3 (https://github.com/wwwy3y3), Zane Hannan AU (https://github.com/ZaneHannanAU), Samuel Ainsworth (https://github.com/samuela), Kyle Uehlein (https://github.com/kuehlein), Jordi Oliveras Rovira (https://github.com/j-oliveras), Thanik Bhongbhibhat (https://github.com/bhongy), Marcin Kopacz (https://github.com/chyzwar), Trivikram Kamat (https://github.com/trivikr), Minh Son Nguyen (https://github.com/nguymin4), Junxiao Shi (https://github.com/yoursunny), and Ilia Baryshnikov (https://github.com/qwelias).
|
1
|
+
# Installation
|
2
|
+
> `npm install --save @types/node`
|
3
|
+
|
4
|
+
# Summary
|
5
|
+
This package contains type definitions for Node.js (http://nodejs.org/).
|
6
|
+
|
7
|
+
# Details
|
8
|
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
9
|
+
|
10
|
+
### Additional Details
|
11
|
+
* Last updated: Fri, 03 Jan 2020 23:33:08 GMT
|
12
|
+
* Dependencies: none
|
13
|
+
* Global values: `Buffer`, `Symbol`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
|
14
|
+
|
15
|
+
# Credits
|
16
|
+
These definitions were written by Microsoft TypeScript (https://github.com/Microsoft), DefinitelyTyped (https://github.com/DefinitelyTyped), Alberto Schiabel (https://github.com/jkomyno), Alexander T. (https://github.com/a-tarasyuk), Alvis HT Tang (https://github.com/alvis), Andrew Makarov (https://github.com/r3nya), Benjamin Toueg (https://github.com/btoueg), Bruno Scheufler (https://github.com/brunoscheufler), Chigozirim C. (https://github.com/smac89), Christian Vaagland Tellnes (https://github.com/tellnes), David Junger (https://github.com/touffy), Deividas Bakanas (https://github.com/DeividasBakanas), Eugene Y. Q. Shen (https://github.com/eyqs), Flarna (https://github.com/Flarna), Hannes Magnusson (https://github.com/Hannes-Magnusson-CK), Hoàng Văn Khải (https://github.com/KSXGitHub), Huw (https://github.com/hoo29), Kelvin Jin (https://github.com/kjin), Klaus Meinhardt (https://github.com/ajafff), Lishude (https://github.com/islishude), Mariusz Wiktorczyk (https://github.com/mwiktorczyk), Mohsen Azimi (https://github.com/mohsen1), Nicolas Even (https://github.com/n-e), Nicolas Voigt (https://github.com/octo-sniffle), Nikita Galkin (https://github.com/galkin), Parambir Singh (https://github.com/parambirs), Sebastian Silbermann (https://github.com/eps1lon), Simon Schick (https://github.com/SimonSchick), Thomas den Hollander (https://github.com/ThomasdenH), Wilco Bakker (https://github.com/WilcoBakker), wwwy3y3 (https://github.com/wwwy3y3), Zane Hannan AU (https://github.com/ZaneHannanAU), Samuel Ainsworth (https://github.com/samuela), Kyle Uehlein (https://github.com/kuehlein), Jordi Oliveras Rovira (https://github.com/j-oliveras), Thanik Bhongbhibhat (https://github.com/bhongy), Marcin Kopacz (https://github.com/chyzwar), Trivikram Kamat (https://github.com/trivikr), Minh Son Nguyen (https://github.com/nguymin4), Junxiao Shi (https://github.com/yoursunny), and Ilia Baryshnikov (https://github.com/qwelias).
|
@@ -1,16 +1,16 @@
|
|
1
|
-
# Installation
|
2
|
-
> `npm install --save @types/resolve`
|
3
|
-
|
4
|
-
# Summary
|
5
|
-
This package contains type definitions for resolve (https://github.com/substack/node-resolve).
|
6
|
-
|
7
|
-
# Details
|
8
|
-
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped.git/tree/master/types/resolve
|
9
|
-
|
10
|
-
Additional Details
|
11
|
-
* Last updated: Tue, 08 May 2018 17:01:00 GMT
|
12
|
-
* Dependencies: node
|
13
|
-
* Global values: none
|
14
|
-
|
15
|
-
# Credits
|
16
|
-
These definitions were written by Mario Nebl <https://github.com/marionebl>, Klaus Meinhardt <https://github.com/ajafff>.
|
1
|
+
# Installation
|
2
|
+
> `npm install --save @types/resolve`
|
3
|
+
|
4
|
+
# Summary
|
5
|
+
This package contains type definitions for resolve (https://github.com/substack/node-resolve).
|
6
|
+
|
7
|
+
# Details
|
8
|
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped.git/tree/master/types/resolve
|
9
|
+
|
10
|
+
Additional Details
|
11
|
+
* Last updated: Tue, 08 May 2018 17:01:00 GMT
|
12
|
+
* Dependencies: node
|
13
|
+
* Global values: none
|
14
|
+
|
15
|
+
# Credits
|
16
|
+
These definitions were written by Mario Nebl <https://github.com/marionebl>, Klaus Meinhardt <https://github.com/ajafff>.
|
data/lib/condenser/processors/node_modules/babel-plugin-transform-class-extended-hook/test/index.js
CHANGED
@@ -1,107 +1,107 @@
|
|
1
|
-
var assert = require('assert');
|
2
|
-
var babel = require('babel-core');
|
3
|
-
var clear = require('clear');
|
4
|
-
var diff = require('diff');
|
5
|
-
var fs = require('fs');
|
6
|
-
var jsonfile = require('jsonfile');
|
7
|
-
var path = require('path');
|
8
|
-
var Mocha = require('mocha');
|
9
|
-
|
10
|
-
require('babel-register');
|
11
|
-
|
12
|
-
var pluginPath = require.resolve('../src');
|
13
|
-
|
14
|
-
function runTests() {
|
15
|
-
var testsPath = __dirname + '/fixtures/';
|
16
|
-
|
17
|
-
fs.readdirSync(testsPath).map(function(item) {
|
18
|
-
return {
|
19
|
-
path: path.join(testsPath, item),
|
20
|
-
name: item,
|
21
|
-
};
|
22
|
-
}).filter(function(item) {
|
23
|
-
return fs.statSync(item.path).isDirectory();
|
24
|
-
}).forEach(runTest);
|
25
|
-
|
26
|
-
runMocha();
|
27
|
-
}
|
28
|
-
|
29
|
-
function runMocha() {
|
30
|
-
// Instantiate a Mocha instance.
|
31
|
-
var mocha = new Mocha();
|
32
|
-
|
33
|
-
var testDir = path.join(__dirname, 'mocha')
|
34
|
-
|
35
|
-
var suite = path.join(testDir, 'suite.js')
|
36
|
-
|
37
|
-
var output = babel.transformFileSync(suite, {
|
38
|
-
plugins: [pluginPath]
|
39
|
-
});
|
40
|
-
|
41
|
-
var suiteCompiled = path.join(testDir, '.suite_compiled.js');
|
42
|
-
|
43
|
-
fs.writeFileSync(suiteCompiled, output.code);
|
44
|
-
|
45
|
-
delete require.cache[require.resolve(suiteCompiled)];
|
46
|
-
|
47
|
-
mocha.addFile(suiteCompiled);
|
48
|
-
|
49
|
-
// Run the tests.
|
50
|
-
mocha.run();
|
51
|
-
}
|
52
|
-
|
53
|
-
function runTest(dir) {
|
54
|
-
var babelOptions = {
|
55
|
-
plugins: [pluginPath]
|
56
|
-
}
|
57
|
-
|
58
|
-
babelRcPath = path.join(dir.path, '.babelrc');
|
59
|
-
try {
|
60
|
-
fs.accessSync(babelRcPath);
|
61
|
-
babelOptions = jsonfile.readFileSync(babelRcPath);
|
62
|
-
} catch(e) {}
|
63
|
-
|
64
|
-
var output = babel.transformFileSync(dir.path + '/actual.js', babelOptions);
|
65
|
-
|
66
|
-
var expected = fs.readFileSync(dir.path + '/expected.js', 'utf-8');
|
67
|
-
|
68
|
-
function normalizeLines(str) {
|
69
|
-
return str.trimRight().replace(/\r\n/g, '\n');
|
70
|
-
}
|
71
|
-
|
72
|
-
process.stdout.write(dir.name);
|
73
|
-
process.stdout.write('\n\n');
|
74
|
-
|
75
|
-
diff.diffLines(normalizeLines(output.code), normalizeLines(expected))
|
76
|
-
.forEach(function (part) {
|
77
|
-
var value = part.value;
|
78
|
-
if (part.added) {
|
79
|
-
value = part.value;
|
80
|
-
} else if (part.removed) {
|
81
|
-
value = part.value;
|
82
|
-
}
|
83
|
-
|
84
|
-
|
85
|
-
process.stdout.write(value);
|
86
|
-
});
|
87
|
-
|
88
|
-
process.stdout.write('\n\n\n');
|
89
|
-
}
|
90
|
-
|
91
|
-
if (process.argv.indexOf('--watch') >= 0) {
|
92
|
-
require('watch').watchTree(__dirname + '/..', {
|
93
|
-
ignoreDotFiles: true
|
94
|
-
}, function () {
|
95
|
-
delete require.cache[pluginPath];
|
96
|
-
clear();
|
97
|
-
console.log('Press Ctrl+C to stop watching...');
|
98
|
-
console.log('================================');
|
99
|
-
try {
|
100
|
-
runTests();
|
101
|
-
} catch (e) {
|
102
|
-
console.error(e.stack);
|
103
|
-
}
|
104
|
-
});
|
105
|
-
} else {
|
106
|
-
runTests();
|
107
|
-
}
|
1
|
+
var assert = require('assert');
|
2
|
+
var babel = require('babel-core');
|
3
|
+
var clear = require('clear');
|
4
|
+
var diff = require('diff');
|
5
|
+
var fs = require('fs');
|
6
|
+
var jsonfile = require('jsonfile');
|
7
|
+
var path = require('path');
|
8
|
+
var Mocha = require('mocha');
|
9
|
+
|
10
|
+
require('babel-register');
|
11
|
+
|
12
|
+
var pluginPath = require.resolve('../src');
|
13
|
+
|
14
|
+
function runTests() {
|
15
|
+
var testsPath = __dirname + '/fixtures/';
|
16
|
+
|
17
|
+
fs.readdirSync(testsPath).map(function(item) {
|
18
|
+
return {
|
19
|
+
path: path.join(testsPath, item),
|
20
|
+
name: item,
|
21
|
+
};
|
22
|
+
}).filter(function(item) {
|
23
|
+
return fs.statSync(item.path).isDirectory();
|
24
|
+
}).forEach(runTest);
|
25
|
+
|
26
|
+
runMocha();
|
27
|
+
}
|
28
|
+
|
29
|
+
function runMocha() {
|
30
|
+
// Instantiate a Mocha instance.
|
31
|
+
var mocha = new Mocha();
|
32
|
+
|
33
|
+
var testDir = path.join(__dirname, 'mocha')
|
34
|
+
|
35
|
+
var suite = path.join(testDir, 'suite.js')
|
36
|
+
|
37
|
+
var output = babel.transformFileSync(suite, {
|
38
|
+
plugins: [pluginPath]
|
39
|
+
});
|
40
|
+
|
41
|
+
var suiteCompiled = path.join(testDir, '.suite_compiled.js');
|
42
|
+
|
43
|
+
fs.writeFileSync(suiteCompiled, output.code);
|
44
|
+
|
45
|
+
delete require.cache[require.resolve(suiteCompiled)];
|
46
|
+
|
47
|
+
mocha.addFile(suiteCompiled);
|
48
|
+
|
49
|
+
// Run the tests.
|
50
|
+
mocha.run();
|
51
|
+
}
|
52
|
+
|
53
|
+
function runTest(dir) {
|
54
|
+
var babelOptions = {
|
55
|
+
plugins: [pluginPath]
|
56
|
+
}
|
57
|
+
|
58
|
+
babelRcPath = path.join(dir.path, '.babelrc');
|
59
|
+
try {
|
60
|
+
fs.accessSync(babelRcPath);
|
61
|
+
babelOptions = jsonfile.readFileSync(babelRcPath);
|
62
|
+
} catch(e) {}
|
63
|
+
|
64
|
+
var output = babel.transformFileSync(dir.path + '/actual.js', babelOptions);
|
65
|
+
|
66
|
+
var expected = fs.readFileSync(dir.path + '/expected.js', 'utf-8');
|
67
|
+
|
68
|
+
function normalizeLines(str) {
|
69
|
+
return str.trimRight().replace(/\r\n/g, '\n');
|
70
|
+
}
|
71
|
+
|
72
|
+
process.stdout.write(dir.name);
|
73
|
+
process.stdout.write('\n\n');
|
74
|
+
|
75
|
+
diff.diffLines(normalizeLines(output.code), normalizeLines(expected))
|
76
|
+
.forEach(function (part) {
|
77
|
+
var value = part.value;
|
78
|
+
if (part.added) {
|
79
|
+
value = part.value;
|
80
|
+
} else if (part.removed) {
|
81
|
+
value = part.value;
|
82
|
+
}
|
83
|
+
|
84
|
+
|
85
|
+
process.stdout.write(value);
|
86
|
+
});
|
87
|
+
|
88
|
+
process.stdout.write('\n\n\n');
|
89
|
+
}
|
90
|
+
|
91
|
+
if (process.argv.indexOf('--watch') >= 0) {
|
92
|
+
require('watch').watchTree(__dirname + '/..', {
|
93
|
+
ignoreDotFiles: true
|
94
|
+
}, function () {
|
95
|
+
delete require.cache[pluginPath];
|
96
|
+
clear();
|
97
|
+
console.log('Press Ctrl+C to stop watching...');
|
98
|
+
console.log('================================');
|
99
|
+
try {
|
100
|
+
runTests();
|
101
|
+
} catch (e) {
|
102
|
+
console.error(e.stack);
|
103
|
+
}
|
104
|
+
});
|
105
|
+
} else {
|
106
|
+
runTests();
|
107
|
+
}
|
@@ -1,107 +1,107 @@
|
|
1
|
-
//this will affect all the git repos
|
2
|
-
git config --global core.excludesfile ~/.gitignore
|
3
|
-
|
4
|
-
|
5
|
-
//update files since .ignore won't if already tracked
|
6
|
-
git rm --cached <file>
|
7
|
-
|
8
|
-
# Compiled source #
|
9
|
-
###################
|
10
|
-
*.com
|
11
|
-
*.class
|
12
|
-
*.dll
|
13
|
-
*.exe
|
14
|
-
*.o
|
15
|
-
*.so
|
16
|
-
|
17
|
-
# Packages #
|
18
|
-
############
|
19
|
-
# it's better to unpack these files and commit the raw source
|
20
|
-
# git has its own built in compression methods
|
21
|
-
*.7z
|
22
|
-
*.dmg
|
23
|
-
*.gz
|
24
|
-
*.iso
|
25
|
-
*.jar
|
26
|
-
*.rar
|
27
|
-
*.tar
|
28
|
-
*.zip
|
29
|
-
|
30
|
-
# Logs and databases #
|
31
|
-
######################
|
32
|
-
*.log
|
33
|
-
*.sql
|
34
|
-
*.sqlite
|
35
|
-
|
36
|
-
# OS generated files #
|
37
|
-
######################
|
38
|
-
.DS_Store
|
39
|
-
.DS_Store?
|
40
|
-
._*
|
41
|
-
.Spotlight-V100
|
42
|
-
.Trashes
|
43
|
-
# Icon?
|
44
|
-
ehthumbs.db
|
45
|
-
Thumbs.db
|
46
|
-
.cache
|
47
|
-
.project
|
48
|
-
.settings
|
49
|
-
.tmproj
|
50
|
-
*.esproj
|
51
|
-
nbproject
|
52
|
-
|
53
|
-
# Numerous always-ignore extensions #
|
54
|
-
#####################################
|
55
|
-
*.diff
|
56
|
-
*.err
|
57
|
-
*.orig
|
58
|
-
*.rej
|
59
|
-
*.swn
|
60
|
-
*.swo
|
61
|
-
*.swp
|
62
|
-
*.vi
|
63
|
-
*~
|
64
|
-
*.sass-cache
|
65
|
-
*.grunt
|
66
|
-
*.tmp
|
67
|
-
|
68
|
-
# Dreamweaver added files #
|
69
|
-
###########################
|
70
|
-
_notes
|
71
|
-
dwsync.xml
|
72
|
-
|
73
|
-
# Komodo #
|
74
|
-
###########################
|
75
|
-
*.komodoproject
|
76
|
-
.komodotools
|
77
|
-
|
78
|
-
# Node #
|
79
|
-
#####################
|
80
|
-
node_modules
|
81
|
-
|
82
|
-
# Bower #
|
83
|
-
#####################
|
84
|
-
bower_components
|
85
|
-
|
86
|
-
# Folders to ignore #
|
87
|
-
#####################
|
88
|
-
.hg
|
89
|
-
.svn
|
90
|
-
.CVS
|
91
|
-
intermediate
|
92
|
-
publish
|
93
|
-
.idea
|
94
|
-
.graphics
|
95
|
-
_test
|
96
|
-
_archive
|
97
|
-
uploads
|
98
|
-
tmp
|
99
|
-
|
100
|
-
# Vim files to ignore #
|
101
|
-
#######################
|
102
|
-
.VimballRecord
|
103
|
-
.netrwhist
|
104
|
-
|
105
|
-
bundle.*
|
106
|
-
|
1
|
+
//this will affect all the git repos
|
2
|
+
git config --global core.excludesfile ~/.gitignore
|
3
|
+
|
4
|
+
|
5
|
+
//update files since .ignore won't if already tracked
|
6
|
+
git rm --cached <file>
|
7
|
+
|
8
|
+
# Compiled source #
|
9
|
+
###################
|
10
|
+
*.com
|
11
|
+
*.class
|
12
|
+
*.dll
|
13
|
+
*.exe
|
14
|
+
*.o
|
15
|
+
*.so
|
16
|
+
|
17
|
+
# Packages #
|
18
|
+
############
|
19
|
+
# it's better to unpack these files and commit the raw source
|
20
|
+
# git has its own built in compression methods
|
21
|
+
*.7z
|
22
|
+
*.dmg
|
23
|
+
*.gz
|
24
|
+
*.iso
|
25
|
+
*.jar
|
26
|
+
*.rar
|
27
|
+
*.tar
|
28
|
+
*.zip
|
29
|
+
|
30
|
+
# Logs and databases #
|
31
|
+
######################
|
32
|
+
*.log
|
33
|
+
*.sql
|
34
|
+
*.sqlite
|
35
|
+
|
36
|
+
# OS generated files #
|
37
|
+
######################
|
38
|
+
.DS_Store
|
39
|
+
.DS_Store?
|
40
|
+
._*
|
41
|
+
.Spotlight-V100
|
42
|
+
.Trashes
|
43
|
+
# Icon?
|
44
|
+
ehthumbs.db
|
45
|
+
Thumbs.db
|
46
|
+
.cache
|
47
|
+
.project
|
48
|
+
.settings
|
49
|
+
.tmproj
|
50
|
+
*.esproj
|
51
|
+
nbproject
|
52
|
+
|
53
|
+
# Numerous always-ignore extensions #
|
54
|
+
#####################################
|
55
|
+
*.diff
|
56
|
+
*.err
|
57
|
+
*.orig
|
58
|
+
*.rej
|
59
|
+
*.swn
|
60
|
+
*.swo
|
61
|
+
*.swp
|
62
|
+
*.vi
|
63
|
+
*~
|
64
|
+
*.sass-cache
|
65
|
+
*.grunt
|
66
|
+
*.tmp
|
67
|
+
|
68
|
+
# Dreamweaver added files #
|
69
|
+
###########################
|
70
|
+
_notes
|
71
|
+
dwsync.xml
|
72
|
+
|
73
|
+
# Komodo #
|
74
|
+
###########################
|
75
|
+
*.komodoproject
|
76
|
+
.komodotools
|
77
|
+
|
78
|
+
# Node #
|
79
|
+
#####################
|
80
|
+
node_modules
|
81
|
+
|
82
|
+
# Bower #
|
83
|
+
#####################
|
84
|
+
bower_components
|
85
|
+
|
86
|
+
# Folders to ignore #
|
87
|
+
#####################
|
88
|
+
.hg
|
89
|
+
.svn
|
90
|
+
.CVS
|
91
|
+
intermediate
|
92
|
+
publish
|
93
|
+
.idea
|
94
|
+
.graphics
|
95
|
+
_test
|
96
|
+
_archive
|
97
|
+
uploads
|
98
|
+
tmp
|
99
|
+
|
100
|
+
# Vim files to ignore #
|
101
|
+
#######################
|
102
|
+
.VimballRecord
|
103
|
+
.netrwhist
|
104
|
+
|
105
|
+
bundle.*
|
106
|
+
|
107
107
|
_demo
|