Skip to content

Commit 27492a7

Browse files
committed
Rename extensions back to plugins
1 parent 1df9443 commit 27492a7

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

lib/less/parser/parser.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,39 +1384,35 @@ var Parser = function Parser(context, imports, fileInfo) {
13841384
},
13851385

13861386
//
1387-
// A @use directive, used to import scoped extensions dynamically.
1387+
// A @plugin directive, used to import scoped extensions dynamically.
13881388
//
1389-
// @use "lib";
1389+
// @plugin "lib";
13901390
//
13911391
// Depending on our environment, importing is done differently:
13921392
// In the browser, it's an XHR request, in Node, it would be a
13931393
// file-system operation. The function used for importing is
13941394
// stored in `import`, which we pass to the Import constructor.
13951395
//
1396-
extension: function () {
1396+
plugin: function () {
13971397
var path,
13981398
index = parserInput.i,
1399-
dir = parserInput.$re(/^@use?|@plugin?\s+/);
1399+
dir = parserInput.$re(/^@plugin?\s+/);
14001400

1401-
if (dir && dir.indexOf("@p") > -1) {
1402-
parserInput.i -= dir.length;
1403-
return error('@plugin is deprecated. Use @use');
1404-
}
14051401
if (dir) {
1406-
var options = { isExtension : true };
1402+
var options = { isPlugin : true };
14071403

14081404
if ((path = this.entities.quoted() || this.entities.url())) {
14091405

14101406
if (!parserInput.$char(';')) {
14111407
parserInput.i = index;
1412-
error("missing semi-colon on @use");
1408+
error("missing semi-colon on @plugin");
14131409
}
14141410

14151411
return new(tree.Import)(path, null, options, index, fileInfo);
14161412
}
14171413
else {
14181414
parserInput.i = index;
1419-
error("malformed @use statement");
1415+
error("malformed @plugin statement");
14201416
}
14211417
}
14221418
},
@@ -1432,7 +1428,7 @@ var Parser = function Parser(context, imports, fileInfo) {
14321428

14331429
if (parserInput.currentChar() !== '@') { return; }
14341430

1435-
value = this['import']() || this.extension() || this.media();
1431+
value = this['import']() || this.plugin() || this.media();
14361432
if (value) {
14371433
return value;
14381434
}

lib/less/tree/import.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Import.prototype.accept = function (visitor) {
5252
this.features = visitor.visit(this.features);
5353
}
5454
this.path = visitor.visit(this.path);
55-
if (!this.options.isExtension && !this.options.inline && this.root) {
55+
if (!this.options.isPlugin && !this.options.inline && this.root) {
5656
this.root = visitor.visit(this.root);
5757
}
5858
};
@@ -126,7 +126,7 @@ Import.prototype.doEval = function (context) {
126126
var ruleset, registry,
127127
features = this.features && this.features.eval(context);
128128

129-
if (this.options.isExtension) {
129+
if (this.options.isPlugin) {
130130
registry = context.frames[0] && context.frames[0].functionRegistry;
131131
if ( registry && this.root && this.root.functions ) {
132132
registry.addMultiple( this.root.functions );

lib/less/visitors/import-visitor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ ImportVisitor.prototype = {
103103

104104
var importVisitor = this,
105105
inlineCSS = importNode.options.inline,
106-
isExtension = importNode.options.isExtension,
106+
isPlugin = importNode.options.isPlugin,
107107
isOptional = importNode.options.optional,
108108
duplicateImport = importedAtRoot || fullPath in importVisitor.recursionDetector;
109109

@@ -129,7 +129,7 @@ ImportVisitor.prototype = {
129129
importNode.root = root;
130130
importNode.importedFilename = fullPath;
131131

132-
if (!inlineCSS && !isExtension && (context.importMultiple || !duplicateImport)) {
132+
if (!inlineCSS && !isPlugin && (context.importMultiple || !duplicateImport)) {
133133
importVisitor.recursionDetector[fullPath] = true;
134134

135135
var oldContext = this.context;

0 commit comments

Comments
 (0)