Last change
on this file since 84d0fbb was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 |
|
---|
2 | /*!
|
---|
3 | * Stylus - Import
|
---|
4 | * Copyright (c) Automattic <developer.wordpress.com>
|
---|
5 | * MIT Licensed
|
---|
6 | */
|
---|
7 |
|
---|
8 | /**
|
---|
9 | * Module dependencies.
|
---|
10 | */
|
---|
11 |
|
---|
12 | var Node = require('./node');
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * Initialize a new `Import` with the given `expr`.
|
---|
16 | *
|
---|
17 | * @param {Expression} expr
|
---|
18 | * @api public
|
---|
19 | */
|
---|
20 |
|
---|
21 | var Import = module.exports = function Import(expr, once){
|
---|
22 | Node.call(this);
|
---|
23 | this.path = expr;
|
---|
24 | this.once = once || false;
|
---|
25 | };
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * Inherit from `Node.prototype`.
|
---|
29 | */
|
---|
30 |
|
---|
31 | Import.prototype.__proto__ = Node.prototype;
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * Return a clone of this node.
|
---|
35 | *
|
---|
36 | * @return {Node}
|
---|
37 | * @api public
|
---|
38 | */
|
---|
39 |
|
---|
40 | Import.prototype.clone = function(parent){
|
---|
41 | var clone = new Import();
|
---|
42 | clone.path = this.path.nodeName ? this.path.clone(parent, clone) : this.path;
|
---|
43 | clone.once = this.once;
|
---|
44 | clone.mtime = this.mtime;
|
---|
45 | clone.lineno = this.lineno;
|
---|
46 | clone.column = this.column;
|
---|
47 | clone.filename = this.filename;
|
---|
48 | return clone;
|
---|
49 | };
|
---|
50 |
|
---|
51 | /**
|
---|
52 | * Return a JSON representation of this node.
|
---|
53 | *
|
---|
54 | * @return {Object}
|
---|
55 | * @api public
|
---|
56 | */
|
---|
57 |
|
---|
58 | Import.prototype.toJSON = function(){
|
---|
59 | return {
|
---|
60 | __type: 'Import',
|
---|
61 | path: this.path,
|
---|
62 | once: this.once,
|
---|
63 | mtime: this.mtime,
|
---|
64 | lineno: this.lineno,
|
---|
65 | column: this.column,
|
---|
66 | filename: this.filename
|
---|
67 | };
|
---|
68 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.