@jk2908/cxx 0.1.5-canary → 0.1.5-canary.2

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.
@@ -8,15 +8,110 @@ import { NextConfig } from 'next';
8
8
  import { Config } from '../inject/index.js';
9
9
 
10
10
  declare function withCxx(nextConfig?: NextConfig, config?: Config): {
11
+ experimental: any;
11
12
  webpack(conf: Configuration, options: WebpackConfigContext): any;
12
- turbo: {
13
- rules: {
14
- './app/**/*.tsx': {
15
- loaders: string[];
16
- as: string;
17
- };
13
+ exportPathMap?: (defaultMap: next_dist_server_config_shared.ExportPathMap, ctx: {
14
+ dev: boolean;
15
+ dir: string;
16
+ outDir: string | null;
17
+ distDir: string;
18
+ buildId: string;
19
+ }) => Promise<next_dist_server_config_shared.ExportPathMap> | next_dist_server_config_shared.ExportPathMap;
20
+ i18n?: next_dist_server_config_shared.I18NConfig | null;
21
+ eslint?: next_dist_server_config_shared.ESLintConfig;
22
+ typescript?: next_dist_server_config_shared.TypeScriptConfig;
23
+ headers?: () => Promise<next_dist_lib_load_custom_routes.Header[]>;
24
+ rewrites?: () => Promise<next_dist_lib_load_custom_routes.Rewrite[] | {
25
+ beforeFiles: next_dist_lib_load_custom_routes.Rewrite[];
26
+ afterFiles: next_dist_lib_load_custom_routes.Rewrite[];
27
+ fallback: next_dist_lib_load_custom_routes.Rewrite[];
28
+ }>;
29
+ redirects?: () => Promise<next_dist_lib_load_custom_routes.Redirect[]>;
30
+ excludeDefaultMomentLocales?: boolean;
31
+ trailingSlash?: boolean;
32
+ env?: Record<string, string | undefined>;
33
+ distDir?: string;
34
+ cleanDistDir?: boolean;
35
+ assetPrefix?: string;
36
+ cacheHandler?: string | undefined;
37
+ cacheMaxMemorySize?: number;
38
+ useFileSystemPublicRoutes?: boolean;
39
+ generateBuildId?: () => string | null | Promise<string | null>;
40
+ generateEtags?: boolean;
41
+ pageExtensions?: string[];
42
+ compress?: boolean;
43
+ poweredByHeader?: boolean;
44
+ images?: next_dist_shared_lib_image_config.ImageConfig;
45
+ devIndicators?: {
46
+ buildActivity?: boolean;
47
+ buildActivityPosition?: "bottom-right" | "bottom-left" | "top-right" | "top-left";
48
+ };
49
+ onDemandEntries?: {
50
+ maxInactiveAge?: number;
51
+ pagesBufferLength?: number;
52
+ };
53
+ amp?: {
54
+ canonicalBase?: string;
55
+ };
56
+ deploymentId?: string;
57
+ basePath?: string;
58
+ sassOptions?: {
59
+ [key: string]: any;
60
+ };
61
+ productionBrowserSourceMaps?: boolean;
62
+ optimizeFonts?: boolean;
63
+ reactProductionProfiling?: boolean;
64
+ reactStrictMode?: boolean | null;
65
+ publicRuntimeConfig?: {
66
+ [key: string]: any;
67
+ };
68
+ serverRuntimeConfig?: {
69
+ [key: string]: any;
70
+ };
71
+ httpAgentOptions?: {
72
+ keepAlive?: boolean;
73
+ };
74
+ staticPageGenerationTimeout?: number;
75
+ crossOrigin?: "anonymous" | "use-credentials";
76
+ compiler?: {
77
+ reactRemoveProperties?: boolean | {
78
+ properties?: string[];
79
+ };
80
+ relay?: {
81
+ src: string;
82
+ artifactDirectory?: string;
83
+ language?: "typescript" | "javascript" | "flow";
84
+ eagerEsModules?: boolean;
85
+ };
86
+ removeConsole?: boolean | {
87
+ exclude?: string[];
88
+ };
89
+ styledComponents?: boolean | next_dist_server_config_shared.StyledComponentsConfig;
90
+ emotion?: boolean | next_dist_server_config_shared.EmotionConfig;
91
+ styledJsx?: boolean | {
92
+ useLightningcss?: boolean;
93
+ };
94
+ };
95
+ output?: "standalone" | "export";
96
+ transpilePackages?: string[];
97
+ skipMiddlewareUrlNormalize?: boolean;
98
+ skipTrailingSlashRedirect?: boolean;
99
+ modularizeImports?: Record<string, {
100
+ transform: string | Record<string, string>;
101
+ preventFullImport?: boolean;
102
+ skipDefaultConversion?: boolean;
103
+ }>;
104
+ logging?: {
105
+ fetches?: {
106
+ fullUrl?: boolean;
18
107
  };
19
108
  };
109
+ swrDelta?: next_dist_server_lib_revalidate.SwrDelta;
110
+ bundlePagesRouterDependencies?: boolean;
111
+ serverExternalPackages?: string[];
112
+ } | {
113
+ turbo: any;
114
+ webpack(conf: Configuration, options: WebpackConfigContext): any;
20
115
  exportPathMap?: (defaultMap: next_dist_server_config_shared.ExportPathMap, ctx: {
21
116
  dev: boolean;
22
117
  dir: string;
@@ -1,35 +1,46 @@
1
- import path from 'node:path';
1
+ import __node_cjsPath from 'node:path';
2
2
  import __node_cjsUrl from 'node:url';
3
+ import __node_cjsModule from 'node:module';
3
4
 
4
5
  const __filename = __node_cjsUrl.fileURLToPath(import.meta.url);
5
- const __dirname = path.dirname(__filename);
6
+ const __dirname = __node_cjsPath.dirname(__filename);
7
+ const require = __node_cjsModule.createRequire(import.meta.url);
6
8
 
7
9
  function withCxx(nextConfig = {}, config) {
10
+ const IS_CANARY = require('next/package.json').version?.includes('canary') ?? false;
11
+ const CXX_LOADER = __node_cjsPath.resolve(__dirname, 'cxx-loader.js');
12
+ const turbo = {
13
+ ...nextConfig.turbo,
14
+ rules: {
15
+ ...nextConfig.turbo?.rules ?? {},
16
+ './app/**/*.tsx': {
17
+ loaders: [
18
+ CXX_LOADER
19
+ ],
20
+ as: './tsx'
21
+ }
22
+ }
23
+ };
8
24
  return {
9
25
  ...nextConfig,
10
26
  webpack (conf, options) {
11
- const resolvedNextConfig = typeof nextConfig?.webpack === 'function' ? nextConfig?.webpack(conf, options) : conf;
12
- resolvedNextConfig?.module?.rules?.push({
27
+ const resolvedWebpackConfig = typeof nextConfig?.webpack === 'function' ? nextConfig?.webpack(conf, options) : conf;
28
+ resolvedWebpackConfig?.module?.rules?.push({
13
29
  test: /\.(js|jsx|ts|tsx)$/,
14
30
  exclude: /node_modules/,
15
31
  use: {
16
- loader: path.resolve(__dirname, 'cxx-loader.js'),
32
+ loader: CXX_LOADER,
17
33
  options: {
18
34
  ...config
19
35
  }
20
36
  }
21
37
  });
22
- return resolvedNextConfig;
38
+ return resolvedWebpackConfig;
23
39
  },
24
- turbo: {
25
- rules: {
26
- './app/**/*.tsx': {
27
- loaders: [
28
- path.resolve(__dirname, 'cxx-loader.js')
29
- ],
30
- as: './tsx'
31
- }
32
- }
40
+ ...IS_CANARY ? {
41
+ experimental: turbo
42
+ } : {
43
+ turbo
33
44
  }
34
45
  };
35
46
  }
package/package.json CHANGED
@@ -1,87 +1,90 @@
1
- {
2
- "name": "@jk2908/cxx",
3
- "version": "0.1.5-canary",
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
- }
1
+ {
2
+ "name": "@jk2908/cxx",
3
+ "version": "0.1.5-canary.2",
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
+ "dependencies": {
88
+ "@jk2908/cxx": "0.1.5-canary.1"
89
+ }
90
+ }
package/src/next/index.ts CHANGED
@@ -7,33 +7,40 @@ import type { WebpackConfigContext } from 'next/dist/server/config-shared'
7
7
  import type { Config } from '../inject'
8
8
 
9
9
  export function withCxx(nextConfig: NextConfig = {}, config?: Config) {
10
+ const IS_CANARY = require('next/package.json').version?.includes('canary') ?? false
11
+ const CXX_LOADER = path.resolve(__dirname, 'cxx-loader.js')
12
+
13
+ const turbo = {
14
+ ...nextConfig.turbo,
15
+ rules: {
16
+ ...(nextConfig.turbo?.rules ?? {}),
17
+ './app/**/*.tsx': {
18
+ loaders: [CXX_LOADER],
19
+ as: './tsx',
20
+ },
21
+ },
22
+ }
23
+
10
24
  return {
11
25
  ...nextConfig,
12
26
  webpack(conf: Configuration, options: WebpackConfigContext) {
13
- const resolvedNextConfig = (
27
+ const resolvedWebpackConfig = (
14
28
  typeof nextConfig?.webpack === 'function' ? nextConfig?.webpack(conf, options) : conf
15
29
  ) satisfies Configuration
16
30
 
17
- resolvedNextConfig?.module?.rules?.push({
31
+ resolvedWebpackConfig?.module?.rules?.push({
18
32
  test: /\.(js|jsx|ts|tsx)$/,
19
33
  exclude: /node_modules/,
20
34
  use: {
21
- loader: path.resolve(__dirname, 'cxx-loader.js'),
35
+ loader: CXX_LOADER,
22
36
  options: {
23
- ...config
24
- }
37
+ ...config,
38
+ },
25
39
  },
26
40
  })
27
41
 
28
- return resolvedNextConfig
42
+ return resolvedWebpackConfig
29
43
  },
30
- turbo: {
31
- rules: {
32
- './app/**/*.tsx': {
33
- loaders: [path.resolve(__dirname, 'cxx-loader.js')],
34
- as: './tsx'
35
- }
36
- }
37
- }
44
+ ...(IS_CANARY ? { experimental: turbo } : { turbo }),
38
45
  }
39
46
  }