Skip to content

Commit 2925b6e

Browse files
committed
Tag v 2.2.1 bundles path module in jspm-less-plugin
1 parent 8607292 commit 2925b6e

File tree

14 files changed

+718
-180
lines changed

14 files changed

+718
-180
lines changed

.jsbeautifyrc

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
// Details: https://github.com/victorporof/Sublime-HTMLPrettify#using-your-own-jsbeautifyrc-options
88
// Documentation: https://github.com/einars/js-beautify/
99

10-
"html": {
10+
"html":
11+
{
1112
"allowed_file_extensions": ["htm", "html", "xhtml", "shtml", "xml", "svg", "hbs"],
13+
"indent_handlebars": false,
1214
"brace_style": "collapse", // [collapse|expand|end-expand|none] Put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line, or attempt to keep them where they are
1315
"end_with_newline": false, // End output with newline
1416
"indent_char": " ", // Indentation character
@@ -24,7 +26,8 @@
2426
], // List of tags that should not be reformatted
2527
"wrap_line_length": 0 // Lines should wrap at next opportunity after this number of characters (0 disables)
2628
},
27-
"css": {
29+
"css":
30+
{
2831
"allowed_file_extensions": ["css", "scss", "sass", "less"],
2932
"end_with_newline": false, // End output with newline
3033
"indent_char": " ", // Indentation character
@@ -34,7 +37,8 @@
3437
"selector_separator_newline": true, // Separate selectors with newline or not (e.g. "a,\nbr" or "a, br"),
3538
"indent_with_tabs": true
3639
},
37-
"js": {
40+
"js":
41+
{
3842
"indent_size": 4,
3943
"indent_char": " ",
4044
"indent_level": 0,
@@ -50,7 +54,8 @@
5054
"break_chained_methods": false,
5155
"eval_code": false,
5256
"unescape_strings": false,
53-
"wrap_line_length": 180
57+
"wrap_line_length": 180,
58+
"end_with_newline": true
5459
}
5560

56-
}
61+
}

Makefile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ build_browser:
2020
jspm build lessjs/dist/less.js src/bundled_less/less.browser.js --minify
2121

2222
build_jspm_less_plugin:
23-
$$(npm bin)/babel jspm-less-plugin -d src/jspm-less-plugin
23+
$$(npm bin)/babel jspm-less-plugin/es6 -d jspm-less-plugin
24+
jspm build jspm-less-plugin/index.js src/jspm-less-plugin.js
2425

2526

2627
build: build_node build_browser build_jspm_less_plugin
@@ -29,9 +30,15 @@ test:
2930
./node_modules/.bin/mocha
3031

3132
update_version:
33+
ifeq ($(v),)
34+
$(error v is undefined)
35+
endif
36+
ifeq (${VERSION},$(v))
37+
$(error v is already the current version)
38+
endif
3239
@echo "Current version is " ${VERSION}
3340
@echo "Next version is " $(v)
34-
sed -i s/'"$(VERSION)"'/'"$(v)"'/ package.json
41+
sed -i s/"$(VERSION)"/"$(v)"/g package.json
3542

3643
tag_and_push:
3744
git add --all
@@ -41,5 +48,7 @@ tag_and_push:
4148
git push --tags
4249
npm publish
4350

44-
tag: update_version tag_and_push
51+
tag: build test release
52+
53+
release: update_version tag_and_push
4554

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
var path = require("path");
2+
//it requires SystemJS as loader
3+
4+
5+
function resolveURL(filename) {
6+
return filename.replace(/^file:\/\//, "").replace(/^\/([a-zA-Z]:)\//, "$1/").replace(/^([a-zA-Z])\//, "$1:/").replace(/\//g, path.sep);
7+
}
8+
9+
exports.factory = function(less) {
10+
return class extends less.FileManager {
11+
constructor(options) {
12+
super();
13+
this.options = options;
14+
this.loader = System;
15+
this.loader.config({
16+
defaultJSExtensions: false
17+
});
18+
}
19+
supports(filename) {
20+
return filename.startsWith(this.options.prefix);
21+
}
22+
supportsSync(filename) {
23+
return this.supports(filename);
24+
}
25+
resolve(filename, currentDirectory) {
26+
return this.loader.normalize(filename.slice(this.options.prefix.length)).then((filename) => (
27+
path.relative(currentDirectory, resolveURL(filename.replace(/\.js$/, "")))
28+
));
29+
}
30+
resolveSync(filename, currentDirectory) {
31+
filename = this.loader.normalizeSync(filename.slice(this.options.prefix.length));
32+
return path.relative(currentDirectory, resolveURL(filename.replace(/\.js$/, "")));
33+
}
34+
loadFile(filename, currentDirectory, ...args) {
35+
return this.resolve(filename, currentDirectory).then((filename) => (
36+
super.loadFile(filename, currentDirectory, ...args)
37+
));
38+
}
39+
loadFileSync(filename, currentDirectory, ...args) {
40+
filename = this.resolveSync(filename, currentDirectory);
41+
return super.loadFileSync(filename, currentDirectory, ...args);
42+
}
43+
};
44+
};

jspm-less-plugin/es6/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var fileManager = require("./file-manager.js");
2+
3+
module.exports = class Plugin {
4+
constructor(options) {
5+
this.options = options || {};
6+
this.options.prefix = this.options.prefix || "jspm://";
7+
}
8+
install(less, pluginManager) {
9+
var FileManager = fileManager.factory(less);
10+
pluginManager.addFileManager(new FileManager(this.options));
11+
}
12+
};

jspm-less-plugin/file-manager.js

Lines changed: 82 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
"use strict";
2+
3+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
4+
5+
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
6+
7+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8+
9+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
10+
11+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
12+
113
var path = require("path");
214
//it requires SystemJS as loader
315

@@ -6,39 +18,76 @@ function resolveURL(filename) {
618
return filename.replace(/^file:\/\//, "").replace(/^\/([a-zA-Z]:)\//, "$1/").replace(/^([a-zA-Z])\//, "$1:/").replace(/\//g, path.sep);
719
}
820

9-
exports.factory = function(less) {
10-
return class extends less.FileManager {
11-
constructor(options) {
12-
super();
13-
this.options = options;
14-
this.loader = System;
15-
this.loader.config({
21+
exports.factory = function (less) {
22+
return function (_less$FileManager) {
23+
_inherits(_class, _less$FileManager);
24+
25+
function _class(options) {
26+
_classCallCheck(this, _class);
27+
28+
var _this = _possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).call(this));
29+
30+
_this.options = options;
31+
_this.loader = System;
32+
_this.loader.config({
1633
defaultJSExtensions: false
1734
});
35+
return _this;
1836
}
19-
supports(filename) {
20-
return filename.startsWith(this.options.prefix);
21-
}
22-
supportsSync(filename) {
23-
return this.supports(filename);
24-
}
25-
resolve(filename, currentDirectory) {
26-
return this.loader.normalize(filename.slice(this.options.prefix.length)).then((filename) => (
27-
path.relative(currentDirectory, resolveURL(filename.replace(/\.js$/, "")))
28-
));
29-
}
30-
resolveSync(filename, currentDirectory) {
31-
filename = this.loader.normalizeSync(filename.slice(this.options.prefix.length));
32-
return path.relative(currentDirectory, resolveURL(filename.replace(/\.js$/, "")));
33-
}
34-
loadFile(filename, currentDirectory, ...args) {
35-
return this.resolve(filename, currentDirectory).then((filename) => (
36-
super.loadFile(filename, currentDirectory, ...args)
37-
));
38-
}
39-
loadFileSync(filename, currentDirectory, ...args) {
40-
filename = this.resolveSync(filename, currentDirectory);
41-
return super.loadFileSync(filename, currentDirectory, ...args);
42-
}
43-
};
44-
};
37+
38+
_createClass(_class, [{
39+
key: "supports",
40+
value: function supports(filename) {
41+
return filename.startsWith(this.options.prefix);
42+
}
43+
}, {
44+
key: "supportsSync",
45+
value: function supportsSync(filename) {
46+
return this.supports(filename);
47+
}
48+
}, {
49+
key: "resolve",
50+
value: function resolve(filename, currentDirectory) {
51+
return this.loader.normalize(filename.slice(this.options.prefix.length)).then(function (filename) {
52+
return path.relative(currentDirectory, resolveURL(filename.replace(/\.js$/, "")));
53+
});
54+
}
55+
}, {
56+
key: "resolveSync",
57+
value: function resolveSync(filename, currentDirectory) {
58+
filename = this.loader.normalizeSync(filename.slice(this.options.prefix.length));
59+
return path.relative(currentDirectory, resolveURL(filename.replace(/\.js$/, "")));
60+
}
61+
}, {
62+
key: "loadFile",
63+
value: function loadFile(filename, currentDirectory) {
64+
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
65+
args[_key - 2] = arguments[_key];
66+
}
67+
68+
var _this2 = this;
69+
70+
return this.resolve(filename, currentDirectory).then(function (filename) {
71+
var _get2;
72+
73+
return (_get2 = _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), "loadFile", _this2)).call.apply(_get2, [_this2, filename, currentDirectory].concat(args));
74+
});
75+
}
76+
}, {
77+
key: "loadFileSync",
78+
value: function loadFileSync(filename, currentDirectory) {
79+
var _get3;
80+
81+
filename = this.resolveSync(filename, currentDirectory);
82+
83+
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
84+
args[_key2 - 2] = arguments[_key2];
85+
}
86+
87+
return (_get3 = _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), "loadFileSync", this)).call.apply(_get3, [this, filename, currentDirectory].concat(args));
88+
}
89+
}]);
90+
91+
return _class;
92+
}(less.FileManager);
93+
};

jspm-less-plugin/index.js

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
1-
var fileManager = require("./file-manager");
2-
3-
module.exports = class Plugin {
4-
constructor(options) {
5-
this.options = options || {};
6-
this.options.prefix = this.options.prefix || "jspm://";
7-
}
8-
install(less, pluginManager) {
9-
var FileManager = fileManager.factory(less);
10-
pluginManager.addFileManager(new FileManager(this.options));
11-
}
12-
};
1+
"use strict";
2+
3+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
4+
5+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6+
7+
var fileManager = require("./file-manager.js");
8+
9+
module.exports = function () {
10+
function Plugin(options) {
11+
_classCallCheck(this, Plugin);
12+
13+
this.options = options || {};
14+
this.options.prefix = this.options.prefix || "jspm://";
15+
}
16+
17+
_createClass(Plugin, [{
18+
key: "install",
19+
value: function install(less, pluginManager) {
20+
var FileManager = fileManager.factory(less);
21+
pluginManager.addFileManager(new FileManager(this.options));
22+
}
23+
}]);
24+
25+
return Plugin;
26+
}();

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "systemjs-less-plugin",
3-
"version": "2.2.0",
3+
"version": "2.2.1",
44
"description": "Loads less files on the fly, and compiles them at build time",
55
"main": "less.js",
66
"registry": "github",
@@ -39,9 +39,7 @@
3939
"directories": {
4040
"lib": "src"
4141
},
42-
"dependencies": {
43-
"css": "systemjs/plugin-css@^0.1.35"
44-
},
42+
"dependencies": {},
4543
"devDependencies": {
4644
"assert": "npm:jspm-nodelibs-assert@^0.2.0",
4745
"bcrypt-pbkdf": "npm:bcrypt-pbkdf@^1.0.0",
@@ -83,6 +81,9 @@
8381
"vm": "npm:jspm-nodelibs-vm@^0.2.0",
8482
"zlib": "npm:jspm-nodelibs-zlib@^0.2.0"
8583
},
84+
"peerDependencies": {
85+
"css": "systemjs/plugin-css@^0.1.35"
86+
},
8687
"overrides": {
8788
8889
"dependencies": {

src/bundled_less/less.browser.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bundled_less/less.node.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)