revert d405bc64 - obsolete since stylus-lang 0.54.7
				
					
				
			This commit is contained in:
		
							parent
							
								
									eb70e5a2aa
								
							
						
					
					
						commit
						3a8f47f4db
					
				|  | @ -37,7 +37,7 @@ function compileUsercss(preprocessor, code, vars) { | |||
|   const builder = getUsercssCompiler(preprocessor); | ||||
|   vars = simpleVars(vars); | ||||
|   return Promise.resolve(builder.preprocess ? builder.preprocess(code, vars) : code) | ||||
|     .then(code => parseMozFormat({code, emptyDocument: preprocessor === 'stylus'})) | ||||
|     .then(code => parseMozFormat({code})) | ||||
|     .then(({sections, errors}) => { | ||||
|       if (builder.postprocess) { | ||||
|         builder.postprocess(sections, vars); | ||||
|  |  | |||
|  | @ -7,12 +7,10 @@ | |||
|  * Puts the global comments into the following section to minimize the amount of global sections. | ||||
|  * Doesn't move the comment with ==UserStyle== inside. | ||||
|  * @param {string} code | ||||
|  * @param {boolean} emptyDocument - https://github.com/stylus/stylus/issues/2415,
 | ||||
|  * TODO: update stylus-lang and remove emptyDocument everywhere | ||||
|  * @param {number} styleId - used to preserve parserCache on subsequent runs over the same style | ||||
|  * @returns {{sections: Array, errors: Array}} | ||||
|  */ | ||||
| function parseMozFormat({code, emptyDocument, styleId}) { | ||||
| function parseMozFormat({code, styleId}) { | ||||
|   const CssToProperty = { | ||||
|     'url':        'urls', | ||||
|     'url-prefix': 'urlPrefixes', | ||||
|  | @ -20,7 +18,7 @@ function parseMozFormat({code, emptyDocument, styleId}) { | |||
|     'regexp':     'regexps', | ||||
|   }; | ||||
|   const hasSingleEscapes = /([^\\]|^)\\([^\\]|$)/; | ||||
|   const parser = new parserlib.css.Parser({starHack: true, emptyDocument}); | ||||
|   const parser = new parserlib.css.Parser({starHack: true}); | ||||
|   const sectionStack = [{code: '', start: 0}]; | ||||
|   const errors = []; | ||||
|   const sections = []; | ||||
|  | @ -72,13 +70,6 @@ function parseMozFormat({code, emptyDocument, styleId}) { | |||
|     doAddSection(section); | ||||
|   }); | ||||
| 
 | ||||
|   parser.addListener('emptydocument', e => { | ||||
|     const token = parser._tokenStream._token; | ||||
|     const section = sectionStack[sectionStack.length - 1]; | ||||
|     section.code += mozStyle.slice(section.start, e.offset); | ||||
|     section.start = token.offset + token.value.length; | ||||
|   }); | ||||
| 
 | ||||
|   parser.addListener('endstylesheet', () => { | ||||
|     // add nonclosed outer sections (either broken or the last global one)
 | ||||
|     const lastSection = sectionStack[sectionStack.length - 1]; | ||||
|  |  | |||
|  | @ -4006,7 +4006,6 @@ self.parserlib = (() => { | |||
|      * @param {Boolean} [options.starHack] - allows IE6 star hack | ||||
|      * @param {Boolean} [options.underscoreHack] - interprets leading underscores as IE6-7 for known properties | ||||
|      * @param {Boolean} [options.ieFilters] - accepts IE < 8 filters instead of throwing syntax errors | ||||
|      * @param {Boolean} [options.emptyDocument] - accepts @document without {} block produced by stylus-lang | ||||
|      */ | ||||
|     constructor(options) { | ||||
|       super(); | ||||
|  | @ -4437,11 +4436,6 @@ self.parserlib = (() => { | |||
|         this._ws(); | ||||
|         functions.push(this._documentFunction() || stream.LT(1)); | ||||
|       } while (stream.match(Tokens.COMMA)); | ||||
|       this._ws(); | ||||
|       if (this.options.emptyDocument && stream.peek() !== Tokens.LBRACE) { | ||||
|         this.fire({type: 'emptydocument', functions, prefix}, start); | ||||
|         return; | ||||
|       } | ||||
|       for (const fn of functions) { | ||||
|         if ((fn.type !== 'function' || !/^(url(-prefix)?|domain|regexp)$/i.test(fn.name)) && | ||||
|             fn.type !== 'uri') { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user