├── __tests__ ├── .babelrc ├── __snapshots__ │ ├── index.test.js.snap │ └── index.test.js.md ├── fixtures │ ├── basic.rgl │ ├── scoped-css.rgl │ ├── css-preprocessor.rgl │ ├── deep-selectors.rgl │ ├── multiple-css.rgl │ └── preserve-whitespace.rgl ├── index.test.js └── bundle.js ├── .gitignore ├── lib ├── precompile.js ├── helpers.js ├── selector.js ├── utils │ ├── try-require.js │ └── options-cache.js ├── deindent.js ├── html-loader │ ├── attributesParser.js │ └── index.js ├── template-rewriter.js ├── style-rewriter.js ├── load-postcss-config.js ├── postcss-plugins │ └── scoped.js ├── parser.js └── index.js ├── circle.yml ├── LICENSE ├── README.md └── package.json /__tests__/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ "es2015" ] 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | /__tests__/dist 4 | /demo 5 | /lib/utils/.options-cache-* 6 | -------------------------------------------------------------------------------- /__tests__/__snapshots__/index.test.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/regularjs/regular-loader/HEAD/__tests__/__snapshots__/index.test.js.snap -------------------------------------------------------------------------------- /__tests__/fixtures/basic.rgl: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | -------------------------------------------------------------------------------- /__tests__/fixtures/scoped-css.rgl: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | 16 | -------------------------------------------------------------------------------- /__tests__/fixtures/css-preprocessor.rgl: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | 18 | -------------------------------------------------------------------------------- /lib/precompile.js: -------------------------------------------------------------------------------- 1 | const Regular = require( 'regularjs' ) 2 | 3 | module.exports = function ( content ) { 4 | const compiled = Regular.parse( content.html, { 5 | stringify: true 6 | } ) 7 | 8 | return { 9 | compiled: compiled, 10 | data: content.data, 11 | root: content.root 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /__tests__/fixtures/deep-selectors.rgl: -------------------------------------------------------------------------------- 1 | 6 | 7 | 9 | 10 | 23 | -------------------------------------------------------------------------------- /__tests__/fixtures/multiple-css.rgl: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | 16 | 17 | 22 | -------------------------------------------------------------------------------- /lib/helpers.js: -------------------------------------------------------------------------------- 1 | // stringify an Array of loader objects 2 | exports.stringifyLoaders = function stringifyLoaders( loaders ) { 3 | return loaders 4 | .map( 5 | obj => 6 | obj && typeof obj === 'object' && typeof obj.loader === 'string' ? 7 | obj.loader + ( obj.options ? '?' + JSON.stringify( obj.options ) : '' ) : 8 | obj 9 | ) 10 | .join( '!' ) 11 | } 12 | -------------------------------------------------------------------------------- /__tests__/fixtures/preserve-whitespace.rgl: -------------------------------------------------------------------------------- 1 | 22 | 23 | 28 | -------------------------------------------------------------------------------- /lib/selector.js: -------------------------------------------------------------------------------- 1 | const parse = require( './parser' ) 2 | const loaderUtils = require( 'loader-utils' ) 3 | const path = require( 'path' ) 4 | 5 | module.exports = function ( content ) { 6 | const options = loaderUtils.getOptions( this ) 7 | const filename = path.basename( this.resourcePath ) 8 | const parts = parse( content, filename, this.sourceMap ) 9 | const part = parts[ options.type ][ options.index ] 10 | this.callback( null, part.content, part.map ) 11 | } 12 | -------------------------------------------------------------------------------- /lib/utils/try-require.js: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License http://www.opensource.org/licenses/mit-license.php 3 | Author Evan You 4 | */ 5 | 6 | const cwd = process.cwd() 7 | const resolve = require( 'resolve' ) 8 | 9 | // attempts to first require a dep using projects cwd (when vue-loader is linked) 10 | // then try a normal require. 11 | module.exports = function tryRequire( dep ) { 12 | let fromCwd 13 | try { 14 | fromCwd = resolve.sync( dep, { basedir: cwd } ) 15 | } catch ( e ) {} 16 | if ( fromCwd ) { 17 | return require( fromCwd ) 18 | } 19 | try { 20 | return require( dep ) 21 | } catch ( e ) {} 22 | } 23 | -------------------------------------------------------------------------------- /circle.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | jobs: 3 | build: 4 | working_directory: ~/repo 5 | docker: 6 | - image: circleci/node:6 7 | branches: 8 | ignore: 9 | - gh-pages 10 | steps: 11 | - checkout 12 | - restore_cache: 13 | key: dependency-cache-{{ checksum "yarn.lock" }} 14 | - run: 15 | name: install dependences 16 | command: yarn 17 | - save_cache: 18 | key: dependency-cache-{{ checksum "yarn.lock" }} 19 | paths: 20 | - ./node_modules 21 | - run: 22 | name: test 23 | command: yarn test 24 | - store_artifacts: 25 | path: ~/repo/__tests__/dist 26 | -------------------------------------------------------------------------------- /__tests__/index.test.js: -------------------------------------------------------------------------------- 1 | const test = require( 'ava' ) 2 | const rm = require( 'rimraf' ) 3 | const path = require( 'path' ) 4 | const bundle = require( './bundle' ) 5 | 6 | test.before( () => { 7 | rm.sync( path.resolve( __dirname, 'dist' ) ) 8 | process.chdir( __dirname ) 9 | } ) 10 | 11 | test.serial( 'basic', async t => { 12 | t.snapshot( await bundle( 'basic.rgl' ) ) 13 | } ) 14 | 15 | test.serial( 'css-preprocessor', async t => { 16 | t.snapshot( await bundle( 'css-preprocessor.rgl' ) ) 17 | } ) 18 | 19 | test.serial( 'multiple-css', async t => { 20 | t.snapshot( await bundle( 'multiple-css.rgl' ) ) 21 | } ) 22 | 23 | test.serial( 'preserve-whitespace', async t => { 24 | t.snapshot( await bundle( 'preserve-whitespace.rgl' ) ) 25 | } ) 26 | 27 | test.serial( 'scoped-css', async t => { 28 | t.snapshot( await bundle( 'scoped-css.rgl' ) ) 29 | } ) 30 | 31 | test.serial( 'deep-selectors', async t => { 32 | t.snapshot( await bundle( 'deep-selectors.rgl' ) ) 33 | } ) 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Original work Copyright (c) 2015 Q42 4 | Modified work Copyright (c) 2016 NetEase, Inc. and regular-loader contributors. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /lib/deindent.js: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License http://www.opensource.org/licenses/mit-license.php 3 | Author Evan You @yyx990803 4 | */ 5 | const splitRE = /\r?\n/g 6 | const emptyRE = /^\s*$/ 7 | const needFixRE = /^(\r?\n)*[\t\s]/ 8 | 9 | module.exports = function deindent( str ) { 10 | if ( !needFixRE.test( str ) ) { 11 | return str 12 | } 13 | const lines = str.split( splitRE ) 14 | let min = Infinity 15 | let type, cur, c 16 | for ( let i = 0; i < lines.length; i++ ) { 17 | const line = lines[ i ] 18 | if ( !emptyRE.test( line ) ) { 19 | if ( type ) { 20 | cur = count( line, type ) 21 | if ( cur < min ) { 22 | min = cur 23 | } 24 | } else { 25 | c = line.charAt( 0 ) 26 | if ( c === ' ' || c === '\t' ) { 27 | type = c 28 | cur = count( line, type ) 29 | if ( cur < min ) { 30 | min = cur 31 | } 32 | } else { 33 | return str 34 | } 35 | } 36 | } 37 | } 38 | return lines 39 | .map( function ( line ) { 40 | return line.slice( min ) 41 | } ) 42 | .join( '\n' ) 43 | } 44 | 45 | function count( line, type ) { 46 | let i = 0 47 | while ( line.charAt( i ) === type ) { 48 | i++ 49 | } 50 | return i 51 | } 52 | -------------------------------------------------------------------------------- /lib/html-loader/attributesParser.js: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License http://www.opensource.org/licenses/mit-license.php 3 | Author Tobias Koppers @sokra 4 | */ 5 | const Parser = require( 'fastparse' ) 6 | 7 | const processMatch = function ( match, strUntilValue, name, value, index ) { 8 | if ( !this.isRelevantTagAttr( this.currentTag, name ) ) { 9 | return 10 | } 11 | this.results.push( { 12 | start: index + strUntilValue.length, 13 | length: value.length, 14 | value: value 15 | } ) 16 | } 17 | 18 | const parser = new Parser( { 19 | outside: { 20 | '': true, 21 | '': true, 22 | '<[!\\?].*?>': true, 23 | ']+>': true, // eslint-disable-line 24 | '<([a-zA-Z\\-:]+)\\s*': function ( match, tagName ) { 25 | this.currentTag = tagName 26 | return 'inside' 27 | } 28 | }, 29 | /* eslint-disable */ 30 | inside: { 31 | '\\s+': true, // eat up whitespace 32 | '>': 'outside', // end of attributes 33 | '(([0-9a-zA-Z\\-:.]+)\\s*=\\s*")([^"]*)"': processMatch, 34 | "(([0-9a-zA-Z\\-:.]+)\\s*=\\s*')([^']*)'": processMatch, 35 | '(([0-9a-zA-Z\\-:.]+)\\s*=\\s*)([^\\s>]+)': processMatch 36 | } 37 | /* eslint-enable */ 38 | } ) 39 | 40 | module.exports = function parse( html, isRelevantTagAttr ) { 41 | return parser.parse( 'outside', html, { 42 | currentTag: null, 43 | results: [], 44 | isRelevantTagAttr: isRelevantTagAttr 45 | } ).results 46 | } 47 | -------------------------------------------------------------------------------- /lib/template-rewriter.js: -------------------------------------------------------------------------------- 1 | const loaderUtils = require( 'loader-utils' ) 2 | 3 | // type if -> consequent && alternate 4 | // type list -> body 5 | // type element -> children 6 | 7 | function walk( tree, fn ) { 8 | tree.forEach( function ( v ) { 9 | if ( v.type === 'element' ) { 10 | fn( v ) 11 | if ( v.children ) { 12 | walk( v.children, fn ) 13 | } 14 | } else if ( v.type === 'if' ) { 15 | walk( v.alternate, fn ) 16 | walk( v.consequent, fn ) 17 | } else if ( v.type === 'list' ) { 18 | walk( v.body, fn ) 19 | } 20 | } ) 21 | } 22 | 23 | module.exports = function ( content ) { 24 | const query = loaderUtils.getOptions( this ) || {} 25 | const id = query.id 26 | const scoped = query.scoped 27 | 28 | let tree = [] 29 | try { 30 | tree = JSON.parse( content.compiled ) 31 | } catch ( e ) {} 32 | 33 | if ( scoped ) { 34 | walk( tree, function ( node ) { 35 | node.attrs.push( { 36 | type: 'attribute', 37 | name: id, 38 | value: '' 39 | } ) 40 | } ) 41 | } 42 | 43 | const root = content.root 44 | const data = content.data 45 | 46 | // use `module.exports` to export 47 | return ( 48 | 'module.exports = ' + 49 | JSON.stringify( tree ).replace( /"(xxxHTMLLINKxxx[0-9.]+xxx)"/g, function ( 50 | total, 51 | match 52 | ) { 53 | // eslint-disable-line 54 | if ( !data[ match ] ) { 55 | return total 56 | } 57 | return 'require(\'' + loaderUtils.urlToRequest( data[ match ], root ) + '\')' 58 | } ) 59 | ) 60 | } 61 | -------------------------------------------------------------------------------- /lib/utils/options-cache.js: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License http://www.opensource.org/licenses/mit-license.php 3 | Author Evan You 4 | */ 5 | 6 | const fs = require( 'fs' ) 7 | const path = require( 'path' ) 8 | const hash = require( 'hash-sum' ) 9 | 10 | const optionsToId = new Map() 11 | const idToOptions = new Map() 12 | 13 | exports.saveOptions = options => { 14 | if ( optionsToId.has( options ) ) { 15 | return optionsToId.get( options ) 16 | } 17 | 18 | const threadMode = options && options.threadMode 19 | const serialized = threadMode ? serialize( options ) : null 20 | const id = serialized ? hash( serialized ) : String( idToOptions.size ) 21 | 22 | idToOptions.set( id, options || {} ) 23 | optionsToId.set( options, id ) 24 | 25 | if ( options && serialized ) { 26 | const fsidToOptionsPath = getidToOptionsPath( id ) 27 | if ( !fs.existsSync( fsidToOptionsPath ) ) { 28 | fs.writeFileSync( fsidToOptionsPath, serialized ) 29 | } 30 | } 31 | 32 | return id 33 | } 34 | 35 | exports.loadOptions = id => { 36 | const res = idToOptions.get( id ) 37 | if ( res ) { 38 | return res 39 | } 40 | const fsidToOptionsPath = getidToOptionsPath( id ) 41 | if ( fs.existsSync( fsidToOptionsPath ) ) { 42 | return JSON.parse( fs.readFileSync( fsidToOptionsPath, 'utf-8' ) ) 43 | } 44 | return {} 45 | } 46 | 47 | function serialize( options ) { 48 | let res 49 | try { 50 | res = JSON.stringify( options ) 51 | } catch ( e ) { 52 | throw new Error( `options must be JSON serializable in thread mode.` ) 53 | } 54 | return res 55 | } 56 | 57 | function getidToOptionsPath( id ) { 58 | return path.resolve( __dirname, `.options-cache-${ id }` ) 59 | } 60 | -------------------------------------------------------------------------------- /lib/style-rewriter.js: -------------------------------------------------------------------------------- 1 | const postcss = require( 'postcss' ) 2 | const loaderUtils = require( 'loader-utils' ) 3 | const addScopedAttribute = require( './postcss-plugins/scoped' ) 4 | const loadOptions = require( './utils/options-cache' ).loadOptions 5 | const loadPostcssConfig = require( './load-postcss-config' ) 6 | 7 | module.exports = function ( content, map ) { 8 | const cb = this.async() 9 | 10 | const query = loaderUtils.getOptions( this ) || {} 11 | const options = loadOptions( query.optionsId ) 12 | 13 | const inlineOptions = options.postcss 14 | 15 | loadPostcssConfig( this, inlineOptions ) 16 | .then( config => { 17 | const plugins = config.plugins 18 | const options = Object.assign( 19 | { 20 | to: this.resourcePath, 21 | from: this.resourcePath, 22 | map: false 23 | }, 24 | config.options 25 | ) 26 | 27 | // scoped css 28 | if ( query.scoped ) { 29 | plugins.push( addScopedAttribute( { id: query.id } ) ) 30 | } 31 | 32 | // sourcemap 33 | if ( query.sourceMap && !options.map ) { 34 | options.map = { 35 | inline: false, 36 | annotation: false, 37 | prev: map 38 | } 39 | } 40 | 41 | postcss( plugins ) 42 | .process( content, options ) 43 | .then( result => { 44 | if ( result.messages ) { 45 | result.messages.forEach( ( { type, file } ) => { 46 | if ( type === 'dependency' ) { 47 | this.addDependency( file ) 48 | } 49 | } ) 50 | } 51 | const map = result.map && result.map.toJSON() 52 | cb( null, result.css, map ) 53 | return null // silence bluebird warning 54 | } ) 55 | .catch( e => { 56 | console.error( e ) 57 | cb( e ) 58 | } ) 59 | } ) 60 | } 61 | -------------------------------------------------------------------------------- /lib/load-postcss-config.js: -------------------------------------------------------------------------------- 1 | const load = require( 'postcss-load-config' ) 2 | 3 | let loaded 4 | 5 | function isObject( val ) { 6 | return val && typeof val === 'object' 7 | } 8 | 9 | module.exports = function loadPostcssConfig( loaderContext, inlineConfig = {} ) { 10 | if ( inlineConfig.useConfigFile === false ) { 11 | return Promise.resolve( { 12 | plugins: inlineConfig.plugins || [], 13 | options: inlineConfig.options || {} 14 | } ) 15 | } 16 | 17 | if ( inlineConfig.cascade || !loaded ) { 18 | const config = inlineConfig.config || {} 19 | const ctx = { webpack: loaderContext } 20 | if ( config.ctx ) { 21 | ctx.options = config.ctx 22 | } 23 | const configPath = ( inlineConfig.cascade && !config.path ) ? 24 | loaderContext.resourcePath : 25 | config.path 26 | loaded = load( ctx, configPath, { argv: false } ).catch( err => { 27 | // postcss-load-config throws error when no config file is found, 28 | // but for us it's optional. only emit other errors 29 | if ( err.message.indexOf( 'No PostCSS Config found' ) >= 0 ) { 30 | return 31 | } 32 | loaderContext.emitWarning( `Error loading PostCSS config: ${ err.message }` ) 33 | } ) 34 | } 35 | 36 | return loaded.then( config => { 37 | let plugins = [] 38 | let options = {} 39 | 40 | // inline postcss options for vue-loader 41 | if ( typeof inlineConfig === 'function' ) { 42 | inlineConfig = inlineConfig.call( this, this ) 43 | } 44 | if ( Array.isArray( inlineConfig ) ) { 45 | plugins = inlineConfig 46 | } else if ( isObject( inlineConfig ) ) { 47 | plugins = 48 | typeof inlineConfig.plugins === 'function' ? 49 | inlineConfig.plugins.call( this, this ) : 50 | inlineConfig.plugins || [] 51 | options = inlineConfig.options || {} 52 | } 53 | 54 | // merge postcss config file 55 | if ( config && config.plugins ) { 56 | plugins = plugins.concat( config.plugins ) 57 | } 58 | if ( config && config.options ) { 59 | options = Object.assign( {}, config.options, options ) 60 | } 61 | 62 | return { 63 | plugins, 64 | options 65 | } 66 | } ) 67 | } 68 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # regular-loader 2 | 3 | [![build status][build-status-image]][build-status-url] 4 | [![npm package][npm-package-image]][npm-package-url] 5 | [![npm package next][npm-package-image-next]][npm-package-url] 6 | [![license][license-image]][license-url] 7 | 8 | ## Installation 9 | 10 | ```bash 11 | # for webpack 2/3/4 12 | npm i regular-loader@^1.0.0 -D 13 | ``` 14 | 15 | ```bash 16 | # for webpack 1 17 | npm i regular-loader@^0.1.5 -D 18 | ``` 19 | 20 | ## Example 21 | 22 | ### For webpack 2/3 23 | 24 | webpack.config.js 25 | 26 | ```js 27 | const ExtractTextPlugin = require( 'extract-text-webpack-plugin' ); 28 | 29 | module.exports = { 30 | // ... 31 | module: { 32 | rules: [{ 33 | test: /\.rgl$/, 34 | use: { 35 | loader: 'regular-loader', 36 | options: { 37 | extractCSS: true 38 | } 39 | }, 40 | }] 41 | }, 42 | plugins: [ 43 | new ExtractTextPlugin( 'app.css' ) 44 | ] 45 | }; 46 | ``` 47 | 48 | ### For webpack 4 49 | 50 | webpack.config.js 51 | 52 | ```js 53 | const MiniCssExtractPlugin = require( 'mini-css-extract-plugin' ); 54 | 55 | module.exports = { 56 | // ... 57 | module: { 58 | rules: [{ 59 | test: /\.rgl$/, 60 | use: { 61 | loader: 'regular-loader', 62 | options: { 63 | extractCSS: true 64 | } 65 | }, 66 | }] 67 | }, 68 | plugins: [ 69 | new MiniCssExtractPlugin( { 70 | filename: 'app.css', 71 | } ) 72 | ] 73 | }; 74 | ``` 75 | 76 | ## Related 77 | 78 | - [regularjs](https://github.com/regularjs/regular) 79 | 80 | ## Thanks 81 | 82 | - [vue-loader](https://github.com/vuejs/vue-loader) 83 | 84 | [build-status-image]: https://img.shields.io/circleci/project/regularjs/regular-loader/1.x-release.svg?style=for-the-badge 85 | [build-status-url]: https://circleci.com/gh/regularjs/regular-loader 86 | 87 | [npm-package-image]: https://img.shields.io/npm/v/regular-loader.svg?style=for-the-badge 88 | [npm-package-url]: https://www.npmjs.org/package/regular-loader 89 | 90 | [npm-package-image-next]: https://img.shields.io/npm/v/regular-loader/next.svg?style=for-the-badge 91 | 92 | [license-image]: https://img.shields.io/badge/license-MIT-000000.svg?style=for-the-badge 93 | [license-url]: LICENSE 94 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "regular-loader", 3 | "version": "1.1.0-0", 4 | "keywords": [ 5 | "regularjs", 6 | "regular", 7 | "rgl", 8 | "webpack", 9 | "loader" 10 | ], 11 | "description": "webpack loader for regularjs", 12 | "main": "lib/index.js", 13 | "scripts": { 14 | "test": "eslint lib --quiet && npm run ava", 15 | "ava": "ava __tests__/**/*.test.js", 16 | "snapshot": "rm -rf __tests__/__snapshots__ && npm run ava -- -u", 17 | "lint": "eslint lib --fix --quiet", 18 | "format": "prettier-eslint --list-different --write \"lib/**/*.js\"", 19 | "precommit": "lint-staged" 20 | }, 21 | "lint-staged": { 22 | "lib/**/*.js": [ 23 | "eslint --fix --quiet", 24 | "git add" 25 | ] 26 | }, 27 | "eslintConfig": { 28 | "extends": "mo", 29 | "rules": { 30 | "semi": [ 31 | "error", 32 | "never" 33 | ], 34 | "indent": [ 35 | "error", 36 | 2 37 | ] 38 | } 39 | }, 40 | "maintainers": [ 41 | { 42 | "name": "fengzilong", 43 | "email": "fengzilong1992@gmail.com" 44 | } 45 | ], 46 | "license": "MIT", 47 | "dependencies": { 48 | "es6-templates": "^0.2.2", 49 | "fastparse": "^1.1.1", 50 | "hash-sum": "^1.0.2", 51 | "html-minifier": "^3.5.6", 52 | "loader-utils": "^1.1.0", 53 | "lru-cache": "^4.0.1", 54 | "parse5": "^2.1.5", 55 | "postcss": "^6.0.20", 56 | "postcss-load-config": "^1.2.0", 57 | "postcss-selector-parser": "^3.1.1", 58 | "resolve": "^1.8.1", 59 | "source-map": "^0.5.6" 60 | }, 61 | "peerDependencies": { 62 | "css-loader": "*", 63 | "regularjs": "*", 64 | "style-loader": "*" 65 | }, 66 | "devDependencies": { 67 | "ava": "^0.25.0", 68 | "babel-core": "^6.0.0", 69 | "babel-loader": "^6.2.4", 70 | "babel-plugin-transform-runtime": "^6.9.0", 71 | "babel-preset-es2015": "^6.24.1", 72 | "css-loader": "^0.28.11", 73 | "eslint": "^3.15.0", 74 | "eslint-config-mo": "^0.2.0", 75 | "extract-text-webpack-plugin": "2.1.2", 76 | "friendly-errors-webpack-plugin": "^1.6.1", 77 | "fs-extra": "^4.0.1", 78 | "less": "^3.0.1", 79 | "less-loader": "^4.1.0", 80 | "lint-staged": "^7.0.4", 81 | "prettier-eslint-cli": "^4.7.1", 82 | "regularjs": "0.6.0-beta.6", 83 | "rimraf": "^2.6.1", 84 | "style-loader": "^0.20.3", 85 | "webpack": "^2.7.0" 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /__tests__/bundle.js: -------------------------------------------------------------------------------- 1 | const path = require( 'path' ) 2 | const webpack = require( 'webpack' ) 3 | const ExtractTextPlugin = require( 'extract-text-webpack-plugin' ) 4 | const FriendlyErrorsWebpackPlugin = require( 'friendly-errors-webpack-plugin' ) 5 | const fs = require( 'fs-extra' ) 6 | const regularLoader = require( '../lib' ) 7 | 8 | function cwd( ...segs ) { 9 | return path.resolve( __dirname, ...segs ) 10 | } 11 | 12 | function bundle( entry, options = {} ) { 13 | const basename = path.basename( entry, '.rgl' ) 14 | 15 | const config = { 16 | entry: cwd( `fixtures/${ entry }` ), 17 | output: { 18 | path: cwd( 'dist' ), 19 | filename: `${ basename }.js` 20 | }, 21 | module: { 22 | rules: [{ 23 | test: /\.rgl$/, 24 | use: { 25 | loader: require.resolve( '../lib' ), 26 | options: Object.assign( { 27 | extractCSS: true 28 | }, options ) 29 | }, 30 | }] 31 | }, 32 | plugins: [ 33 | new ExtractTextPlugin( `${ basename }.css` ), 34 | new FriendlyErrorsWebpackPlugin( { clearConsole: false } ), 35 | new webpack.optimize.CommonsChunkPlugin( { 36 | name: 'vendor', 37 | filename: 'vendor.js', 38 | minChunks: function ( module ) { 39 | return module.context && module.context.includes( 'node_modules' ) 40 | } 41 | } ) 42 | ] 43 | } 44 | 45 | const compiler = webpack( config ) 46 | 47 | return new Promise( function ( resolve, reject ) { 48 | compiler.run( function ( err, stats ) { 49 | if ( err ) { 50 | console.log( err ); 51 | return reject( err ) 52 | } 53 | 54 | const jsonStats = stats.toJson() 55 | 56 | if ( jsonStats.errors.length > 0 ) { 57 | console.log( jsonStats.errors ); 58 | return reject() 59 | } 60 | 61 | if ( jsonStats.warnings.length > 0 ) { 62 | console.log( jsonStats.warnings ); 63 | } 64 | 65 | const jsfile = cwd( `dist/${ basename }.js` ) 66 | const cssfile = cwd( `dist/${ basename }.css` ) 67 | 68 | Promise.all( [ 69 | fs.pathExists( jsfile ).then( exists => { 70 | if ( exists ) return fs.readFile( jsfile ) 71 | return '!! file not exist !!' 72 | } ), 73 | fs.pathExists( cssfile ).then( exists => { 74 | if ( exists ) return fs.readFile( cssfile ) 75 | return '!! file not exist !!' 76 | } ), 77 | ] ).then( function ( files ) { 78 | resolve( [ files[ 0 ].toString(), files[ 1 ].toString() ] ) 79 | }, reject ) 80 | } ) 81 | } ) 82 | } 83 | 84 | module.exports = bundle 85 | -------------------------------------------------------------------------------- /lib/html-loader/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License http://www.opensource.org/licenses/mit-license.php 3 | Author Tobias Koppers @sokra 4 | */ 5 | const htmlMinifier = require( 'html-minifier' ) 6 | const loaderUtils = require( 'loader-utils' ) 7 | const compile = require( 'es6-templates' ).compile 8 | const url = require( 'url' ) 9 | const attrParse = require( './attributesParser' ) 10 | const loadOptions = require( '../utils/options-cache' ).loadOptions 11 | 12 | const hasOwn = Object.prototype.hasOwnProperty 13 | 14 | function randomIdent() { 15 | return 'xxxHTMLLINKxxx' + Math.random() + Math.random() + 'xxx' 16 | } 17 | 18 | function getLoaderConfig( context ) { 19 | const query = loaderUtils.getOptions( context ) || {} 20 | const configKey = query.config || 'htmlLoader' 21 | const config = 22 | context.options && hasOwn.call( context.options, configKey ) ? 23 | context.options[ configKey ] : 24 | {} 25 | 26 | delete query.config 27 | 28 | return Object.assign( query, config ) 29 | } 30 | 31 | module.exports = function ( content ) { 32 | const config = getLoaderConfig( this ) 33 | const options = loadOptions( config.optionsId ) 34 | let attributes = [ 'img:src' ] 35 | if ( config.attrs !== undefined ) { 36 | if ( typeof config.attrs === 'string' ) { 37 | attributes = config.attrs.split( ' ' ) 38 | } else if ( Array.isArray( config.attrs ) ) { 39 | attributes = config.attrs 40 | } else if ( config.attrs === false ) { 41 | attributes = [] 42 | } else { 43 | throw new Error( 'Invalid value to config parameter attrs' ) 44 | } 45 | } 46 | const root = config.root 47 | const links = attrParse( content, function ( tag, attr ) { 48 | return attributes.indexOf( tag + ':' + attr ) >= 0 49 | } ) 50 | links.reverse() 51 | const data = {} 52 | content = [ content ] 53 | links.forEach( function ( link ) { 54 | if ( !loaderUtils.isUrlRequest( link.value, root ) ) { 55 | return 56 | } 57 | 58 | const uri = url.parse( link.value ) 59 | if ( uri.hash !== null && uri.hash !== undefined ) { 60 | uri.hash = null 61 | link.value = uri.format() 62 | link.length = link.value.length 63 | } 64 | 65 | let ident 66 | do { 67 | ident = randomIdent() 68 | } while ( data[ ident ] ) 69 | data[ ident ] = link.value 70 | const x = content.pop() 71 | content.push( x.substr( link.start + link.length ) ) 72 | content.push( ident ) 73 | content.push( x.substr( 0, link.start ) ) 74 | } ) 75 | content.reverse() 76 | content = content.join( '' ) 77 | 78 | if ( options.preserveWhitespace === false ) { 79 | content = htmlMinifier.minify( content, { 80 | caseSensitive: true, 81 | collapseWhitespace: true, 82 | collapseInlineTagWhitespace: true, 83 | preserveLineBreaks: false, 84 | removeTagWhitespace: false, 85 | keepClosingSlash: true, 86 | ignoreCustomFragments: [ /\{[\s\S]*?\}/ ], 87 | trimCustomFragments: true, 88 | removeAttributeQuotes: false 89 | } ) 90 | } 91 | 92 | if ( config.interpolate ) { 93 | content = compile( '`' + content + '`' ).code 94 | } 95 | 96 | return { 97 | html: content, 98 | data: data, 99 | root: root 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /lib/postcss-plugins/scoped.js: -------------------------------------------------------------------------------- 1 | const postcss = require( 'postcss' ) 2 | const selectorParser = require( 'postcss-selector-parser' ) 3 | 4 | module.exports = postcss.plugin( 'add-id', options => root => { 5 | const id = options.id 6 | const keyframes = Object.create( null ) 7 | 8 | root.each( function rewriteSelector( node ) { 9 | if ( !node.selector ) { 10 | // handle media queries 11 | if ( node.type === 'atrule' ) { 12 | if ( node.name === 'media' || node.name === 'supports' ) { 13 | node.each( rewriteSelector ) 14 | } else if ( /-?keyframes$/.test( node.name ) ) { 15 | // register keyframes 16 | keyframes[ node.params ] = node.params = node.params + '-' + id 17 | } 18 | } 19 | return 20 | } 21 | node.selector = selectorParser( selectors => { 22 | selectors.each( selector => { 23 | let node = null 24 | 25 | selector.each( n => { 26 | // ">>>" combinator 27 | if ( n.type === 'combinator' && n.value === '>>>' ) { 28 | n.value = ' ' 29 | n.spaces.before = n.spaces.after = '' 30 | return false 31 | } 32 | // /deep/ alias for >>>, since >>> doesn't work in SASS 33 | if ( n.type === 'tag' && n.value === '/deep/' ) { 34 | const prev = n.prev() 35 | if ( prev && prev.type === 'combinator' && prev.value === ' ' ) { 36 | prev.remove() 37 | } 38 | n.remove() 39 | return false 40 | } 41 | if ( n.type !== 'pseudo' && n.type !== 'combinator' ) { 42 | node = n 43 | } 44 | } ) 45 | 46 | if ( node ) { 47 | node.spaces.after = '' 48 | } else { 49 | // For deep selectors & standalone pseudo selectors, 50 | // the attribute selectors are prepended rather than appended. 51 | // So all leading spaces must be eliminated to avoid problems. 52 | selector.first.spaces.before = '' 53 | } 54 | 55 | selector.insertAfter( 56 | node, 57 | selectorParser.attribute( { 58 | attribute: id 59 | } ) 60 | ) 61 | } ) 62 | } ).processSync( node.selector ) 63 | } ) 64 | 65 | // If keyframes are found in this ␊ 116 | ␊ 117 | /***/ }),␊ 118 | ␊ 119 | /***/ 20:␊ 120 | /***/ (function(module, exports) {␊ 121 | ␊ 122 | // removed by extract-text-webpack-plugin␊ 123 | ␊ 124 | /***/ }),␊ 125 | ␊ 126 | /***/ 22:␊ 127 | /***/ (function(module, exports, __webpack_require__) {␊ 128 | ␊ 129 | var __regular_script__, __regular_template__;␊ 130 | __webpack_require__(20)␊ 131 | __regular_script__ = __webpack_require__(19)␊ 132 | __regular_template__ = __webpack_require__(18)␊ 133 | var Regular = __webpack_require__( 21 );␊ 134 | ␊ 135 | var __rs__ = __regular_script__ || {};␊ 136 | if (__rs__.__esModule) __rs__ = __rs__["default"];␊ 137 | if (Regular.__esModule) Regular = Regular["default"];␊ 138 | ␊ 139 | var __Component__, __cps__;␊ 140 | if( typeof __rs__ === "object" ) {␊ 141 | __rs__.template = __regular_template__;␊ 142 | __Component__ = Regular.extend(__rs__);␊ 143 | __cps__ = __rs__.components || __rs__.component;␊ 144 | if( typeof __cps__ === "object" ) {␊ 145 | for( var i in __cps__ ) {␊ 146 | __Component__.component(i, __cps__[ i ]);␊ 147 | }␊ 148 | }␊ 149 | } else if( typeof __rs__ === "function" && ( __rs__.prototype instanceof Regular ) ) {␊ 150 | __rs__.prototype.template = __regular_template__;␊ 151 | __Component__ = __rs__;␊ 152 | }␊ 153 | module.exports = __Component__;␊ 154 | ␊ 155 | /***/ })␊ 156 | ␊ 157 | },[22]);`, 158 | `.css-preprocessor {␊ 159 | color: #eee;␊ 160 | }␊ 161 | `, 162 | ] 163 | 164 | ## deep-selectors 165 | 166 | > Snapshot 1 167 | 168 | [ 169 | `webpackJsonp([0],{␊ 170 | ␊ 171 | /***/ 18:␊ 172 | /***/ (function(module, exports) {␊ 173 | ␊ 174 | module.exports = [{"type":"element","tag":"div","attrs":[{"type":"attribute","name":"class","value":"root"},{"type":"attribute","name":"data-r-2000be7d","value":""}],"children":[{"type":"text","text":"\\n deep selectors\\n"}]}]␊ 175 | ␊ 176 | /***/ }),␊ 177 | ␊ 178 | /***/ 19:␊ 179 | /***/ (function(module, exports, __webpack_require__) {␊ 180 | ␊ 181 | "use strict";␊ 182 | // ␊ 187 | //␊ 188 | // ␊ 190 | //␊ 191 | // ␊ 204 | ␊ 205 | ␊ 206 | /***/ }),␊ 207 | ␊ 208 | /***/ 20:␊ 209 | /***/ (function(module, exports) {␊ 210 | ␊ 211 | // removed by extract-text-webpack-plugin␊ 212 | ␊ 213 | /***/ }),␊ 214 | ␊ 215 | /***/ 22:␊ 216 | /***/ (function(module, exports, __webpack_require__) {␊ 217 | ␊ 218 | var __regular_script__, __regular_template__;␊ 219 | __webpack_require__(20)␊ 220 | __regular_script__ = __webpack_require__(19)␊ 221 | __regular_template__ = __webpack_require__(18)␊ 222 | var Regular = __webpack_require__( 21 );␊ 223 | ␊ 224 | var __rs__ = __regular_script__ || {};␊ 225 | if (__rs__.__esModule) __rs__ = __rs__["default"];␊ 226 | if (Regular.__esModule) Regular = Regular["default"];␊ 227 | ␊ 228 | var __Component__, __cps__;␊ 229 | if( typeof __rs__ === "object" ) {␊ 230 | __rs__.template = __regular_template__;␊ 231 | __Component__ = Regular.extend(__rs__);␊ 232 | __cps__ = __rs__.components || __rs__.component;␊ 233 | if( typeof __cps__ === "object" ) {␊ 234 | for( var i in __cps__ ) {␊ 235 | __Component__.component(i, __cps__[ i ]);␊ 236 | }␊ 237 | }␊ 238 | } else if( typeof __rs__ === "function" && ( __rs__.prototype instanceof Regular ) ) {␊ 239 | __rs__.prototype.template = __regular_template__;␊ 240 | __Component__ = __rs__;␊ 241 | }␊ 242 | module.exports = __Component__;␊ 243 | ␊ 244 | /***/ })␊ 245 | ␊ 246 | },[22]);`, 247 | `␊ 248 | ␊ 249 | ␊ 250 | ␊ 251 | ␊ 252 | ␊ 253 | ␊ 254 | ␊ 255 | ␊ 256 | ␊ 257 | .root[data-r-2000be7d] {␊ 258 | color: red;␊ 259 | }␊ 260 | ␊ 261 | .root .child[data-r-2000be7d] {␊ 262 | color: yellow;␊ 263 | }␊ 264 | ␊ 265 | .root[data-r-2000be7d] .child {␊ 266 | color: blue;␊ 267 | }␊ 268 | `, 269 | ] 270 | 271 | ## multiple-css 272 | 273 | > Snapshot 1 274 | 275 | [ 276 | `webpackJsonp([0],{␊ 277 | ␊ 278 | /***/ 18:␊ 279 | /***/ (function(module, exports) {␊ 280 | ␊ 281 | module.exports = [{"type":"element","tag":"div","attrs":[{"type":"attribute","name":"class","value":"foo"}],"children":[{"type":"text","text":"foo"}]}]␊ 282 | ␊ 283 | /***/ }),␊ 284 | ␊ 285 | /***/ 19:␊ 286 | /***/ (function(module, exports, __webpack_require__) {␊ 287 | ␊ 288 | "use strict";␊ 289 | ␊ 290 | ␊ 291 | Object.defineProperty(exports, "__esModule", {␊ 292 | value: true␊ 293 | });␊ 294 | // ␊ 297 | //␊ 298 | // ␊ 303 | //␊ 304 | // ␊ 309 | //␊ 310 | // ␊ 315 | ␊ 316 | /***/ }),␊ 317 | ␊ 318 | /***/ 20:␊ 319 | /***/ (function(module, exports) {␊ 320 | ␊ 321 | // removed by extract-text-webpack-plugin␊ 322 | ␊ 323 | /***/ }),␊ 324 | ␊ 325 | /***/ 21:␊ 326 | /***/ (function(module, exports) {␊ 327 | ␊ 328 | // removed by extract-text-webpack-plugin␊ 329 | ␊ 330 | /***/ }),␊ 331 | ␊ 332 | /***/ 23:␊ 333 | /***/ (function(module, exports, __webpack_require__) {␊ 334 | ␊ 335 | var __regular_script__, __regular_template__;␊ 336 | __webpack_require__(20)␊ 337 | __webpack_require__(21)␊ 338 | __regular_script__ = __webpack_require__(19)␊ 339 | __regular_template__ = __webpack_require__(18)␊ 340 | var Regular = __webpack_require__( 22 );␊ 341 | ␊ 342 | var __rs__ = __regular_script__ || {};␊ 343 | if (__rs__.__esModule) __rs__ = __rs__["default"];␊ 344 | if (Regular.__esModule) Regular = Regular["default"];␊ 345 | ␊ 346 | var __Component__, __cps__;␊ 347 | if( typeof __rs__ === "object" ) {␊ 348 | __rs__.template = __regular_template__;␊ 349 | __Component__ = Regular.extend(__rs__);␊ 350 | __cps__ = __rs__.components || __rs__.component;␊ 351 | if( typeof __cps__ === "object" ) {␊ 352 | for( var i in __cps__ ) {␊ 353 | __Component__.component(i, __cps__[ i ]);␊ 354 | }␊ 355 | }␊ 356 | } else if( typeof __rs__ === "function" && ( __rs__.prototype instanceof Regular ) ) {␊ 357 | __rs__.prototype.template = __regular_template__;␊ 358 | __Component__ = __rs__;␊ 359 | }␊ 360 | module.exports = __Component__;␊ 361 | ␊ 362 | /***/ })␊ 363 | ␊ 364 | },[23]);`, 365 | `␊ 366 | ␊ 367 | ␊ 368 | ␊ 369 | ␊ 370 | ␊ 371 | ␊ 372 | ␊ 373 | ␊ 374 | ␊ 375 | ␊ 376 | .multiple-css1 {␊ 377 | background-color: #000;␊ 378 | }␊ 379 | ␊ 380 | ␊ 381 | ␊ 382 | ␊ 383 | ␊ 384 | ␊ 385 | ␊ 386 | ␊ 387 | ␊ 388 | ␊ 389 | ␊ 390 | ␊ 391 | ␊ 392 | ␊ 393 | ␊ 394 | ␊ 395 | ␊ 396 | .multiple-css2 {␊ 397 | background-color: #fff;␊ 398 | }␊ 399 | `, 400 | ] 401 | 402 | ## preserve-whitespace 403 | 404 | > Snapshot 1 405 | 406 | [ 407 | `webpackJsonp([0],{␊ 408 | ␊ 409 | /***/ 18:␊ 410 | /***/ (function(module, exports) {␊ 411 | ␊ 412 | module.exports = [{"type":"element","tag":"div","attrs":[{"type":"attribute","name":"class","value":"foo"},{"type":"attribute","name":"on-click","value":{"type":"expression","body":"c.onClick(c._sg_('$event', d, e))","constant":false,"setbody":false}}],"children":[{"type":"text","text":"foo"}]},{"type":"text","text":"\\n\\n\\t\\t"},{"type":"if","test":{"type":"expression","body":"c._sg_('foo', d, e)","constant":false,"setbody":"c._ss_('foo',p_,d, '=', 1)"},"consequent":[{"type":"text","text":" bar\\n\\t\\t "}],"alternate":[]},{"type":"text","text":"\\n\\n"},{"type":"list","sequence":{"type":"expression","body":"c._sg_('items', d, e)","constant":false,"setbody":"c._ss_('items',p_,d, '=', 1)"},"alternate":[],"variable":"item","body":[{"type":"text","text":"\\n\\t"},{"type":"element","tag":"div","attrs":[],"children":[{"type":"text","text":"\\n\\t\\t"},{"type":"element","tag":"span","attrs":[],"children":[{"type":"text","text":"\\n\\t\\t\\t"},{"type":"element","tag":"i","attrs":[],"children":[{"type":"text","text":" "},{"type":"expression","body":"c._sg_('item', d, e)","constant":false,"setbody":"c._ss_('item',p_,d, '=', 1)"},{"type":"text","text":" "}]},{"type":"text","text":"\\n\\t\\t"}]},{"type":"text","text":"\\n\\t"}]},{"type":"text","text":"\\n"}]},{"type":"text","text":"\\n\\n\\t"},{"type":"element","tag":"pre","attrs":[],"children":[{"type":"text","text":"\\n\\n\\t\\tsome text\\n\\t\\t"},{"type":"element","tag":"span","attrs":[],"children":[{"type":"text","text":"a b"}]},{"type":"text","text":"\\n\\n\\t"}]}]␊ 413 | ␊ 414 | /***/ }),␊ 415 | ␊ 416 | /***/ 19:␊ 417 | /***/ (function(module, exports, __webpack_require__) {␊ 418 | ␊ 419 | "use strict";␊ 420 | ␊ 421 | ␊ 422 | Object.defineProperty(exports, "__esModule", {␊ 423 | value: true␊ 424 | });␊ 425 | // ␊ 446 | //␊ 447 | // ␊ 452 | ␊ 453 | /***/ }),␊ 454 | ␊ 455 | /***/ 21:␊ 456 | /***/ (function(module, exports, __webpack_require__) {␊ 457 | ␊ 458 | var __regular_script__, __regular_template__;␊ 459 | __regular_script__ = __webpack_require__(19)␊ 460 | __regular_template__ = __webpack_require__(18)␊ 461 | var Regular = __webpack_require__( 20 );␊ 462 | ␊ 463 | var __rs__ = __regular_script__ || {};␊ 464 | if (__rs__.__esModule) __rs__ = __rs__["default"];␊ 465 | if (Regular.__esModule) Regular = Regular["default"];␊ 466 | ␊ 467 | var __Component__, __cps__;␊ 468 | if( typeof __rs__ === "object" ) {␊ 469 | __rs__.template = __regular_template__;␊ 470 | __Component__ = Regular.extend(__rs__);␊ 471 | __cps__ = __rs__.components || __rs__.component;␊ 472 | if( typeof __cps__ === "object" ) {␊ 473 | for( var i in __cps__ ) {␊ 474 | __Component__.component(i, __cps__[ i ]);␊ 475 | }␊ 476 | }␊ 477 | } else if( typeof __rs__ === "function" && ( __rs__.prototype instanceof Regular ) ) {␊ 478 | __rs__.prototype.template = __regular_template__;␊ 479 | __Component__ = __rs__;␊ 480 | }␊ 481 | module.exports = __Component__;␊ 482 | ␊ 483 | /***/ })␊ 484 | ␊ 485 | },[21]);`, 486 | '!! file not exist !!', 487 | ] 488 | 489 | ## scoped-css 490 | 491 | > Snapshot 1 492 | 493 | [ 494 | `webpackJsonp([0],{␊ 495 | ␊ 496 | /***/ 18:␊ 497 | /***/ (function(module, exports) {␊ 498 | ␊ 499 | module.exports = [{"type":"element","tag":"div","attrs":[{"type":"attribute","name":"class","value":"foo"},{"type":"attribute","name":"data-r-0b8ac020","value":""}],"children":[{"type":"text","text":"foo"}]}]␊ 500 | ␊ 501 | /***/ }),␊ 502 | ␊ 503 | /***/ 19:␊ 504 | /***/ (function(module, exports, __webpack_require__) {␊ 505 | ␊ 506 | "use strict";␊ 507 | ␊ 508 | ␊ 509 | Object.defineProperty(exports, "__esModule", {␊ 510 | value: true␊ 511 | });␊ 512 | // ␊ 515 | //␊ 516 | // ␊ 521 | //␊ 522 | // ␊ 527 | ␊ 528 | /***/ }),␊ 529 | ␊ 530 | /***/ 20:␊ 531 | /***/ (function(module, exports) {␊ 532 | ␊ 533 | // removed by extract-text-webpack-plugin␊ 534 | ␊ 535 | /***/ }),␊ 536 | ␊ 537 | /***/ 22:␊ 538 | /***/ (function(module, exports, __webpack_require__) {␊ 539 | ␊ 540 | var __regular_script__, __regular_template__;␊ 541 | __webpack_require__(20)␊ 542 | __regular_script__ = __webpack_require__(19)␊ 543 | __regular_template__ = __webpack_require__(18)␊ 544 | var Regular = __webpack_require__( 21 );␊ 545 | ␊ 546 | var __rs__ = __regular_script__ || {};␊ 547 | if (__rs__.__esModule) __rs__ = __rs__["default"];␊ 548 | if (Regular.__esModule) Regular = Regular["default"];␊ 549 | ␊ 550 | var __Component__, __cps__;␊ 551 | if( typeof __rs__ === "object" ) {␊ 552 | __rs__.template = __regular_template__;␊ 553 | __Component__ = Regular.extend(__rs__);␊ 554 | __cps__ = __rs__.components || __rs__.component;␊ 555 | if( typeof __cps__ === "object" ) {␊ 556 | for( var i in __cps__ ) {␊ 557 | __Component__.component(i, __cps__[ i ]);␊ 558 | }␊ 559 | }␊ 560 | } else if( typeof __rs__ === "function" && ( __rs__.prototype instanceof Regular ) ) {␊ 561 | __rs__.prototype.template = __regular_template__;␊ 562 | __Component__ = __rs__;␊ 563 | }␊ 564 | module.exports = __Component__;␊ 565 | ␊ 566 | /***/ })␊ 567 | ␊ 568 | },[22]);`, 569 | `␊ 570 | ␊ 571 | ␊ 572 | ␊ 573 | ␊ 574 | ␊ 575 | ␊ 576 | ␊ 577 | ␊ 578 | ␊ 579 | ␊ 580 | .scoped-css[data-r-0b8ac020] {␊ 581 | background-color: #fff;␊ 582 | }␊ 583 | `, 584 | ] 585 | --------------------------------------------------------------------------------