mint 0.3.4 → 4.1.0

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.
Files changed (36) hide show
  1. package/CONTRIBUTING.md +3 -0
  2. package/README.md +68 -94
  3. package/index.js +3 -0
  4. package/package.json +24 -43
  5. package/.npmignore +0 -11
  6. package/.travis.yml +0 -4
  7. package/MIT-LICENSE +0 -20
  8. package/mint.js +0 -360
  9. package/test/fixtures/docs/markdown.markdown +0 -6
  10. package/test/fixtures/images/facebook.png +0 -0
  11. package/test/fixtures/images/github.png +0 -0
  12. package/test/fixtures/images/linkedIn.png +0 -0
  13. package/test/fixtures/images/twitter.png +0 -0
  14. package/test/fixtures/javascripts/application.js +0 -3
  15. package/test/fixtures/javascripts/coffee.js +0 -4
  16. package/test/fixtures/javascripts/some.extensions.js.coffee.ejs +0 -2
  17. package/test/fixtures/stylesheets/application.css +0 -3
  18. package/test/fixtures/stylesheets/less.css +0 -13
  19. package/test/fixtures/stylesheets/less.less +0 -11
  20. package/test/fixtures/stylesheets/sass.css +0 -2
  21. package/test/fixtures/stylesheets/sass.sass +0 -4
  22. package/test/fixtures/stylesheets/scss.css +0 -12
  23. package/test/fixtures/stylesheets/scss.scss +0 -14
  24. package/test/fixtures/stylesheets/stylus-error.styl +0 -2
  25. package/test/fixtures/stylesheets/stylus.css +0 -13
  26. package/test/fixtures/stylesheets/stylus.styl +0 -14
  27. package/test/fixtures/views/ejs.ejs +0 -1
  28. package/test/fixtures/views/haml-coffee.hamlc +0 -6
  29. package/test/fixtures/views/haml.haml +0 -1
  30. package/test/fixtures/views/handlebars.hbs +0 -1
  31. package/test/fixtures/views/jade.jade +0 -6
  32. package/test/fixtures/views/mustache.mustache +0 -1
  33. package/test/mocha.opts +0 -4
  34. package/vendor/cssmin.js +0 -1
  35. package/vendor/yuicompressor/cssmin.js +0 -353
  36. package/vendor/yuicompressor/cssmin.node.js +0 -11
@@ -0,0 +1,3 @@
1
+ # Mint CLI
2
+
3
+ `mint` is an alias for [@mintlify/cli](https://www.npmjs.com/package/@mintlify/cli).
package/README.md CHANGED
@@ -1,119 +1,93 @@
1
- # Mint.js
1
+ <div align="center">
2
+ <a href="https://mintlify.com">
3
+ <img
4
+ src="https://res.cloudinary.com/mintlify/image/upload/v1665385627/logo-rounded_zuk7q1.svg"
5
+ alt="Mintlify Logo"
6
+ height="64"
7
+ />
8
+ </a>
9
+ <br />
10
+ <p>
11
+ <h3>
12
+ <b>
13
+ Mint CLI
14
+ </b>
15
+ </h3>
16
+ </p>
17
+ <p>
18
+ The Mint CLI is the easiest way to build Mintlify apps from the command line.
19
+ </p>
20
+ <p>
21
+
22
+ [![Website](https://img.shields.io/website?url=https%3A%2F%2Fmintlify.com&logo=mintlify)](https://mintlify.com) [![Tweet](https://img.shields.io/twitter/url?url=https%3A%2F%2Fmintlify.com%2F)](https://twitter.com/intent/tweet?url=&text=Check%20out%20%40mintlify)
23
+ [![Discuss on Slack](https://img.shields.io/badge/chat-on%20Slack-blueviolet)](https://mintlify.com/community)
24
+
25
+ </p>
26
+ <p>
27
+ <sub>
28
+ Built with ❤︎ by
29
+ <a href="https://mintlify.com">
30
+ Mintlify
31
+ </a>
32
+ </sub>
33
+ </p>
34
+ </div>
35
+
36
+ ### Installation
37
+
38
+ Download the Mint CLI using the following command
2
39
 
3
- > Standard Interface to the Node.js Template Engines (JavaScript, CSS, text, etc.).
4
-
5
- [![Build Status](https://secure.travis-ci.org/viatropos/mint.png)](http://travis-ci.org/viatropos/mint)
6
-
7
- ## Install
8
-
9
- ``` bash
10
- npm install mint
11
40
  ```
12
-
13
- ## Engines
14
-
15
- ``` coffeescript
16
- mint = require("mint")
17
- mint.coffee
18
- mint.coffeekup
19
- mint.eco
20
- mint.ejs
21
- mint.haml
22
- mint.hamlcoffee
23
- mint.handlebars
24
- mint.jade
25
- mint.less
26
- mint.stylus
27
- mint.markdown
28
- mint.mustache
29
- mint.uglifyjs
30
- mint.yui
41
+ npm i -g mint
31
42
  ```
32
43
 
33
- ## Example
44
+ ### Development
34
45
 
35
- ``` coffeescript
36
- mint = require('mint')
37
- mint.mustache "{title}!", locals: title: "Hello World", (string) -> console.log(string) #=> "Hello World!"
38
- ```
46
+ #### `mint dev`
39
47
 
40
- or more formally:
48
+ Run this command at the root of your Mintlify project to preview changes locally.
41
49
 
42
- ``` coffeescript
43
- input = fs.readFileSync("./test/fixtures/views/jade.jade", "utf-8")
44
- output = fs.readFileSync("./test/fixtures/views/jade.html", "utf-8")
45
- mint.jade input, {}, (error, result) ->
46
- assert.equal result, output
47
- ```
48
-
49
- ## API
50
-
51
- ``` coffeescript
52
- mint[engine](string, options, callback)
53
- ```
50
+ Notes
54
51
 
55
- ## Preprocessing
52
+ - `mint dev` requires Node v18 or higher.
56
53
 
57
- Sometimes you might need to hack in a feature to the language. Like right now, stylus doesn't support multiline values for css attributes, so you might add it like this:
54
+ #### Custom Ports
58
55
 
59
- ``` coffeescript
60
- input = '''
61
- div
62
- box-shadow: 0 -2px 2px hsl(220, 20%, 40%),
63
- 0 -10px 10px hsl(220, 20%, 20%),
64
- 0 0 15px black,
56
+ Mintlify uses port 3000 by default. You can use the `--port` flag to customize the port Mintlify runs on. For example, use this command to run in port 3333:
65
57
 
66
- inset 0 5px 1px hsla(220, 80%, 10%, 0.4),
67
- inset 0 0 5px hsla(220, 80%, 10%, 0.1),
68
- inset 0 20px 15px hsla(220, 80%, 100%, 1),
69
-
70
- inset 0 1px 0 hsl(219, 20%, 0%),
71
-
72
- inset 0 -50px 50px -40px hsla(220, 80%, 10%, .3), /* gradient to inset */
58
+ ```
59
+ mint dev --port 3333
60
+ ```
73
61
 
74
- inset 0 -1px 0px hsl(220, 20%, 20%),
75
- inset 0 -2px 0px hsl(220, 20%, 40%),
76
- inset 0 -2px 1px hsl(220, 20%, 65%)
77
- '''
62
+ You will see an error like this if you try to run Mintlify in a port that's already taken:
78
63
 
79
- output = '''
80
- div {
81
- box-shadow: 0 -2px 2px #525f7a, 0 -10px 10px #29303d, 0 0 15px #000, inset 0 5px 1px rgba(5,19,46,0.40), inset 0 0 5px rgba(5,19,46,0.10), inset 0 20px 15px #fff, inset 0 1px 0 #000, inset 0 -50px 50px -40px rgba(5,19,46,0.30), inset 0 -1px 0px #29303d, inset 0 -2px 0px #525f7a, inset 0 -2px 1px #94a0b8;
82
- }
64
+ ```
65
+ Error: listen EADDRINUSE: address already in use :::3000
66
+ ```
83
67
 
84
- '''
85
- # locally
86
- options =
87
- preprocessor: (content) ->
88
- content.replace /(\s+)(.*),\s+(?:\/\*.*\*\/)?\s*/mg, (_, indent, attribute) ->
89
- "#{indent}#{attribute.replace(/\s+/g, " ")}, "
68
+ #### Troubleshooting
90
69
 
91
- mint.stylus input, options, (error, result) ->
92
- expect(result).toEqual output
70
+ Steps you can take if the dev CLI is not working (After each step try to run `mint dev` again):
93
71
 
94
- # globally
95
- mint.stylus.preprocessor = (content) ->
96
- content.replace /(\s+)(.*),\s+(?:\/\*.*\*\/)?\s*/mg, (_, indent, attribute) ->
97
- "#{indent}#{attribute.replace(/\s+/g, " ")}, "
72
+ - Make sure you are running in a folder with a `docs.json` file.
73
+ - Run `npm update -g mint` to ensure you have the most recent version of the CLI.
74
+ - Make sure you are using Node v18 or higher.
75
+ - Navigate to the `.mintlify` folder in your home directory and delete its contents.
98
76
 
99
- mint.stylus input, {}, (error, result) ->
100
- expect(result).toEqual output
101
- ```
77
+ ### Additional Commands
102
78
 
103
- ## Test
79
+ #### `mint broken-links`
104
80
 
105
- ``` bash
106
- mocha
107
- ```
81
+ Check for broken internal links in your Mintlify project.
108
82
 
109
- ## License
83
+ #### `mint rename <from> <to>`
110
84
 
111
- (The MIT License)
85
+ Rename a file in a Mintlify project and update all internal link references.
112
86
 
113
- Copyright &copy; 2011 [Lance Pollard](http://twitter.com/viatropos) &lt;lancejpollard@gmail.com&gt;
87
+ #### `mint openapi-check <openapiFilenameOrUrl>`
114
88
 
115
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
89
+ Check your OpenAPI file for errors. You can pass in a filename (e.g. `./openapi.yaml`) or a URL (e.g. `https://petstore3.swagger.io/api/v3/openapi.json`).
116
90
 
117
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
91
+ ### Get Started
118
92
 
119
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
93
+ [Create an account](https://mintlify.com/start) to start using Mintlify for your documentation.
package/index.js ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { cli as _ } from "@mintlify/cli";
package/package.json CHANGED
@@ -1,55 +1,36 @@
1
1
  {
2
2
  "name": "mint",
3
- "version": "0.3.4",
4
- "description": "Template abstraction framework",
5
- "homepage": "http://github.com/viatropos/mint.js",
6
- "main": "mint.js",
7
- "author": "Lance Pollard <lancejpollard@gmail.com>",
3
+ "version": "4.1.0",
4
+ "description": "The Mintlify CLI",
5
+ "engines": {
6
+ "node": ">=18.0.0"
7
+ },
8
+ "author": "Mintlify, Inc.",
9
+ "bugs": {
10
+ "url": "https://github.com/orgs/mintlify/discussions"
11
+ },
12
+ "license": "Elastic-2.0",
8
13
  "keywords": [
9
- "framework",
10
- "compression",
11
- "node"
12
- ],
13
- "licenses": [
14
- {
15
- "type": "MIT",
16
- "url": "http://mths.be/mit"
17
- }
14
+ "mintlify",
15
+ "mint",
16
+ "cli"
18
17
  ],
19
- "bugs": {
20
- "url": "https://github.com/viatropos/mint.js/issues"
18
+ "type": "module",
19
+ "publishConfig": {
20
+ "access": "public",
21
+ "registry": "https://registry.npmjs.org"
21
22
  },
22
- "repository": {
23
- "type": "git",
24
- "url": "https://github.com/viatropos/mint.js.git"
23
+ "bin": {
24
+ "mint": "index.js",
25
+ "mintlify": "index.js"
25
26
  },
26
- "engines": {
27
- "node": ">= 0.4.0"
27
+ "scripts": {
28
+ "clean:all": "rimraf node_modules"
28
29
  },
29
30
  "dependencies": {
30
-
31
+ "@mintlify/cli": "4.0.516"
31
32
  },
32
33
  "devDependencies": {
33
- "coffee-script": ">= 1.3.1",
34
- "uglify-js": ">= 1.1.1",
35
- "clean-css": ">= 0.3.2",
36
- "mocha": ">= 0.8.1",
37
- "should": ">= 0.3.x",
38
- "chai": ">= 0.3.3",
39
- "sinon": ">= 1.3.1",
40
- "stylus": ">= 0.17.0",
41
- "less": ">= 1.2.x",
42
- "ejs": ">= 0.6.1",
43
- "coffeekup": ">= 0.3.1",
44
- "jade": ">= 0.20.x",
45
- "haml": ">= 0.4.x",
46
- "hamljs": ">= 0.6.x",
47
- "haml-coffee": ">= 0.5.0",
48
- "mustache": ">= 0.4.x",
49
- "handlebars": "*",
50
- "eco": "*"
51
- },
52
- "scripts": {
53
- "test": "node_modules/mocha/bin/mocha $(find test -name \"*Test.coffee\")"
34
+ "rimraf": "^5.0.1"
54
35
  }
55
36
  }
package/.npmignore DELETED
@@ -1,11 +0,0 @@
1
- *.coffee
2
- *.html
3
- .DS_Store
4
- .git*
5
- Cakefile
6
- wiki/
7
- examples/
8
- src/
9
- spec/
10
- favicon.ico
11
- Watchfile
package/.travis.yml DELETED
@@ -1,4 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - 0.4
4
- - 0.6
package/MIT-LICENSE DELETED
@@ -1,20 +0,0 @@
1
- Copyright (c) 2011-2012 Lance Pollard <lancejpollard@gmail.com>
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/mint.js DELETED
@@ -1,360 +0,0 @@
1
- // Generated by CoffeeScript 1.3.1
2
- (function() {
3
-
4
- module.exports = {
5
- engines: {},
6
- engine: function(extension) {
7
- var _base;
8
- extension = extension.replace(/^\./, '');
9
- return (_base = this.engines)[extension] || (_base[extension] = (function() {
10
- switch (extension) {
11
- case "styl":
12
- case "stylus":
13
- return "stylus";
14
- case "jade":
15
- return "jade";
16
- case "eco":
17
- return "eco";
18
- case "haml":
19
- return "haml";
20
- case "hamlc":
21
- return "hamlcoffee";
22
- case "ejs":
23
- return "ejs";
24
- case "coffee":
25
- case "coffeescript":
26
- case "coffee-script":
27
- return "coffee";
28
- case "less":
29
- return "less";
30
- case "mu":
31
- case "mustache":
32
- return "mustache";
33
- case "hbs":
34
- case "handlebars":
35
- return "handlebars";
36
- case "md":
37
- case "mkd":
38
- case "markdown":
39
- case "mdown":
40
- return "markdown";
41
- }
42
- })());
43
- },
44
- enginesFor: function(path) {
45
- var engine, engines, extension, extensions, _i, _len;
46
- engines = [];
47
- extensions = path.split("/");
48
- extensions = extensions[extensions.length - 1];
49
- extensions = extensions.split(".").slice(1);
50
- for (_i = 0, _len = extensions.length; _i < _len; _i++) {
51
- extension = extensions[_i];
52
- engine = this.engine(extension);
53
- if (engine) {
54
- engines.push(engine);
55
- }
56
- }
57
- return engines;
58
- },
59
- render: function(options, callback) {
60
- var engines, iterate, path, string,
61
- _this = this;
62
- path = options.path;
63
- string = options.string || require('fs').readFileSync(path, 'utf-8');
64
- engines = options.engines || this.enginesFor(path);
65
- iterate = function(engine, next) {
66
- return _this[engine](string, options, function(error, output) {
67
- if (error) {
68
- return next(error);
69
- } else {
70
- string = output;
71
- return next();
72
- }
73
- });
74
- };
75
- return this._async(engines, iterate, function(error) {
76
- return callback.call(_this, error, string);
77
- });
78
- },
79
- stylus: function(content, options, callback) {
80
- var engine, path, preprocessor, result,
81
- _this = this;
82
- result = "";
83
- path = options.path;
84
- preprocessor = options.preprocessor || this.stylus.preprocessor;
85
- if (preprocessor) {
86
- content = preprocessor.call(this, content, options);
87
- }
88
- engine = require('stylus');
89
- engine.render(content, options, function(error, data) {
90
- result = data;
91
- if (error && path) {
92
- error.message = error.message.replace(/\n$/, ", " + path + "\n");
93
- }
94
- if (callback) {
95
- return callback.call(_this, error, result);
96
- }
97
- });
98
- return result;
99
- },
100
- jade: function(content, options, callback) {
101
- var path, preprocessor, result,
102
- _this = this;
103
- result = "";
104
- path = options.path;
105
- preprocessor = options.preprocessor || this.jade.preprocessor;
106
- if (preprocessor) {
107
- content = preprocessor.call(this, content, options);
108
- }
109
- require("jade").render(content, options, function(error, data) {
110
- result = data;
111
- if (error && path) {
112
- error.message += ", " + path;
113
- }
114
- if (callback) {
115
- return callback.call(_this, error, result);
116
- }
117
- });
118
- return result;
119
- },
120
- haml: function(content, options, callback) {
121
- var result;
122
- result = require('hamljs').render(content, options || {});
123
- if (callback) {
124
- callback.call(this, null, result);
125
- }
126
- return result;
127
- },
128
- hamlcoffee: function(content, options, callback) {
129
- var result;
130
- result = require('haml-coffee').compile(content, options || {})(options.locals);
131
- if (callback) {
132
- callback.call(this, null, result);
133
- }
134
- return result;
135
- },
136
- ejs: function(content, options, callback) {
137
- var error, result;
138
- result = "";
139
- error = null;
140
- try {
141
- result = require("ejs").render(content, options);
142
- } catch (e) {
143
- error = e;
144
- result = null;
145
- }
146
- if (callback) {
147
- callback.call(this, error, result);
148
- }
149
- return result;
150
- },
151
- eco: function(content, options, callback) {
152
- var result;
153
- result = require("eco").render(content, options.locals);
154
- if (callback) {
155
- callback.call(this, null, result);
156
- }
157
- return result;
158
- },
159
- coffee: function(content, options, callback) {
160
- var error, path, preprocessor, result;
161
- result = "";
162
- path = options.path;
163
- if (!options.hasOwnProperty("bare")) {
164
- options.bare = true;
165
- }
166
- preprocessor = options.preprocessor || this.coffee.preprocessor;
167
- if (preprocessor) {
168
- content = preprocessor.call(this, content, options);
169
- }
170
- try {
171
- result = require("coffee-script").compile(content, options);
172
- } catch (e) {
173
- result = null;
174
- error = e;
175
- if (path) {
176
- error.message += ", " + path;
177
- }
178
- }
179
- if (callback) {
180
- callback.call(this, error, result);
181
- }
182
- return result;
183
- },
184
- coffeekup: function(content, options, callback) {
185
- var result;
186
- result = require("coffeekup").render(content, options);
187
- if (callback) {
188
- callback.call(this, null, result);
189
- }
190
- return result;
191
- },
192
- less: function(content, options, callback) {
193
- var engine, parser, path, result,
194
- _this = this;
195
- result = "";
196
- path = options.path;
197
- options.filename = path;
198
- options.paths || (options.paths = []);
199
- options.paths = ["."].concat(options.paths);
200
- engine = require("less");
201
- parser = new engine.Parser(options);
202
- try {
203
- parser.parse(content, function(error, tree) {
204
- var message;
205
- if (error) {
206
- if (path) {
207
- error.message += ", " + path;
208
- }
209
- } else {
210
- try {
211
- result = tree.toCSS();
212
- } catch (e) {
213
- error = e;
214
- }
215
- }
216
- if (error) {
217
- message = error.message + ", " + path;
218
- }
219
- if (callback) {
220
- return callback.call(_this, message, result);
221
- }
222
- });
223
- } catch (error) {
224
- callback.call(this, error.message += ", " + path, "");
225
- }
226
- return result;
227
- },
228
- mustache: function(content, options, callback) {
229
- var error, path, preprocessor, result;
230
- path = options.path;
231
- error = null;
232
- preprocessor = options.preprocessor || this.constructor.preprocessor;
233
- if (preprocessor) {
234
- content = preprocessor.call(this, content, options);
235
- }
236
- try {
237
- result = require("mustache").to_html(content, options.locals);
238
- } catch (e) {
239
- error = e;
240
- result = null;
241
- if (path) {
242
- error.message += ", " + path;
243
- }
244
- }
245
- if (callback) {
246
- callback.call(this, error, result);
247
- }
248
- return result;
249
- },
250
- handlebars: function(content, options, callback) {
251
- var error, result;
252
- error = null;
253
- try {
254
- result = require("handlebars").compile(content)(options.locals || {});
255
- } catch (e) {
256
- error = e;
257
- }
258
- if (callback) {
259
- return callback.call(this, error, result);
260
- }
261
- },
262
- markdown: function(content, options, callback) {
263
- var error, preprocessor, result;
264
- error = null;
265
- preprocessor = options.preprocessor || this.constructor.preprocessor;
266
- if (preprocessor) {
267
- content = preprocessor.call(this, content, options);
268
- }
269
- try {
270
- result = require("markdown").parse(content);
271
- } catch (e) {
272
- error = e;
273
- }
274
- if (callback) {
275
- callback.call(this, error, result);
276
- }
277
- return result;
278
- },
279
- yui: function(content, options, callback) {
280
- var error, path, result;
281
- path = options.path;
282
- error = null;
283
- try {
284
- result = require("./vendor/cssmin").cssmin(content);
285
- } catch (e) {
286
- error = e;
287
- if (path) {
288
- error.message += ", " + path;
289
- }
290
- }
291
- if (callback) {
292
- callback.call(this, error, result);
293
- }
294
- return result;
295
- },
296
- cleanCSS: function(content, options, callback) {
297
- var error, path, result;
298
- path = options.path;
299
- error = null;
300
- try {
301
- result = require("clean-css").process(content);
302
- } catch (e) {
303
- error = e;
304
- if (path) {
305
- error.message += ", " + path;
306
- }
307
- }
308
- if (callback) {
309
- callback.call(this, error, result);
310
- }
311
- return result;
312
- },
313
- uglifyjs: function(content, options, callback) {
314
- var ast, compressor, error, parser, path, result;
315
- path = options.path;
316
- error = null;
317
- parser = require("uglify-js").parser;
318
- compressor = require("uglify-js").uglify;
319
- try {
320
- ast = parser.parse(content);
321
- ast = compressor.ast_mangle(ast);
322
- ast = compressor.ast_squeeze(ast);
323
- result = compressor.gen_code(ast);
324
- } catch (e) {
325
- error = e;
326
- if (path) {
327
- error.message += ", " + path;
328
- }
329
- }
330
- if (callback) {
331
- callback.call(this, error, result);
332
- }
333
- return result;
334
- },
335
- _async: function(array, iterator, callback) {
336
- var completed, iterate;
337
- if (!array.length) {
338
- return callback();
339
- }
340
- completed = 0;
341
- iterate = function() {
342
- return iterator(array[completed], function(error) {
343
- if (error) {
344
- callback(error);
345
- return callback = function() {};
346
- } else {
347
- completed += 1;
348
- if (completed === array.length) {
349
- return callback();
350
- } else {
351
- return iterate();
352
- }
353
- }
354
- });
355
- };
356
- return iterate();
357
- }
358
- };
359
-
360
- }).call(this);
@@ -1,6 +0,0 @@
1
- # Markdown
2
-
3
- > I'm a quote
4
-
5
- - item a
6
- - item b
Binary file
Binary file
Binary file
Binary file
@@ -1,3 +0,0 @@
1
- $(document).ready(function() {
2
- alert("ready!");
3
- });
@@ -1,4 +0,0 @@
1
-
2
- $(document).ready(function() {
3
- return alert("ready");
4
- });
@@ -1,2 +0,0 @@
1
- $(document).ready ->
2
- alert "<%= word %>"
@@ -1,3 +0,0 @@
1
- body {
2
- background: red;
3
- }
@@ -1,13 +0,0 @@
1
- #header h1 {
2
- font-size: 26px;
3
- font-weight: bold;
4
- }
5
- #header p {
6
- font-size: 12px;
7
- }
8
- #header p a {
9
- text-decoration: none;
10
- }
11
- #header p a:hover {
12
- border-width: 1px;
13
- }
@@ -1,11 +0,0 @@
1
- #header {
2
- h1 {
3
- font-size: 26px;
4
- font-weight: bold;
5
- }
6
- p { font-size: 12px;
7
- a { text-decoration: none;
8
- &:hover { border-width: 1px }
9
- }
10
- }
11
- }
@@ -1,2 +0,0 @@
1
- body {
2
- color: #ff0000;}
@@ -1,4 +0,0 @@
1
- !red = #ff0000
2
-
3
- body
4
- :color !red
@@ -1,12 +0,0 @@
1
- table.hl {
2
- margin: 2em 0;
3
- }
4
- table.hl td.ln {
5
- text-align: right;
6
- }
7
-
8
- li {
9
- font-family: serif;
10
- font-weight: bold;
11
- font-size: 1.2em;
12
- }
@@ -1,14 +0,0 @@
1
- table.hl {
2
- margin: 2em 0;
3
- td.ln {
4
- text-align: right;
5
- }
6
- }
7
-
8
- li {
9
- font: {
10
- family: serif;
11
- weight: bold;
12
- size: 1.2em;
13
- }
14
- }
@@ -1,2 +0,0 @@
1
- body
2
- background: red@
@@ -1,13 +0,0 @@
1
- body {
2
- background: url("http://foo.com/bar.png");
3
- }
4
- #wrapper {
5
- background: url("/images/gopher.jpg");
6
- }
7
- #footer {
8
- background: url("/images/gradient.svg");
9
- }
10
- .sprite {
11
- background: url("/images/sprite.gif");
12
- background: url("sprite.gif");
13
- }
@@ -1,14 +0,0 @@
1
- body
2
- background url("http://foo.com/bar.png")
3
-
4
- #wrapper
5
- background url(/images/gopher.jpg)
6
-
7
- #footer
8
- background url(/images/gradient.svg)
9
-
10
- .sprite
11
- // both work due to the additional paths option
12
- // passed to stylus.url()
13
- background url(/images/sprite.gif)
14
- background url(sprite.gif)
@@ -1 +0,0 @@
1
- <h2><%= name %></h2>
@@ -1,6 +0,0 @@
1
- - if @projects.length isnt 0
2
- - for project in @projects
3
- %a{ href: project.url }= project.name
4
- %p= project.description
5
- - else
6
- No projects
@@ -1 +0,0 @@
1
- %p Hello World
@@ -1 +0,0 @@
1
- <p>My name is <b>{{name}}</b></p>
@@ -1,6 +0,0 @@
1
- !!! 5
2
- html(lang="en")
3
- head
4
- title Example
5
- body
6
- h1 Jade - node template engine
@@ -1 +0,0 @@
1
- <p>{{say_hello}}, {{name}}</p>
package/test/mocha.opts DELETED
@@ -1,4 +0,0 @@
1
- --require coffee-script
2
- --reporter spec
3
- --ui bdd
4
- --globals Parser,prop
package/vendor/cssmin.js DELETED
@@ -1 +0,0 @@
1
- exports.cssmin = require(__dirname + '/yuicompressor/cssmin.node.js').cssmin;
@@ -1,353 +0,0 @@
1
- /**
2
- * cssmin.js
3
- * Author: Stoyan Stefanov - http://phpied.com/
4
- * This is a JavaScript port of the CSS minification tool
5
- * distributed with YUICompressor, itself a port
6
- * of the cssmin utility by Isaac Schlueter - http://foohack.com/
7
- * Permission is hereby granted to use the JavaScript version under the same
8
- * conditions as the YUICompressor (original YUICompressor note below).
9
- */
10
-
11
- /*
12
- * YUI Compressor
13
- * http://developer.yahoo.com/yui/compressor/
14
- * Author: Julien Lecomte - http://www.julienlecomte.net/
15
- * Copyright (c) 2011 Yahoo! Inc. All rights reserved.
16
- * The copyrights embodied in the content of this file are licensed
17
- * by Yahoo! Inc. under the BSD (revised) open source license.
18
- */
19
- var YAHOO = YAHOO || {};
20
- YAHOO.compressor = YAHOO.compressor || {};
21
-
22
- /**
23
- * Utility method to replace all data urls with tokens before we start
24
- * compressing, to avoid performance issues running some of the subsequent
25
- * regexes against large strings chunks.
26
- *
27
- * @private
28
- * @method _extractDataUrls
29
- * @param {String} css The input css
30
- * @param {Array} The global array of tokens to preserve
31
- * @returns String The processed css
32
- */
33
- YAHOO.compressor._extractDataUrls = function (css, preservedTokens) {
34
-
35
- // Leave data urls alone to increase parse performance.
36
- var maxIndex = css.length - 1,
37
- appendIndex = 0,
38
- startIndex,
39
- endIndex,
40
- terminator,
41
- foundTerminator,
42
- sb = [],
43
- m,
44
- preserver,
45
- token,
46
- pattern = /url\(\s*(["']?)data\:/g;
47
-
48
- // Since we need to account for non-base64 data urls, we need to handle
49
- // ' and ) being part of the data string. Hence switching to indexOf,
50
- // to determine whether or not we have matching string terminators and
51
- // handling sb appends directly, instead of using matcher.append* methods.
52
-
53
- while ((m = pattern.exec(css)) !== null) {
54
-
55
- startIndex = m.index + 4; // "url(".length()
56
- terminator = m[1]; // ', " or empty (not quoted)
57
-
58
- if (terminator.length === 0) {
59
- terminator = ")";
60
- }
61
-
62
- foundTerminator = false;
63
-
64
- endIndex = pattern.lastIndex - 1;
65
-
66
- while(foundTerminator === false && endIndex+1 <= maxIndex) {
67
- endIndex = css.indexOf(terminator, endIndex + 1);
68
-
69
- // endIndex == 0 doesn't really apply here
70
- if ((endIndex > 0) && (css.charAt(endIndex - 1) !== '\\')) {
71
- foundTerminator = true;
72
- if (")" != terminator) {
73
- endIndex = css.indexOf(")", endIndex);
74
- }
75
- }
76
- }
77
-
78
- // Enough searching, start moving stuff over to the buffer
79
- sb.push(css.substring(appendIndex, m.index));
80
-
81
- if (foundTerminator) {
82
- token = css.substring(startIndex, endIndex);
83
- token = token.replace(/\s+/g, "");
84
- preservedTokens.push(token);
85
-
86
- preserver = "url(___YUICSSMIN_PRESERVED_TOKEN_" + (preservedTokens.length - 1) + "___)";
87
- sb.push(preserver);
88
-
89
- appendIndex = endIndex + 1;
90
- } else {
91
- // No end terminator found, re-add the whole match. Should we throw/warn here?
92
- sb.push(css.substring(m.index, pattern.lastIndex));
93
- appendIndex = pattern.lastIndex;
94
- }
95
- }
96
-
97
- sb.push(css.substring(appendIndex));
98
-
99
- return sb.join("");
100
- };
101
-
102
- /**
103
- * Utility method to compress hex color values of the form #AABBCC to #ABC.
104
- *
105
- * DOES NOT compress CSS ID selectors which match the above pattern (which would break things).
106
- * e.g. #AddressForm { ... }
107
- *
108
- * DOES NOT compress IE filters, which have hex color values (which would break things).
109
- * e.g. filter: chroma(color="#FFFFFF");
110
- *
111
- * DOES NOT compress invalid hex values.
112
- * e.g. background-color: #aabbccdd
113
- *
114
- * @private
115
- * @method _compressHexColors
116
- * @param {String} css The input css
117
- * @returns String The processed css
118
- */
119
- YAHOO.compressor._compressHexColors = function(css) {
120
-
121
- // Look for hex colors inside { ... } (to avoid IDs) and which don't have a =, or a " in front of them (to avoid filters)
122
- var pattern = /(\=\s*?["']?)?#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])(\}|[^0-9a-f{][^{]*?\})/gi,
123
- m,
124
- index = 0,
125
- isFilter,
126
- sb = [];
127
-
128
- while ((m = pattern.exec(css)) !== null) {
129
-
130
- sb.push(css.substring(index, m.index));
131
-
132
- isFilter = m[1];
133
-
134
- if (isFilter) {
135
- // Restore, maintain case, otherwise filter will break
136
- sb.push(m[1] + "#" + (m[2] + m[3] + m[4] + m[5] + m[6] + m[7]));
137
- } else {
138
- if (m[2].toLowerCase() == m[3].toLowerCase() &&
139
- m[4].toLowerCase() == m[5].toLowerCase() &&
140
- m[6].toLowerCase() == m[7].toLowerCase()) {
141
-
142
- // Compress.
143
- sb.push("#" + (m[3] + m[5] + m[7]).toLowerCase());
144
- } else {
145
- // Non compressible color, restore but lower case.
146
- sb.push("#" + (m[2] + m[3] + m[4] + m[5] + m[6] + m[7]).toLowerCase());
147
- }
148
- }
149
-
150
- index = pattern.lastIndex = pattern.lastIndex - m[8].length;
151
- }
152
-
153
- sb.push(css.substring(index));
154
-
155
- return sb.join("");
156
- };
157
-
158
- YAHOO.compressor.cssmin = function (css, linebreakpos) {
159
-
160
- var startIndex = 0,
161
- endIndex = 0,
162
- i = 0, max = 0,
163
- preservedTokens = [],
164
- comments = [],
165
- token = '',
166
- totallen = css.length,
167
- placeholder = '';
168
-
169
- css = this._extractDataUrls(css, preservedTokens);
170
-
171
- // collect all comment blocks...
172
- while ((startIndex = css.indexOf("/*", startIndex)) >= 0) {
173
- endIndex = css.indexOf("*/", startIndex + 2);
174
- if (endIndex < 0) {
175
- endIndex = totallen;
176
- }
177
- token = css.slice(startIndex + 2, endIndex);
178
- comments.push(token);
179
- css = css.slice(0, startIndex + 2) + "___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_" + (comments.length - 1) + "___" + css.slice(endIndex);
180
- startIndex += 2;
181
- }
182
-
183
- // preserve strings so their content doesn't get accidentally minified
184
- css = css.replace(/("([^\\"]|\\.|\\)*")|('([^\\']|\\.|\\)*')/g, function (match) {
185
- var i, max, quote = match.substring(0, 1);
186
-
187
- match = match.slice(1, -1);
188
-
189
- // maybe the string contains a comment-like substring?
190
- // one, maybe more? put'em back then
191
- if (match.indexOf("___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_") >= 0) {
192
- for (i = 0, max = comments.length; i < max; i = i + 1) {
193
- match = match.replace("___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_" + i + "___", comments[i]);
194
- }
195
- }
196
-
197
- // minify alpha opacity in filter strings
198
- match = match.replace(/progid:DXImageTransform\.Microsoft\.Alpha\(Opacity=/gi, "alpha(opacity=");
199
-
200
- preservedTokens.push(match);
201
- return quote + "___YUICSSMIN_PRESERVED_TOKEN_" + (preservedTokens.length - 1) + "___" + quote;
202
- });
203
-
204
- // strings are safe, now wrestle the comments
205
- for (i = 0, max = comments.length; i < max; i = i + 1) {
206
-
207
- token = comments[i];
208
- placeholder = "___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_" + i + "___";
209
-
210
- // ! in the first position of the comment means preserve
211
- // so push to the preserved tokens keeping the !
212
- if (token.charAt(0) === "!") {
213
- preservedTokens.push(token);
214
- css = css.replace(placeholder, "___YUICSSMIN_PRESERVED_TOKEN_" + (preservedTokens.length - 1) + "___");
215
- continue;
216
- }
217
-
218
- // \ in the last position looks like hack for Mac/IE5
219
- // shorten that to /*\*/ and the next one to /**/
220
- if (token.charAt(token.length - 1) === "\\") {
221
- preservedTokens.push("\\");
222
- css = css.replace(placeholder, "___YUICSSMIN_PRESERVED_TOKEN_" + (preservedTokens.length - 1) + "___");
223
- i = i + 1; // attn: advancing the loop
224
- preservedTokens.push("");
225
- css = css.replace("___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_" + i + "___", "___YUICSSMIN_PRESERVED_TOKEN_" + (preservedTokens.length - 1) + "___");
226
- continue;
227
- }
228
-
229
- // keep empty comments after child selectors (IE7 hack)
230
- // e.g. html >/**/ body
231
- if (token.length === 0) {
232
- startIndex = css.indexOf(placeholder);
233
- if (startIndex > 2) {
234
- if (css.charAt(startIndex - 3) === '>') {
235
- preservedTokens.push("");
236
- css = css.replace(placeholder, "___YUICSSMIN_PRESERVED_TOKEN_" + (preservedTokens.length - 1) + "___");
237
- }
238
- }
239
- }
240
-
241
- // in all other cases kill the comment
242
- css = css.replace("/*" + placeholder + "*/", "");
243
- }
244
-
245
-
246
- // Normalize all whitespace strings to single spaces. Easier to work with that way.
247
- css = css.replace(/\s+/g, " ");
248
-
249
- // Remove the spaces before the things that should not have spaces before them.
250
- // But, be careful not to turn "p :link {...}" into "p:link{...}"
251
- // Swap out any pseudo-class colons with the token, and then swap back.
252
- css = css.replace(/(^|\})(([^\{:])+:)+([^\{]*\{)/g, function (m) {
253
- return m.replace(":", "___YUICSSMIN_PSEUDOCLASSCOLON___");
254
- });
255
- css = css.replace(/\s+([!{};:>+\(\)\],])/g, '$1');
256
- css = css.replace(/___YUICSSMIN_PSEUDOCLASSCOLON___/g, ":");
257
-
258
- // retain space for special IE6 cases
259
- css = css.replace(/:first-(line|letter)(\{|,)/g, ":first-$1 $2");
260
-
261
- // no space after the end of a preserved comment
262
- css = css.replace(/\*\/ /g, '*/');
263
-
264
-
265
- // If there is a @charset, then only allow one, and push to the top of the file.
266
- css = css.replace(/^(.*)(@charset "[^"]*";)/gi, '$2$1');
267
- css = css.replace(/^(\s*@charset [^;]+;\s*)+/gi, '$1');
268
-
269
- // Put the space back in some cases, to support stuff like
270
- // @media screen and (-webkit-min-device-pixel-ratio:0){
271
- css = css.replace(/\band\(/gi, "and (");
272
-
273
-
274
- // Remove the spaces after the things that should not have spaces after them.
275
- css = css.replace(/([!{}:;>+\(\[,])\s+/g, '$1');
276
-
277
- // remove unnecessary semicolons
278
- css = css.replace(/;+\}/g, "}");
279
-
280
- // Replace 0(px,em,%) with 0.
281
- css = css.replace(/([\s:])(0)(px|em|%|in|cm|mm|pc|pt|ex)/gi, "$1$2");
282
-
283
- // Replace 0 0 0 0; with 0.
284
- css = css.replace(/:0 0 0 0(;|\})/g, ":0$1");
285
- css = css.replace(/:0 0 0(;|\})/g, ":0$1");
286
- css = css.replace(/:0 0(;|\})/g, ":0$1");
287
-
288
- // Replace background-position:0; with background-position:0 0;
289
- // same for transform-origin
290
- css = css.replace(/(background-position|transform-origin|webkit-transform-origin|moz-transform-origin|o-transform-origin|ms-transform-origin):0(;|\})/gi, function(all, prop, tail) {
291
- return prop.toLowerCase() + ":0 0" + tail;
292
- });
293
-
294
- // Replace 0.6 to .6, but only when preceded by : or a white-space
295
- css = css.replace(/(:|\s)0+\.(\d+)/g, "$1.$2");
296
-
297
- // Shorten colors from rgb(51,102,153) to #336699
298
- // This makes it more likely that it'll get further compressed in the next step.
299
- css = css.replace(/rgb\s*\(\s*([0-9,\s]+)\s*\)/gi, function () {
300
- var i, rgbcolors = arguments[1].split(',');
301
- for (i = 0; i < rgbcolors.length; i = i + 1) {
302
- rgbcolors[i] = parseInt(rgbcolors[i], 10).toString(16);
303
- if (rgbcolors[i].length === 1) {
304
- rgbcolors[i] = '0' + rgbcolors[i];
305
- }
306
- }
307
- return '#' + rgbcolors.join('');
308
- });
309
-
310
- // Shorten colors from #AABBCC to #ABC.
311
- css = this._compressHexColors(css);
312
-
313
- // border: none -> border:0
314
- css = css.replace(/(border|border-top|border-right|border-bottom|border-right|outline|background):none(;|\})/gi, function(all, prop, tail) {
315
- return prop.toLowerCase() + ":0" + tail;
316
- });
317
-
318
- // shorter opacity IE filter
319
- css = css.replace(/progid:DXImageTransform\.Microsoft\.Alpha\(Opacity=/gi, "alpha(opacity=");
320
-
321
- // Remove empty rules.
322
- css = css.replace(/[^\};\{\/]+\{\}/g, "");
323
-
324
- if (linebreakpos >= 0) {
325
- // Some source control tools don't like it when files containing lines longer
326
- // than, say 8000 characters, are checked in. The linebreak option is used in
327
- // that case to split long lines after a specific column.
328
- startIndex = 0;
329
- i = 0;
330
- while (i < css.length) {
331
- i = i + 1;
332
- if (css[i - 1] === '}' && i - startIndex > linebreakpos) {
333
- css = css.slice(0, i) + '\n' + css.slice(i);
334
- startIndex = i;
335
- }
336
- }
337
- }
338
-
339
- // Replace multiple semi-colons in a row by a single one
340
- // See SF bug #1980989
341
- css = css.replace(/;;+/g, ";");
342
-
343
- // restore preserved comments and strings
344
- for (i = 0, max = preservedTokens.length; i < max; i = i + 1) {
345
- css = css.replace("___YUICSSMIN_PRESERVED_TOKEN_" + i + "___", preservedTokens[i]);
346
- }
347
-
348
- // Trim the final string (for any leading or trailing white spaces)
349
- css = css.replace(/^\s+|\s+$/g, "");
350
-
351
- return css;
352
-
353
- };
@@ -1,11 +0,0 @@
1
- /**
2
- * node.js
3
- * Author: Corin Lawson - https://github.com/au-phiware
4
- * This is a wrapper of cssmin.js, suitable for use in Node.js.
5
- * Permission is hereby granted to do what you you see fit.
6
- */
7
- (function() {
8
- eval(String(require('fs').readFileSync(__dirname + '/cssmin.js')));
9
- exports.compressor = YAHOO.compressor;
10
- exports.cssmin = function () { return YAHOO.compressor.cssmin.apply(YAHOO.compressor, arguments); };
11
- })();