-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2791 from XiaoMi/hotfix/style-inject/2788
fix(style-inject): 修复node环境下打包style
- Loading branch information
Showing
12 changed files
with
189 additions
and
18 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,86 @@ | ||
--- | ||
"@hi-ui/env": patch | ||
"@hi-ui/icons": patch | ||
"@hi-ui/alert": patch | ||
"@hi-ui/anchor": patch | ||
"@hi-ui/avatar": patch | ||
"@hi-ui/back-top": patch | ||
"@hi-ui/badge": patch | ||
"@hi-ui/breadcrumb": patch | ||
"@hi-ui/button": patch | ||
"@hi-ui/card": patch | ||
"@hi-ui/carousel": patch | ||
"@hi-ui/cascader": patch | ||
"@hi-ui/check-cascader": patch | ||
"@hi-ui/check-select": patch | ||
"@hi-ui/check-tree-select": patch | ||
"@hi-ui/checkbox": patch | ||
"@hi-ui/collapse": patch | ||
"@hi-ui/counter": patch | ||
"@hi-ui/date-picker": patch | ||
"@hi-ui/descriptions": patch | ||
"@hi-ui/drawer": patch | ||
"@hi-ui/dropdown": patch | ||
"@hi-ui/ellipsis-tooltip": patch | ||
"@hi-ui/empty-state": patch | ||
"@hi-ui/file-select": patch | ||
"@hi-ui/filter": patch | ||
"@hi-ui/form": patch | ||
"@hi-ui/grid": patch | ||
"@hi-ui/highlighter": patch | ||
"@hi-ui/hiui": patch | ||
"@hi-ui/icon-button": patch | ||
"@hi-ui/input": patch | ||
"@hi-ui/input-group": patch | ||
"@hi-ui/list": patch | ||
"@hi-ui/loading": patch | ||
"@hi-ui/locale-context": patch | ||
"@hi-ui/menu": patch | ||
"@hi-ui/message": patch | ||
"@hi-ui/modal": patch | ||
"@hi-ui/notification": patch | ||
"@hi-ui/number-input": patch | ||
"@hi-ui/pagination": patch | ||
"@hi-ui/picker": patch | ||
"@hi-ui/pop-confirm": patch | ||
"@hi-ui/popover": patch | ||
"@hi-ui/popper": patch | ||
"@hi-ui/portal": patch | ||
"@hi-ui/preview": patch | ||
"@hi-ui/progress": patch | ||
"@hi-ui/provider": patch | ||
"@hi-ui/radio": patch | ||
"@hi-ui/rating": patch | ||
"@hi-ui/resize-box": patch | ||
"@hi-ui/result": patch | ||
"@hi-ui/scrollbar": patch | ||
"@hi-ui/search": patch | ||
"@hi-ui/select": patch | ||
"@hi-ui/slider": patch | ||
"@hi-ui/space": patch | ||
"@hi-ui/spinner": patch | ||
"@hi-ui/stepper": patch | ||
"@hi-ui/svg-icon": patch | ||
"@hi-ui/switch": patch | ||
"@hi-ui/table": patch | ||
"@hi-ui/tabs": patch | ||
"@hi-ui/tag": patch | ||
"@hi-ui/tag-input": patch | ||
"@hi-ui/textarea": patch | ||
"@hi-ui/time-picker": patch | ||
"@hi-ui/timeline": patch | ||
"@hi-ui/toast": patch | ||
"@hi-ui/tooltip": patch | ||
"@hi-ui/transfer": patch | ||
"@hi-ui/tree": patch | ||
"@hi-ui/tree-select": patch | ||
"@hi-ui/upload": patch | ||
"@hi-ui/virtual-list": patch | ||
"@hi-ui/watermark": patch | ||
"@hi-ui/zen-mode": patch | ||
"@hi-ui/array-utils": patch | ||
"@hi-ui/classname": patch | ||
"@hi-ui/container": patch | ||
--- | ||
|
||
build: style-inject(node 环境下有问题) 替换为 @hi-ui/style-inject |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# `@hi-ui/style-inject` | ||
|
||
> TODO: description | ||
## Usage | ||
|
||
``` | ||
const styleInject = require('@hi-ui/style-inject'); | ||
// TODO: DEMONSTRATE API | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const styleInject = require('../src') | ||
|
||
describe('@hi-ui/style-inject', () => { | ||
it('needs tests', () => {}) | ||
}) |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('../../../jest.config') |
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"name": "@hi-ui/styleinject", | ||
"version": "4.0.0", | ||
"description": "A sub-package for @hi-ui/utils.", | ||
"keywords": [], | ||
"author": "HiUI <[email protected]>", | ||
"homepage": "https://github.com/XiaoMi/hiui/tree/master/packages/utils/style-inject#readme", | ||
"license": "MIT", | ||
"directories": { | ||
"lib": "lib", | ||
"test": "__tests__" | ||
}, | ||
"files": [ | ||
"lib" | ||
], | ||
"main": "lib/cjs/index.js", | ||
"module": "lib/esm/index.js", | ||
"types": "lib/types/index.d.ts", | ||
"typings": "lib/types/index.d.ts", | ||
"exports": { | ||
".": { | ||
"require": "./lib/cjs/index.js", | ||
"default": "./lib/esm/index.js" | ||
} | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/XiaoMi/hiui.git" | ||
}, | ||
"scripts": { | ||
"test": "jest", | ||
"clean": "rimraf lib", | ||
"prebuild": "yarn clean", | ||
"build:esm": "hi-build ./src/index.ts --format esm -d ./lib/esm", | ||
"build:cjs": "hi-build ./src/index.ts --format cjs -d ./lib/cjs", | ||
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir lib/types", | ||
"build": "concurrently yarn:build:*" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/XiaoMi/hiui/issues" | ||
}, | ||
"devDependencies": { | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const isBrowser = !!( | ||
typeof window !== 'undefined' && | ||
window.document && | ||
window.document.createElement | ||
) | ||
|
||
/** | ||
* TODO: What is styleInject | ||
*/ | ||
const styleInject = (css: string) => { | ||
if (!css || !isBrowser) return | ||
|
||
const head = document.head || document.getElementsByTagName('head')[0] | ||
const style = document.createElement('style') | ||
|
||
head.appendChild(style) | ||
style.appendChild(document.createTextNode(css)) | ||
} | ||
|
||
export default styleInject | ||
export { styleInject } |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": "../../../tsconfig.json", | ||
"include": ["./src"] | ||
} |
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,6 +1,6 @@ | ||
{ | ||
"name": "@hi-ui/hi-build", | ||
"version": "4.1.1", | ||
"version": "4.1.2", | ||
"description": "Now I’m the model of a modern major general / The venerated Virginian veteran whose men are all / Lining up, to put me up on a pedestal / Writin’ letters to relatives / Embellishin’ my elegance and eloquence / But the elephant is in the room / The truth is in ya face when ya hear the British cannons go / BOOM", | ||
"keywords": [], | ||
"author": "Flcwl <[email protected]>", | ||
|
@@ -64,8 +64,5 @@ | |
}, | ||
"peerDependencies": { | ||
"typescript": "^4.6.2" | ||
}, | ||
"devDependencies": { | ||
"@hi-ui/hi-build": "^4.1.1" | ||
} | ||
} |
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 |
---|---|---|
|
@@ -2680,10 +2680,10 @@ | |
minimatch "^3.0.4" | ||
strip-json-comments "^3.1.1" | ||
|
||
"@hi-ui/[email protected].1": | ||
version "4.1.1" | ||
resolved "https://registry.npmmirror.com/@hi-ui/hi-build/-/hi-build-4.1.1.tgz#1b586ca597c358ebb9c974433e488f02b61ef7bf" | ||
integrity sha512-cXMJVsdhTjZizcSvH8fl9w2M5zUdBFUO/cEobzUTK2aKY4ia+ZVQ8OPSKbR5vbYn2d+j/7YwdXVg9novdnu9uw== | ||
"@hi-ui/[email protected].2": | ||
version "4.1.2" | ||
resolved "https://registry.npmjs.org/@hi-ui/hi-build/-/hi-build-4.1.2.tgz#0125cac22a7b53a92146a405fe0eb3c33da08a0e" | ||
integrity sha512-el7cyqRt6CRUAe6X/RzWImAppdDJtnIIzlxol1Oc1AwIXrwPfYzSjtVsibE5IeuATRhlhzEVswem9hngqn5jJQ== | ||
dependencies: | ||
"@babel/core" "^7.17.8" | ||
"@babel/plugin-transform-runtime" "^7.17.0" | ||
|
@@ -2715,6 +2715,11 @@ | |
rollup-plugin-terser "^7.0.2" | ||
rollup-plugin-visualizer "^5.9.2" | ||
|
||
"@hi-ui/style-inject@^4.0.0": | ||
version "4.0.0" | ||
resolved "https://registry.npmjs.org/@hi-ui/style-inject/-/style-inject-4.0.0.tgz#62e3ecff2654e5149cd310db8ba8fbe078020bd3" | ||
integrity sha512-f/WDX/a10y08gYY9UaSwX0V0CbLDxlzf/6UrwD8fZIyIPdlyrR3Jld8X18vz5zywxPTpOPwBQLf9PYZ9YdFMPA== | ||
|
||
"@humanwhocodes/config-array@^0.5.0": | ||
version "0.5.0" | ||
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.5.0.tgz#1407967d4c6eecd7388f83acf1eaf4d0c6e58ef9" | ||
|
@@ -10601,11 +10606,6 @@ init-package-json@^2.0.2: | |
validate-npm-package-license "^3.0.4" | ||
validate-npm-package-name "^3.0.0" | ||
|
||
inject-head-style@^1.0.0: | ||
version "1.0.0" | ||
resolved "https://registry.npmmirror.com/inject-head-style/-/inject-head-style-1.0.0.tgz#159f843900d3f473fb691c67fce52b5d088f5f68" | ||
integrity sha512-J6eyVFIiY3SgvguiUx/XXBZWTIxMryhiSosH2fan5+FhfA4LlNJkybUcYsINInM+zvsBmcrIHVWJxvi4lvjwqA== | ||
|
||
[email protected]: | ||
version "0.1.1" | ||
resolved "https://registry.npm.taobao.org/inline-style-parser/download/inline-style-parser-0.1.1.tgz#ec8a3b429274e9c0a1f1c4ffa9453a7fef72cea1" | ||
|