create-emotion-server
Advanced tools
Comparing version 10.0.0-really-unsafe-please-do-not-use.2 to 10.0.0
{ | ||
"name": "create-emotion-server", | ||
"version": "10.0.0-really-unsafe-please-do-not-use.2", | ||
"version": "10.0.0", | ||
"description": "SSR and style extraction tooling for emotion, The Next Generation of CSS-in-JS.", | ||
"main": "dist/index.cjs.js", | ||
"main": "dist/create-emotion-server.cjs.js", | ||
"types": "types/index.d.ts", | ||
@@ -16,2 +16,3 @@ "files": [ | ||
"dependencies": { | ||
"@emotion/utils": "0.11.1", | ||
"html-tokenize": "^2.0.0", | ||
@@ -22,6 +23,4 @@ "multipipe": "^1.0.2", | ||
"devDependencies": { | ||
"@types/node": "*", | ||
"dtslint": "^0.3.0", | ||
"emotion": "^10.0.0-really-unsafe-please-do-not-use.2", | ||
"react-emotion": "^10.0.0-really-unsafe-please-do-not-use.2" | ||
"@types/node": "^10.11.4", | ||
"dtslint": "^0.3.0" | ||
}, | ||
@@ -44,9 +43,5 @@ "author": "Kye Hohenberger", | ||
}, | ||
"publishConfig": { | ||
"tag": "next" | ||
}, | ||
"browser": { | ||
"./dist/index.cjs.js": "./dist/index.browser.cjs.js" | ||
}, | ||
"gitHead": "0da0de50f6f2c19e46bca7662d1a954d48db1264" | ||
"./dist/create-emotion-server.cjs.js": "./dist/create-emotion-server.browser.cjs.js" | ||
} | ||
} |
@@ -5,8 +5,13 @@ # create-emotion-server | ||
`create-emotion-styled` allows you create various APIs for Server-Side Rendering with instances of emotion. This is **only** needed if you use a custom instance of emotion from `create-emotion` and you want to do Server-Side Rendering. | ||
`create-emotion-server` allows you create various APIs for Server-Side Rendering with instances of emotion. This is **only** needed if you use a custom instance of emotion from `create-emotion` and you want to do Server-Side Rendering. | ||
```jsx | ||
import createEmotionServer from 'create-emotion-server' | ||
import * as emotion from 'my-emotion-instance' | ||
import { cache } from 'my-emotion-instance' | ||
// or | ||
import createCache from '@emotion/cache' | ||
let cache = createCache() | ||
export const { | ||
@@ -16,5 +21,5 @@ extractCritical, | ||
renderStylesToNodeStream | ||
} = createEmotionServer(emotion) | ||
} = createEmotionServer(cache) | ||
``` | ||
[All of emotion's SSR APIs are documented in their own doc.](https://emotion.sh/docs/ssr) |
@@ -7,3 +7,3 @@ // @flow | ||
// reconstruct css/rules/cache to pass | ||
let RGX = new RegExp(`${cache.key}-([a-zA-Z0-9-]+)`, 'gm') | ||
let RGX = new RegExp(`${cache.key}-([a-zA-Z0-9-_]+)`, 'gm') | ||
@@ -10,0 +10,0 @@ let o = { html, ids: [], css: '' } |
@@ -20,3 +20,3 @@ // @flow | ||
const { inserted, key: cssKey, registered } = cache | ||
const regex = new RegExp(`<|${cssKey}-([a-zA-Z0-9-]+)`, 'gm') | ||
const regex = new RegExp(`<|${cssKey}-([a-zA-Z0-9-_]+)`, 'gm') | ||
@@ -66,3 +66,3 @@ const seen = {} | ||
const style = inserted[id] | ||
if (style === true || seen[id]) { | ||
if (style === true || style === undefined || seen[id]) { | ||
continue | ||
@@ -69,0 +69,0 @@ } |
@@ -23,3 +23,3 @@ // @flow | ||
let fragment = data.toString() | ||
let regex = new RegExp(`${cache.key}-([a-zA-Z0-9-]+)`, 'gm') | ||
let regex = new RegExp(`${cache.key}-([a-zA-Z0-9-_]+)`, 'gm') | ||
while ((match = regex.exec(fragment)) !== null) { | ||
@@ -26,0 +26,0 @@ if (match !== null && insed[match[1]] === undefined) { |
@@ -0,12 +1,19 @@ | ||
// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun> | ||
// TypeScript Version: 2.8 | ||
/// <reference types="node" /> | ||
// TypeScript Version: 2.3 | ||
import { EmotionCache } from '@emotion/utils' | ||
import { Emotion } from 'create-emotion'; | ||
export interface EmotionCritical { | ||
html: string | ||
ids: Array<string> | ||
css: string | ||
} | ||
export interface EmotionServer { | ||
extractCritical(html: string): { html: string; ids: string[]; css: string; }; | ||
renderStylesToString(html: string): string; | ||
renderStylesToNodeStream(): NodeJS.ReadWriteStream; | ||
extractCritical(html: string): EmotionCritical | ||
renderStylesToString(html: string): string | ||
renderStylesToNodeStream(): NodeJS.ReadWriteStream | ||
} | ||
export default function createEmotionServer(emotion: Emotion): EmotionServer; | ||
export default function createEmotionServer(cache: EmotionCache): EmotionServer |
{ | ||
"extends": "dtslint/dtslint.json", | ||
"rules": { | ||
"no-relative-import-in-test": false | ||
"array-type": [true, "generic"], | ||
"semicolon": false | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
28602
2
815
0
24
4
1
+ Added@emotion/utils@0.11.1
+ Added@emotion/utils@0.11.1(transitive)