-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c11ae7
commit 9f094c7
Showing
11 changed files
with
99 additions
and
85 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
dist | ||
node_modules | ||
/index.* | ||
package-lock.json | ||
*.log* | ||
*.result.css | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,28 @@ | ||
import babel from 'rollup-plugin-babel'; | ||
import pkg from './package.json' | ||
|
||
export default { | ||
input: 'src/index.js', | ||
output: [ | ||
{ file: 'index.cjs.js', format: 'cjs', sourcemap: true, strict: false }, | ||
{ file: 'index.esm.mjs', format: 'esm', sourcemap: true, strict: false } | ||
], | ||
plugins: [ | ||
patchBabelPluginSyntaxImportMeta(), | ||
babel({ | ||
plugins: [ | ||
['@babel/plugin-syntax-import-meta'] | ||
], | ||
presets: [ | ||
['@babel/preset-env', { modules: false, targets: { node: 8 } }] | ||
] | ||
}) | ||
] | ||
}; | ||
...pkg.rollup, | ||
plugins: [patchBabelPluginSyntaxImportMeta(), ...pkg.rollup.plugins.map(plugin => require(plugin)())], | ||
onwarn(warning, warn) { | ||
if (warning.code !== 'UNRESOLVED_IMPORT') warn(warning) | ||
} | ||
} | ||
|
||
function patchBabelPluginSyntaxImportMeta () { | ||
return { | ||
name: 'patch-babel-plugin-syntax-import-meta', | ||
renderChunk (code, chunk, options) { | ||
const currentUrlMatch = /var url = require\('url'\);([\W\w]+)const currentURL[^\n]+\nconst currentFilename[^\n]+/; | ||
const currentUrlMatch = /var url = require\('url'\);([\W\w]+)const currentURL[^\n]+\n(const currentFilename)[^\n]+/ | ||
|
||
const shouldTransformImportMeta = options.format === 'cjs' && currentUrlMatch.test(code); | ||
const shouldTransformImportMeta = options.format === 'cjs' && currentUrlMatch.test(code) | ||
|
||
if (shouldTransformImportMeta) { | ||
const updatedCode = code.replace(currentUrlMatch, '$1const currentFilename = __filename;'); | ||
const updatedCode = code.replace(currentUrlMatch, '$1$2 = __filename;') | ||
|
||
return updatedCode; | ||
return updatedCode | ||
} | ||
|
||
return null; | ||
return null | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ os: | |
- osx | ||
|
||
node_js: | ||
- 8 | ||
- 10 | ||
|
||
install: | ||
- npm install --ignore-scripts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,83 @@ | ||
{ | ||
"name": "postcss-normalize", | ||
"version": "8.0.1", | ||
"version": "9.0.0", | ||
"description": "Use the parts of normalize.css or sanitize.css you need from your browserslist", | ||
"author": "Jonathan Neal <[email protected]>", | ||
"license": "CC0-1.0", | ||
"repository": "csstools/postcss-normalize", | ||
"homepage": "https://github.com/csstools/postcss-normalize#readme", | ||
"bugs": "https://github.com/csstools/postcss-normalize/issues", | ||
"main": "index.cjs.js", | ||
"module": "index.esm.mjs", | ||
"main": "dist/index.cjs.js", | ||
"module": "dist/index.esm.mjs", | ||
"files": [ | ||
"index.cjs.js", | ||
"index.cjs.js.map", | ||
"index.esm.mjs", | ||
"index.esm.mjs.map" | ||
"dist" | ||
], | ||
"scripts": { | ||
"build": "rollup --config .rollup.js --silent", | ||
"prepublishOnly": "npm test", | ||
"pretest:tape": "npm run build", | ||
"test": "npm run test:js && npm run test:tape", | ||
"test:js": "eslint src/{*,**/*}.js --cache --ignore-path .gitignore --quiet", | ||
"test:tape": "postcss-tape" | ||
"build": "npx rollup -c .rollup.js", | ||
"build:watch": "npx rollup -c .rollup.js --watch", | ||
"lint": "npx eslint --cache src", | ||
"lint:fix": "npx eslint --cache --fix", | ||
"pretest": "npm install && npm run build", | ||
"test": "npm run lint && npm run tape", | ||
"tape": "npx postcss-tape" | ||
}, | ||
"engines": { | ||
"node": ">=8.0.0" | ||
"node": ">=10.0.0" | ||
}, | ||
"dependencies": { | ||
"@csstools/normalize.css": "^10.1.0", | ||
"browserslist": "^4.6.2", | ||
"postcss": "^7.0.17", | ||
"@csstools/normalize.css": "*", | ||
"postcss": "^7.0.27", | ||
"postcss-browser-comments": "^3.0.0", | ||
"sanitize.css": "^10.0.0" | ||
"sanitize.css": "*" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.4.5", | ||
"@babel/plugin-syntax-import-meta": "^7.2.0", | ||
"@babel/preset-env": "^7.4.5", | ||
"babel-eslint": "^10.0.1", | ||
"eslint": "^5.16.0", | ||
"@babel/core": "^7.9.0", | ||
"@babel/plugin-syntax-import-meta": "^7.8.3", | ||
"@babel/preset-env": "^7.9.5", | ||
"babel-eslint": "^10.1.0", | ||
"eslint": "^6.8.0", | ||
"postcss-import": "^12.0.1", | ||
"postcss-tape": "^5.0.0", | ||
"postcss-tape": "^5.0.2", | ||
"pre-commit": "^1.2.2", | ||
"rollup": "^1.14.6", | ||
"rollup-plugin-babel": "^4.3.2" | ||
"rollup": "^2.6.0", | ||
"rollup-plugin-babel": "^4.4.0" | ||
}, | ||
"babel": { | ||
"plugins": [ | ||
"@babel/plugin-syntax-import-meta" | ||
], | ||
"presets": [ | ||
[ | ||
"@babel/env", | ||
{ | ||
"targets": "maintained node versions" | ||
} | ||
] | ||
] | ||
}, | ||
"eslintConfig": { | ||
"env": { | ||
"browser": true, | ||
"es6": true, | ||
"node": true | ||
}, | ||
"extends": "eslint:recommended", | ||
"parser": "babel-eslint", | ||
"parserOptions": { | ||
"ecmaVersion": 2018, | ||
"impliedStrict": true, | ||
"sourceType": "module" | ||
}, | ||
"root": true | ||
"parser": "babel-eslint" | ||
}, | ||
"rollup": { | ||
"input": "src/index.js", | ||
"plugins": [ | ||
"rollup-plugin-babel" | ||
], | ||
"output": [ | ||
{ | ||
"file": "dist/index.cjs.js", | ||
"format": "cjs" | ||
}, | ||
{ | ||
"file": "dist/index.esm.js", | ||
"format": "esm" | ||
} | ||
] | ||
}, | ||
"keywords": [ | ||
"postcss", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.