@jk2908/cxx 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/cyrb53.ts +16 -15
- package/src/inject.ts +1 -1
- package/src/next/index.ts +1 -1
package/package.json
CHANGED
package/src/cyrb53.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
// cyrb53 (c) 2018 bryc (github.com/bryc)
|
|
2
2
|
// https://github.com/bryc/code/blob/master/jshash/experimental/cyrb53.js
|
|
3
|
+
|
|
3
4
|
export function cyrb53(str: string, seed = 0) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
let h1 = 0xdeadbeef ^ seed
|
|
6
|
+
let h2 = 0x41c6ce57 ^ seed
|
|
7
|
+
|
|
8
|
+
for (let i = 0, ch: number; i < str.length; i++) {
|
|
9
|
+
ch = str.charCodeAt(i)
|
|
10
|
+
h1 = Math.imul(h1 ^ ch, 2654435761)
|
|
11
|
+
h2 = Math.imul(h2 ^ ch, 1597334677)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507)
|
|
15
|
+
h1 ^= Math.imul(h2 ^ (h2 >>> 13), 3266489909)
|
|
16
|
+
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507)
|
|
17
|
+
h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909)
|
|
12
18
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507)
|
|
16
|
-
h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909)
|
|
17
|
-
|
|
18
|
-
return 4294967296 * (2097151 & h2) + (h1 >>> 0)
|
|
19
|
-
};
|
|
19
|
+
return 4294967296 * (2097151 & h2) + (h1 >>> 0)
|
|
20
|
+
}
|
package/src/inject.ts
CHANGED
|
@@ -29,7 +29,7 @@ export function inject<C extends CustomAtRules = CustomAtRules>(
|
|
|
29
29
|
...DEFAULT_CONFIG.lightningcss,
|
|
30
30
|
...config.lightningcss,
|
|
31
31
|
filename: id,
|
|
32
|
-
code:
|
|
32
|
+
code: new TextEncoder().encode(css),
|
|
33
33
|
})
|
|
34
34
|
|
|
35
35
|
const href = cyrb53([...Object.keys(exports ?? {}), id].join(''))
|
package/src/next/index.ts
CHANGED
|
@@ -18,7 +18,7 @@ export function withCxx(nextConfig: NextConfig = {}, config: Config = {}) {
|
|
|
18
18
|
const turboConfig = {
|
|
19
19
|
...nextConfig.turbo,
|
|
20
20
|
rules: {
|
|
21
|
-
...
|
|
21
|
+
...nextConfig.turbo?.rules,
|
|
22
22
|
[TURBO_GLOB]: {
|
|
23
23
|
loaders: [
|
|
24
24
|
...(nextConfig.turbo?.rules?.[TURBO_GLOB]?.loaders ?? []),
|