Skip to content

Commit

Permalink
v1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayMakhonin committed Mar 9, 2019
1 parent c7a40b6 commit 00f15ec
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 10 deletions.
5 changes: 5 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
1.0.4 / 2019-03-08
===================

* Don't remove themePath extension

1.0.3 / 2019-03-08
===================

Expand Down
2 changes: 1 addition & 1 deletion dist/js/main/node/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function themesPreprocess(themesFilePath, preprocess, options = {}) {
throw new Error('argument "preprocess.style" is not a function');
}

themesFilePath = require.resolve(themesFilePath).replace(/\\/g, '/').replace(/\.[^/.]+$/, '');
themesFilePath = require.resolve(themesFilePath).replace(/\\/g, '/');
options = { ...optionsDefault,
...options,
langs: {
Expand Down
10 changes: 9 additions & 1 deletion dist/js/test/tests/node/main/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,15 @@ module.exports = themeBuilder('${componentId.replace(/'/g, '\'')}')
it('preprocess', async function () {
this.timeout(60000);
await Promise.all(cssLangs.flatMap(lang => componentTypes.map(async componentType => {
const compiled = await compileWithThemes(componentType, lang);
let compiled;

try {
compiled = await compileWithThemes(componentType, lang);
} catch (ex) {
console.error(componentType, lang, ex);
throw ex;
}

console.log(componentType, lang);
assert.ok(compiled.css.code);
assert.include(compiled.css.code, '.theme_dark h1');
Expand Down
2 changes: 1 addition & 1 deletion dist/mjs/main/node/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default function themesPreprocess(themesFilePath, preprocess) {
throw new Error('argument "preprocess.style" is not a function');
}

themesFilePath = require.resolve(themesFilePath).replace(/\\/g, '/').replace(/\.[^/.]+$/, '');
themesFilePath = require.resolve(themesFilePath).replace(/\\/g, '/');
options = _objectSpread({}, optionsDefault, options, {
langs: _objectSpread({
scss: function scss(componentId, themesPath) {
Expand Down
19 changes: 15 additions & 4 deletions dist/mjs/test/tests/node/main/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,22 @@ describe('node > main > main', function () {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
_context3.prev = 0;
_context3.next = 3;
return compileWithThemes(componentType, lang);

case 2:
case 3:
compiled = _context3.sent;
_context3.next = 10;
break;

case 6:
_context3.prev = 6;
_context3.t0 = _context3["catch"](0);
console.error(componentType, lang, _context3.t0);
throw _context3.t0;

case 10:
console.log(componentType, lang);
assert.ok(compiled.css.code);
assert.include(compiled.css.code, '.theme_dark h1');
Expand All @@ -269,12 +280,12 @@ describe('node > main > main', function () {
assert.match(compiled.css.code, new RegExp("component-type:\\s*[\"']".concat(componentType, "[\"']")));
}

case 9:
case 16:
case "end":
return _context3.stop();
}
}
}, _callee3);
}, _callee3, null, [[0, 6]]);
}));

return function (_x4) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "svelte-themes-preprocess",
"version": "1.0.3",
"version": "1.0.4",
"description": "Add support flexible themes for svelte components",
"author": "Nikolay Makhonin",
"homepage": "https://github.com/NikolayMakhonin/svelte-themes-preprocess",
Expand Down
1 change: 0 additions & 1 deletion src/main/node/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export default function themesPreprocess(themesFilePath, preprocess, options = {

themesFilePath = require.resolve(themesFilePath)
.replace(/\\/g, '/')
.replace(/\.[^/.]+$/, '')

options = {
...optionsDefault,
Expand Down
8 changes: 7 additions & 1 deletion src/test/tests/node/main/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,13 @@ module.exports = themeBuilder('${componentId.replace(/'/g, '\'')}')
await Promise.all(cssLangs
.flatMap(lang => componentTypes
.map(async componentType => {
const compiled = await compileWithThemes(componentType, lang)
let compiled
try {
compiled = await compileWithThemes(componentType, lang)
} catch (ex) {
console.error(componentType, lang, ex)
throw ex
}

console.log(componentType, lang)

Expand Down

0 comments on commit 00f15ec

Please sign in to comment.