@jk2908/cxx 0.1.2 → 0.1.4
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/dist/index.d.ts +1 -7
- package/dist/index.js +1 -57
- package/dist/inject/index.d.ts +8 -0
- package/dist/inject/index.js +58 -0
- package/dist/next/cxx-loader.d.ts +1 -1
- package/dist/next/cxx-loader.js +1 -1
- package/dist/next/index.d.ts +1 -1
- package/dist/vite-plugin-cxx/index.d.ts +1 -1
- package/dist/vite-plugin-cxx/index.js +1 -1
- package/package.json +87 -83
- package/src/index.ts +1 -56
- package/src/inject.ts +54 -0
- package/src/next/cxx-loader.js +1 -1
- package/src/next/index.ts +1 -1
- package/src/vite-plugin-cxx/index.ts +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { CustomAtRules, TransformOptions } from 'lightningcss';
|
|
2
|
-
|
|
3
1
|
declare module 'react' {
|
|
4
2
|
interface StyleHTMLAttributes<T> extends React.HTMLAttributes<T> {
|
|
5
3
|
href?: string;
|
|
@@ -7,9 +5,5 @@ declare module 'react' {
|
|
|
7
5
|
}
|
|
8
6
|
}
|
|
9
7
|
declare const cxx: (_: TemplateStringsArray) => readonly ["", Record<string, string>, ""];
|
|
10
|
-
type Config<C extends CustomAtRules = CustomAtRules> = {
|
|
11
|
-
lightningcss?: Partial<TransformOptions<C>>;
|
|
12
|
-
};
|
|
13
|
-
declare function inject<C extends CustomAtRules = CustomAtRules>(source: string, id: string, config?: Config<C>): string;
|
|
14
8
|
|
|
15
|
-
export {
|
|
9
|
+
export { cxx };
|
package/dist/index.js
CHANGED
|
@@ -1,63 +1,7 @@
|
|
|
1
|
-
import { transform } from 'lightningcss';
|
|
2
|
-
|
|
3
|
-
// cyrb53 (c) 2018 bryc (github.com/bryc)
|
|
4
|
-
// https://github.com/bryc/code/blob/master/jshash/experimental/cyrb53.js
|
|
5
|
-
function cyrb53(str, seed = 0) {
|
|
6
|
-
let h1 = 0xdeadbeef ^ seed;
|
|
7
|
-
let h2 = 0x41c6ce57 ^ seed;
|
|
8
|
-
for(let i = 0, ch; 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
|
-
h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507);
|
|
14
|
-
h1 ^= Math.imul(h2 ^ h2 >>> 13, 3266489909);
|
|
15
|
-
h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507);
|
|
16
|
-
h2 ^= Math.imul(h1 ^ h1 >>> 13, 3266489909);
|
|
17
|
-
return 4294967296 * (2097151 & h2) + (h1 >>> 0);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
1
|
const cxx = (_)=>[
|
|
21
2
|
'',
|
|
22
3
|
{},
|
|
23
4
|
''
|
|
24
5
|
];
|
|
25
|
-
const varMatch = /(?:const|var|let)\s*\[(\w+|)\s*,?\s*(\w+|)\s*,?\s*(\w+|)\s*\]\s*=\s*cxx\s*`([\s\S]*?)`/gm;
|
|
26
|
-
const DEFAULT_CONFIG = {
|
|
27
|
-
lightningcss: {
|
|
28
|
-
minify: true,
|
|
29
|
-
cssModules: true
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
function inject(source, id, config = {}) {
|
|
33
|
-
try {
|
|
34
|
-
const tmpl = source.replace(varMatch, (_, ...args)=>{
|
|
35
|
-
const [varOne, varTwo, varThree, css] = args;
|
|
36
|
-
const { code, exports } = transform({
|
|
37
|
-
...DEFAULT_CONFIG.lightningcss,
|
|
38
|
-
...config.lightningcss,
|
|
39
|
-
filename: id,
|
|
40
|
-
code: Buffer.from(css)
|
|
41
|
-
});
|
|
42
|
-
const href = cyrb53([
|
|
43
|
-
...Object.keys(exports ?? {}),
|
|
44
|
-
id
|
|
45
|
-
].join(''));
|
|
46
|
-
const classes = exports ? Object.fromEntries(Object.entries(exports).map(([key, value])=>[
|
|
47
|
-
key,
|
|
48
|
-
value.name
|
|
49
|
-
])) : {};
|
|
50
|
-
return [
|
|
51
|
-
varOne && `const ${varOne} = \`${code}\``,
|
|
52
|
-
varTwo && `const ${varTwo} = ${JSON.stringify(classes)}`,
|
|
53
|
-
varThree && `const ${varThree} = \`${href}\``
|
|
54
|
-
].filter(Boolean).join('\n');
|
|
55
|
-
});
|
|
56
|
-
return tmpl;
|
|
57
|
-
} catch (err) {
|
|
58
|
-
console.error('cxx error :(', err);
|
|
59
|
-
return source;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
6
|
|
|
63
|
-
export { cxx
|
|
7
|
+
export { cxx };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CustomAtRules, TransformOptions } from 'lightningcss';
|
|
2
|
+
|
|
3
|
+
type Config<C extends CustomAtRules = CustomAtRules> = {
|
|
4
|
+
lightningcss?: Partial<TransformOptions<C>>;
|
|
5
|
+
};
|
|
6
|
+
declare function inject<C extends CustomAtRules = CustomAtRules>(source: string, id: string, config?: Config<C>): string;
|
|
7
|
+
|
|
8
|
+
export { type Config, inject };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { transform } from 'lightningcss';
|
|
2
|
+
|
|
3
|
+
// cyrb53 (c) 2018 bryc (github.com/bryc)
|
|
4
|
+
// https://github.com/bryc/code/blob/master/jshash/experimental/cyrb53.js
|
|
5
|
+
function cyrb53(str, seed = 0) {
|
|
6
|
+
let h1 = 0xdeadbeef ^ seed;
|
|
7
|
+
let h2 = 0x41c6ce57 ^ seed;
|
|
8
|
+
for(let i = 0, ch; 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
|
+
h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507);
|
|
14
|
+
h1 ^= Math.imul(h2 ^ h2 >>> 13, 3266489909);
|
|
15
|
+
h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507);
|
|
16
|
+
h2 ^= Math.imul(h1 ^ h1 >>> 13, 3266489909);
|
|
17
|
+
return 4294967296 * (2097151 & h2) + (h1 >>> 0);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const varMatch = /(?:const|var|let)\s*\[(\w+|)\s*,?\s*(\w+|)\s*,?\s*(\w+|)\s*\]\s*=\s*cxx\s*`([\s\S]*?)`/gm;
|
|
21
|
+
const DEFAULT_CONFIG = {
|
|
22
|
+
lightningcss: {
|
|
23
|
+
minify: true,
|
|
24
|
+
cssModules: true
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
function inject(source, id, config = {}) {
|
|
28
|
+
try {
|
|
29
|
+
const tmpl = source.replace(varMatch, (_, ...args)=>{
|
|
30
|
+
const [varOne, varTwo, varThree, css] = args;
|
|
31
|
+
const { code, exports } = transform({
|
|
32
|
+
...DEFAULT_CONFIG.lightningcss,
|
|
33
|
+
...config.lightningcss,
|
|
34
|
+
filename: id,
|
|
35
|
+
code: Buffer.from(css)
|
|
36
|
+
});
|
|
37
|
+
const href = cyrb53([
|
|
38
|
+
...Object.keys(exports ?? {}),
|
|
39
|
+
id
|
|
40
|
+
].join(''));
|
|
41
|
+
const classes = exports ? Object.fromEntries(Object.entries(exports).map(([key, value])=>[
|
|
42
|
+
key,
|
|
43
|
+
value.name
|
|
44
|
+
])) : {};
|
|
45
|
+
return [
|
|
46
|
+
varOne && `const ${varOne} = \`${code}\``,
|
|
47
|
+
varTwo && `const ${varTwo} = ${JSON.stringify(classes)}`,
|
|
48
|
+
varThree && `const ${varThree} = \`${href}\``
|
|
49
|
+
].filter(Boolean).join('\n');
|
|
50
|
+
});
|
|
51
|
+
return tmpl;
|
|
52
|
+
} catch (err) {
|
|
53
|
+
console.error('cxx error :(', err);
|
|
54
|
+
return source;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { inject };
|
package/dist/next/cxx-loader.js
CHANGED
package/dist/next/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import * as next_dist_server_config_shared from 'next/dist/server/config-shared'
|
|
|
5
5
|
import { WebpackConfigContext } from 'next/dist/server/config-shared';
|
|
6
6
|
import { Configuration } from 'webpack';
|
|
7
7
|
import { NextConfig } from 'next';
|
|
8
|
-
import { Config } from '../index.js';
|
|
8
|
+
import { Config } from '../inject/index.js';
|
|
9
9
|
|
|
10
10
|
declare function withCxx(nextConfig?: NextConfig, config?: Config): {
|
|
11
11
|
webpack(conf: Configuration, options: WebpackConfigContext): any;
|
package/package.json
CHANGED
|
@@ -1,83 +1,87 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@jk2908/cxx",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"author": "Jerome Kenway",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/jk2908/cxx.git"
|
|
9
|
-
},
|
|
10
|
-
"main": "./dist/index.js",
|
|
11
|
-
"types": "./dist/index.d.ts",
|
|
12
|
-
"scripts": {
|
|
13
|
-
"build": "bunchee"
|
|
14
|
-
},
|
|
15
|
-
"devDependencies": {
|
|
16
|
-
"@biomejs/biome": "^1.8.3",
|
|
17
|
-
"@types/react": "latest",
|
|
18
|
-
"@types/react-dom": "latest",
|
|
19
|
-
"@types/webpack": "^5.28.5",
|
|
20
|
-
"bunchee": "^5.3.2",
|
|
21
|
-
"cross-env": "^7.0.3",
|
|
22
|
-
"lightningcss": "^1.
|
|
23
|
-
"next": "^15.0.0-canary.128",
|
|
24
|
-
"react": "^19.0.0-rc || ^19.0.0-beta || ^19.0.0",
|
|
25
|
-
"react-dom": "^19.0.0-rc || ^19.0.0-beta || ^19.0.0",
|
|
26
|
-
"typescript": "^5.5.4",
|
|
27
|
-
"vite": "^5.4.2"
|
|
28
|
-
},
|
|
29
|
-
"peerDependencies": {
|
|
30
|
-
"lightningcss": "^1.
|
|
31
|
-
"next": "^15.0.0-canary || ^15.0.0",
|
|
32
|
-
"react": "^19.0.0-rc || ^19.0.0-beta || ^19.0.0",
|
|
33
|
-
"react-dom": "^19.0.0-rc || ^19.0.0-beta || ^19.0.0",
|
|
34
|
-
"vite": "^
|
|
35
|
-
},
|
|
36
|
-
"exports": {
|
|
37
|
-
".": {
|
|
38
|
-
"types": "./dist/index.d.ts",
|
|
39
|
-
"default": "./dist/index.js"
|
|
40
|
-
},
|
|
41
|
-
"./
|
|
42
|
-
"types": "./dist/
|
|
43
|
-
"default": "./dist/
|
|
44
|
-
},
|
|
45
|
-
"./next
|
|
46
|
-
"types": "./dist/next/
|
|
47
|
-
"default": "./dist/next/
|
|
48
|
-
},
|
|
49
|
-
"./
|
|
50
|
-
"types": "./dist/
|
|
51
|
-
"default": "./dist/
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"vite"
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@jk2908/cxx",
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"author": "Jerome Kenway",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/jk2908/cxx.git"
|
|
9
|
+
},
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "bunchee"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@biomejs/biome": "^1.8.3",
|
|
17
|
+
"@types/react": "latest",
|
|
18
|
+
"@types/react-dom": "latest",
|
|
19
|
+
"@types/webpack": "^5.28.5",
|
|
20
|
+
"bunchee": "^5.3.2",
|
|
21
|
+
"cross-env": "^7.0.3",
|
|
22
|
+
"lightningcss": "^1.27.0",
|
|
23
|
+
"next": "^15.0.0-canary.128",
|
|
24
|
+
"react": "^19.0.0-rc || ^19.0.0-beta || ^19.0.0",
|
|
25
|
+
"react-dom": "^19.0.0-rc || ^19.0.0-beta || ^19.0.0",
|
|
26
|
+
"typescript": "^5.5.4",
|
|
27
|
+
"vite": "^5.4.2"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"lightningcss": "^1.27.0",
|
|
31
|
+
"next": "^15.0.0-canary || ^15.0.0",
|
|
32
|
+
"react": "^19.0.0-rc || ^19.0.0-beta || ^19.0.0",
|
|
33
|
+
"react-dom": "^19.0.0-rc || ^19.0.0-beta || ^19.0.0",
|
|
34
|
+
"vite": "^4.0.0"
|
|
35
|
+
},
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"default": "./dist/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./inject": {
|
|
42
|
+
"types": "./dist/inject/index.d.ts",
|
|
43
|
+
"default": "./dist/inject/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./next": {
|
|
46
|
+
"types": "./dist/next/index.d.ts",
|
|
47
|
+
"default": "./dist/next/index.js"
|
|
48
|
+
},
|
|
49
|
+
"./next/cxx-loader": {
|
|
50
|
+
"types": "./dist/next/cxx-loader.d.ts",
|
|
51
|
+
"default": "./dist/next/cxx-loader.js"
|
|
52
|
+
},
|
|
53
|
+
"./vite-plugin-cxx": {
|
|
54
|
+
"types": "./dist/vite-plugin-cxx/index.d.ts",
|
|
55
|
+
"default": "./dist/vite-plugin-cxx/index.js"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"bugs": {
|
|
59
|
+
"url": "https://github.com/jk2908/cxx/issues"
|
|
60
|
+
},
|
|
61
|
+
"description": "Utilities for generating styles in React 19",
|
|
62
|
+
"files": [
|
|
63
|
+
"dist",
|
|
64
|
+
"src"
|
|
65
|
+
],
|
|
66
|
+
"homepage": "https://github.com/jk2908/cxx#readme",
|
|
67
|
+
"keywords": [
|
|
68
|
+
"react",
|
|
69
|
+
"react19",
|
|
70
|
+
"css",
|
|
71
|
+
"css-in-js",
|
|
72
|
+
"vite-plugin",
|
|
73
|
+
"webpack-loader",
|
|
74
|
+
"lightningcss",
|
|
75
|
+
"next",
|
|
76
|
+
"vite"
|
|
77
|
+
],
|
|
78
|
+
"license": "MIT",
|
|
79
|
+
"peerDependenciesMeta": {
|
|
80
|
+
"next": {
|
|
81
|
+
"optional": true
|
|
82
|
+
},
|
|
83
|
+
"vite": {
|
|
84
|
+
"optional": true
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import { cyrb53 } from './cyrb53'
|
|
2
|
-
|
|
3
|
-
import { type TransformOptions, type CustomAtRules, transform } from 'lightningcss'
|
|
4
|
-
|
|
5
1
|
declare module 'react' {
|
|
6
2
|
interface StyleHTMLAttributes<T> extends React.HTMLAttributes<T> {
|
|
7
3
|
href?: string
|
|
@@ -13,55 +9,4 @@ export const cxx = (_: TemplateStringsArray): readonly ['', Record<string, strin
|
|
|
13
9
|
'',
|
|
14
10
|
{},
|
|
15
11
|
'',
|
|
16
|
-
]
|
|
17
|
-
|
|
18
|
-
const varMatch =
|
|
19
|
-
/(?:const|var|let)\s*\[(\w+|)\s*,?\s*(\w+|)\s*,?\s*(\w+|)\s*\]\s*=\s*cxx\s*`([\s\S]*?)`/gm
|
|
20
|
-
|
|
21
|
-
export type Config<C extends CustomAtRules = CustomAtRules> = {
|
|
22
|
-
lightningcss?: Partial<TransformOptions<C>>
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const DEFAULT_CONFIG: Config = {
|
|
26
|
-
lightningcss: {
|
|
27
|
-
minify: true,
|
|
28
|
-
cssModules: true,
|
|
29
|
-
},
|
|
30
|
-
} as const
|
|
31
|
-
|
|
32
|
-
export function inject<C extends CustomAtRules = CustomAtRules>(
|
|
33
|
-
source: string,
|
|
34
|
-
id: string,
|
|
35
|
-
config: Config<C> = {},
|
|
36
|
-
) {
|
|
37
|
-
try {
|
|
38
|
-
const tmpl = source.replace(varMatch, (_: string, ...args: string[]) => {
|
|
39
|
-
const [varOne, varTwo, varThree, css] = args
|
|
40
|
-
|
|
41
|
-
const { code, exports } = transform({
|
|
42
|
-
...DEFAULT_CONFIG.lightningcss,
|
|
43
|
-
...config.lightningcss,
|
|
44
|
-
filename: id,
|
|
45
|
-
code: Buffer.from(css),
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
const href = cyrb53([...Object.keys(exports ?? {}), id].join(''))
|
|
49
|
-
const classes = exports
|
|
50
|
-
? Object.fromEntries(Object.entries(exports).map(([key, value]) => [key, value.name]))
|
|
51
|
-
: {}
|
|
52
|
-
|
|
53
|
-
return [
|
|
54
|
-
varOne && `const ${varOne} = \`${code}\``,
|
|
55
|
-
varTwo && `const ${varTwo} = ${JSON.stringify(classes)}`,
|
|
56
|
-
varThree && `const ${varThree} = \`${href}\``,
|
|
57
|
-
]
|
|
58
|
-
.filter(Boolean)
|
|
59
|
-
.join('\n')
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
return tmpl
|
|
63
|
-
} catch (err) {
|
|
64
|
-
console.error('cxx error :(', err)
|
|
65
|
-
return source
|
|
66
|
-
}
|
|
67
|
-
}
|
|
12
|
+
]
|
package/src/inject.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { cyrb53 } from './cyrb53'
|
|
2
|
+
|
|
3
|
+
import { type TransformOptions, type CustomAtRules, transform } from 'lightningcss'
|
|
4
|
+
|
|
5
|
+
const varMatch =
|
|
6
|
+
/(?:const|var|let)\s*\[(\w+|)\s*,?\s*(\w+|)\s*,?\s*(\w+|)\s*\]\s*=\s*cxx\s*`([\s\S]*?)`/gm
|
|
7
|
+
|
|
8
|
+
export type Config<C extends CustomAtRules = CustomAtRules> = {
|
|
9
|
+
lightningcss?: Partial<TransformOptions<C>>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const DEFAULT_CONFIG: Config = {
|
|
13
|
+
lightningcss: {
|
|
14
|
+
minify: true,
|
|
15
|
+
cssModules: true,
|
|
16
|
+
},
|
|
17
|
+
} as const
|
|
18
|
+
|
|
19
|
+
export function inject<C extends CustomAtRules = CustomAtRules>(
|
|
20
|
+
source: string,
|
|
21
|
+
id: string,
|
|
22
|
+
config: Config<C> = {},
|
|
23
|
+
) {
|
|
24
|
+
try {
|
|
25
|
+
const tmpl = source.replace(varMatch, (_: string, ...args: string[]) => {
|
|
26
|
+
const [varOne, varTwo, varThree, css] = args
|
|
27
|
+
|
|
28
|
+
const { code, exports } = transform({
|
|
29
|
+
...DEFAULT_CONFIG.lightningcss,
|
|
30
|
+
...config.lightningcss,
|
|
31
|
+
filename: id,
|
|
32
|
+
code: Buffer.from(css),
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
const href = cyrb53([...Object.keys(exports ?? {}), id].join(''))
|
|
36
|
+
const classes = exports
|
|
37
|
+
? Object.fromEntries(Object.entries(exports).map(([key, value]) => [key, value.name]))
|
|
38
|
+
: {}
|
|
39
|
+
|
|
40
|
+
return [
|
|
41
|
+
varOne && `const ${varOne} = \`${code}\``,
|
|
42
|
+
varTwo && `const ${varTwo} = ${JSON.stringify(classes)}`,
|
|
43
|
+
varThree && `const ${varThree} = \`${href}\``,
|
|
44
|
+
]
|
|
45
|
+
.filter(Boolean)
|
|
46
|
+
.join('\n')
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
return tmpl
|
|
50
|
+
} catch (err) {
|
|
51
|
+
console.error('cxx error :(', err)
|
|
52
|
+
return source
|
|
53
|
+
}
|
|
54
|
+
}
|
package/src/next/cxx-loader.js
CHANGED
package/src/next/index.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { Configuration } from 'webpack'
|
|
|
4
4
|
import type { NextConfig } from 'next'
|
|
5
5
|
import type { WebpackConfigContext } from 'next/dist/server/config-shared'
|
|
6
6
|
|
|
7
|
-
import type { Config } from '../'
|
|
7
|
+
import type { Config } from '../inject'
|
|
8
8
|
|
|
9
9
|
export function withCxx(nextConfig: NextConfig = {}, config?: Config) {
|
|
10
10
|
return {
|