🎉 initiate project *astro_rewrite*
This commit is contained in:
		
							parent
							
								
									ffd4d5e86c
								
							
						
					
					
						commit
						2ba37bfbe3
					
				
					 8658 changed files with 2268794 additions and 2538 deletions
				
			
		
							
								
								
									
										18
									
								
								node_modules/gray-matter/lib/defaults.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								node_modules/gray-matter/lib/defaults.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,18 @@ | |||
| 'use strict'; | ||||
| 
 | ||||
| const engines = require('./engines'); | ||||
| const utils = require('./utils'); | ||||
| 
 | ||||
| module.exports = function(options) { | ||||
|   const opts = Object.assign({}, options); | ||||
| 
 | ||||
|   // ensure that delimiters are an array
 | ||||
|   opts.delimiters = utils.arrayify(opts.delims || opts.delimiters || '---'); | ||||
|   if (opts.delimiters.length === 1) { | ||||
|     opts.delimiters.push(opts.delimiters[0]); | ||||
|   } | ||||
| 
 | ||||
|   opts.language = (opts.language || opts.lang || 'yaml').toLowerCase(); | ||||
|   opts.engines = Object.assign({}, engines, opts.parsers, opts.engines); | ||||
|   return opts; | ||||
| }; | ||||
							
								
								
									
										30
									
								
								node_modules/gray-matter/lib/engine.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								node_modules/gray-matter/lib/engine.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,30 @@ | |||
| 'use strict'; | ||||
| 
 | ||||
| module.exports = function(name, options) { | ||||
|   let engine = options.engines[name] || options.engines[aliase(name)]; | ||||
|   if (typeof engine === 'undefined') { | ||||
|     throw new Error('gray-matter engine "' + name + '" is not registered'); | ||||
|   } | ||||
|   if (typeof engine === 'function') { | ||||
|     engine = { parse: engine }; | ||||
|   } | ||||
|   return engine; | ||||
| }; | ||||
| 
 | ||||
| function aliase(name) { | ||||
|   switch (name.toLowerCase()) { | ||||
|     case 'js': | ||||
|     case 'javascript': | ||||
|       return 'javascript'; | ||||
|     case 'coffee': | ||||
|     case 'coffeescript': | ||||
|     case 'cson': | ||||
|       return 'coffee'; | ||||
|     case 'yaml': | ||||
|     case 'yml': | ||||
|       return 'yaml'; | ||||
|     default: { | ||||
|       return name; | ||||
|     } | ||||
|   } | ||||
| } | ||||
							
								
								
									
										54
									
								
								node_modules/gray-matter/lib/engines.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								node_modules/gray-matter/lib/engines.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,54 @@ | |||
| 'use strict'; | ||||
| 
 | ||||
| const yaml = require('js-yaml'); | ||||
| 
 | ||||
| /** | ||||
|  * Default engines | ||||
|  */ | ||||
| 
 | ||||
| const engines = exports = module.exports; | ||||
| 
 | ||||
| /** | ||||
|  * YAML | ||||
|  */ | ||||
| 
 | ||||
| engines.yaml = { | ||||
|   parse: yaml.safeLoad.bind(yaml), | ||||
|   stringify: yaml.safeDump.bind(yaml) | ||||
| }; | ||||
| 
 | ||||
| /** | ||||
|  * JSON | ||||
|  */ | ||||
| 
 | ||||
| engines.json = { | ||||
|   parse: JSON.parse.bind(JSON), | ||||
|   stringify: function(obj, options) { | ||||
|     const opts = Object.assign({replacer: null, space: 2}, options); | ||||
|     return JSON.stringify(obj, opts.replacer, opts.space); | ||||
|   } | ||||
| }; | ||||
| 
 | ||||
| /** | ||||
|  * JavaScript | ||||
|  */ | ||||
| 
 | ||||
| engines.javascript = { | ||||
|   parse: function parse(str, options, wrap) { | ||||
|     /* eslint no-eval: 0 */ | ||||
|     try { | ||||
|       if (wrap !== false) { | ||||
|         str = '(function() {\nreturn ' + str.trim() + ';\n}());'; | ||||
|       } | ||||
|       return eval(str) || {}; | ||||
|     } catch (err) { | ||||
|       if (wrap !== false && /(unexpected|identifier)/i.test(err.message)) { | ||||
|         return parse(str, options, false); | ||||
|       } | ||||
|       throw new SyntaxError(err); | ||||
|     } | ||||
|   }, | ||||
|   stringify: function() { | ||||
|     throw new Error('stringifying JavaScript is not supported'); | ||||
|   } | ||||
| }; | ||||
							
								
								
									
										32
									
								
								node_modules/gray-matter/lib/excerpt.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								node_modules/gray-matter/lib/excerpt.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,32 @@ | |||
| 'use strict'; | ||||
| 
 | ||||
| const defaults = require('./defaults'); | ||||
| 
 | ||||
| module.exports = function(file, options) { | ||||
|   const opts = defaults(options); | ||||
| 
 | ||||
|   if (file.data == null) { | ||||
|     file.data = {}; | ||||
|   } | ||||
| 
 | ||||
|   if (typeof opts.excerpt === 'function') { | ||||
|     return opts.excerpt(file, opts); | ||||
|   } | ||||
| 
 | ||||
|   const sep = file.data.excerpt_separator || opts.excerpt_separator; | ||||
|   if (sep == null && (opts.excerpt === false || opts.excerpt == null)) { | ||||
|     return file; | ||||
|   } | ||||
| 
 | ||||
|   const delimiter = typeof opts.excerpt === 'string' | ||||
|     ? opts.excerpt | ||||
|     : (sep || opts.delimiters[0]); | ||||
| 
 | ||||
|   // if enabled, get the excerpt defined after front-matter
 | ||||
|   const idx = file.content.indexOf(delimiter); | ||||
|   if (idx !== -1) { | ||||
|     file.excerpt = file.content.slice(0, idx); | ||||
|   } | ||||
| 
 | ||||
|   return file; | ||||
| }; | ||||
							
								
								
									
										13
									
								
								node_modules/gray-matter/lib/parse.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								node_modules/gray-matter/lib/parse.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,13 @@ | |||
| 'use strict'; | ||||
| 
 | ||||
| const getEngine = require('./engine'); | ||||
| const defaults = require('./defaults'); | ||||
| 
 | ||||
| module.exports = function(language, str, options) { | ||||
|   const opts = defaults(options); | ||||
|   const engine = getEngine(language, opts); | ||||
|   if (typeof engine.parse !== 'function') { | ||||
|     throw new TypeError('expected "' + language + '.parse" to be a function'); | ||||
|   } | ||||
|   return engine.parse(str, opts); | ||||
| }; | ||||
							
								
								
									
										56
									
								
								node_modules/gray-matter/lib/stringify.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								node_modules/gray-matter/lib/stringify.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,56 @@ | |||
| 'use strict'; | ||||
| 
 | ||||
| const typeOf = require('kind-of'); | ||||
| const getEngine = require('./engine'); | ||||
| const defaults = require('./defaults'); | ||||
| 
 | ||||
| module.exports = function(file, data, options) { | ||||
|   if (data == null && options == null) { | ||||
|     switch (typeOf(file)) { | ||||
|       case 'object': | ||||
|         data = file.data; | ||||
|         options = {}; | ||||
|         break; | ||||
|       case 'string': | ||||
|         return file; | ||||
|       default: { | ||||
|         throw new TypeError('expected file to be a string or object'); | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   const str = file.content; | ||||
|   const opts = defaults(options); | ||||
|   if (data == null) { | ||||
|     if (!opts.data) return file; | ||||
|     data = opts.data; | ||||
|   } | ||||
| 
 | ||||
|   const language = file.language || opts.language; | ||||
|   const engine = getEngine(language, opts); | ||||
|   if (typeof engine.stringify !== 'function') { | ||||
|     throw new TypeError('expected "' + language + '.stringify" to be a function'); | ||||
|   } | ||||
| 
 | ||||
|   data = Object.assign({}, file.data, data); | ||||
|   const open = opts.delimiters[0]; | ||||
|   const close = opts.delimiters[1]; | ||||
|   const matter = engine.stringify(data, options).trim(); | ||||
|   let buf = ''; | ||||
| 
 | ||||
|   if (matter !== '{}') { | ||||
|     buf = newline(open) + newline(matter) + newline(close); | ||||
|   } | ||||
| 
 | ||||
|   if (typeof file.excerpt === 'string' && file.excerpt !== '') { | ||||
|     if (str.indexOf(file.excerpt.trim()) === -1) { | ||||
|       buf += newline(file.excerpt) + newline(close); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   return buf + newline(str); | ||||
| }; | ||||
| 
 | ||||
| function newline(str) { | ||||
|   return str.slice(-1) !== '\n' ? str + '\n' : str; | ||||
| } | ||||
							
								
								
									
										43
									
								
								node_modules/gray-matter/lib/to-file.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								node_modules/gray-matter/lib/to-file.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,43 @@ | |||
| 'use strict'; | ||||
| 
 | ||||
| const typeOf = require('kind-of'); | ||||
| const stringify = require('./stringify'); | ||||
| const utils = require('./utils'); | ||||
| 
 | ||||
| /** | ||||
|  * Normalize the given value to ensure an object is returned | ||||
|  * with the expected properties. | ||||
|  */ | ||||
| 
 | ||||
| module.exports = function(file) { | ||||
|   if (typeOf(file) !== 'object') { | ||||
|     file = { content: file }; | ||||
|   } | ||||
| 
 | ||||
|   if (typeOf(file.data) !== 'object') { | ||||
|     file.data = {}; | ||||
|   } | ||||
| 
 | ||||
|   // if file was passed as an object, ensure that
 | ||||
|   // "file.content" is set
 | ||||
|   if (file.contents && file.content == null) { | ||||
|     file.content = file.contents; | ||||
|   } | ||||
| 
 | ||||
|   // set non-enumerable properties on the file object
 | ||||
|   utils.define(file, 'orig', utils.toBuffer(file.content)); | ||||
|   utils.define(file, 'language', file.language || ''); | ||||
|   utils.define(file, 'matter', file.matter || ''); | ||||
|   utils.define(file, 'stringify', function(data, options) { | ||||
|     if (options && options.language) { | ||||
|       file.language = options.language; | ||||
|     } | ||||
|     return stringify(file, data, options); | ||||
|   }); | ||||
| 
 | ||||
|   // strip BOM and ensure that "file.content" is a string
 | ||||
|   file.content = utils.toString(file.content); | ||||
|   file.isEmpty = false; | ||||
|   file.excerpt = ''; | ||||
|   return file; | ||||
| }; | ||||
							
								
								
									
										66
									
								
								node_modules/gray-matter/lib/utils.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								node_modules/gray-matter/lib/utils.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,66 @@ | |||
| 'use strict'; | ||||
| 
 | ||||
| const stripBom = require('strip-bom-string'); | ||||
| const typeOf = require('kind-of'); | ||||
| 
 | ||||
| exports.define = function(obj, key, val) { | ||||
|   Reflect.defineProperty(obj, key, { | ||||
|     enumerable: false, | ||||
|     configurable: true, | ||||
|     writable: true, | ||||
|     value: val | ||||
|   }); | ||||
| }; | ||||
| 
 | ||||
| /** | ||||
|  * Returns true if `val` is a buffer | ||||
|  */ | ||||
| 
 | ||||
| exports.isBuffer = function(val) { | ||||
|   return typeOf(val) === 'buffer'; | ||||
| }; | ||||
| 
 | ||||
| /** | ||||
|  * Returns true if `val` is an object | ||||
|  */ | ||||
| 
 | ||||
| exports.isObject = function(val) { | ||||
|   return typeOf(val) === 'object'; | ||||
| }; | ||||
| 
 | ||||
| /** | ||||
|  * Cast `input` to a buffer | ||||
|  */ | ||||
| 
 | ||||
| exports.toBuffer = function(input) { | ||||
|   return typeof input === 'string' ? Buffer.from(input) : input; | ||||
| }; | ||||
| 
 | ||||
| /** | ||||
|  * Cast `val` to a string. | ||||
|  */ | ||||
| 
 | ||||
| exports.toString = function(input) { | ||||
|   if (exports.isBuffer(input)) return stripBom(String(input)); | ||||
|   if (typeof input !== 'string') { | ||||
|     throw new TypeError('expected input to be a string or buffer'); | ||||
|   } | ||||
|   return stripBom(input); | ||||
| }; | ||||
| 
 | ||||
| /** | ||||
|  * Cast `val` to an array. | ||||
|  */ | ||||
| 
 | ||||
| exports.arrayify = function(val) { | ||||
|   return val ? (Array.isArray(val) ? val : [val]) : []; | ||||
| }; | ||||
| 
 | ||||
| /** | ||||
|  * Returns true if `str` starts with `substr`. | ||||
|  */ | ||||
| 
 | ||||
| exports.startsWith = function(str, substr, len) { | ||||
|   if (typeof len !== 'number') len = substr.length; | ||||
|   return str.slice(0, len) === substr; | ||||
| }; | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 sindrekjelsrud
						sindrekjelsrud