Skip to content

fix: patch postcss 7 and bundle it in the published npm package #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules
dist
coverage
.idea
third_party
14 changes: 11 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@
"typings": "dist/index.d.ts",
"files": [
"dist",
"lib"
"lib",
"third_party"
],
"scripts": {
"lint": "prettier --write \"{lib,test}/**/*.ts\"",
"pretest": "yarn clean && yarn patch-postcss",
"test": "prettier --list-different \"{lib,test}/**/*.ts\" && jest --coverage",
"build": "rm -rf dist && tsc",
"clean": "rm -rf dist third_party",
"patch-postcss": "patch-package && mkdir -p third_party/postcss && cp -R node_modules/postcss third_party/",
"prebuild": "yarn clean && yarn patch-postcss",
"build": "ttsc",
"prepublishOnly": "yarn build && conventional-changelog -p angular -r 2 -i CHANGELOG.md -s"
},
"gitHooks": {
Expand Down Expand Up @@ -46,11 +51,15 @@
"jest": "^24.0.0",
"less": "^3.9.0",
"lint-staged": "^8.1.1",
"patch-package": "^6.4.7",
"postcss": "^7.0.35",
"pug": "^2.0.3",
"sass": "^1.17.3",
"stylus": "^0.54.5",
"ts-jest": "^24.0.0",
"ttypescript": "^1.5.12",
"typescript": "^3.3.0",
"typescript-transform-paths": "^2.2.4",
"vue": "^2.6.6",
"vue-template-compiler": "^2.6.6",
"yorkie": "^2.0.0"
Expand All @@ -60,7 +69,6 @@
"hash-sum": "^1.0.2",
"lru-cache": "^4.1.2",
"merge-source-map": "^1.1.0",
"postcss": "^7.0.14",
"postcss-selector-parser": "^6.0.2",
"source-map": "~0.6.1",
"vue-template-es2015-compiler": "^1.9.0"
Expand Down
18 changes: 18 additions & 0 deletions patches/postcss+7.0.35.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/node_modules/postcss/lib/previous-map.js b/node_modules/postcss/lib/previous-map.js
index 49f99ad..ef0066d 100644
--- a/node_modules/postcss/lib/previous-map.js
+++ b/node_modules/postcss/lib/previous-map.js
@@ -86,11 +86,11 @@ var PreviousMap = /*#__PURE__*/function () {
};

_proto.getAnnotationURL = function getAnnotationURL(sourceMapString) {
- return sourceMapString.match(/\/\*\s*# sourceMappingURL=(.*)\s*\*\//)[1].trim();
+ return sourceMapString.match(/\/\*\s*# sourceMappingURL=(.*)\*\//)[1].trim()
};

_proto.loadAnnotation = function loadAnnotation(css) {
- var annotations = css.match(/\/\*\s*# sourceMappingURL=(.*)\s*\*\//mg);
+ var annotations = css.match(/\/\*\s*# sourceMappingURL=.*\*\//gm);

if (annotations && annotations.length > 0) {
// Locate the last sourceMappingURL to avoid picking up
7 changes: 7 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
"lib": [
"es6",
"es7"
],
"paths": {
"postcss": ["third_party/postcss"]
},
"plugins": [
{ "transform": "typescript-transform-paths" },
{ "transform": "typescript-transform-paths", "afterDeclarations": true }
]
},
"include": [
Expand Down
Loading