@yak/react 0.0.0-stage → 10.0.0-rc.0

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.
Files changed (118) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +102 -2
  3. package/dist/context/baseContext.cjs +9 -0
  4. package/dist/context/baseContext.cjs.map +1 -0
  5. package/dist/context/baseContext.d.cts +6 -0
  6. package/dist/context/baseContext.d.ts +6 -0
  7. package/dist/context/baseContext.js +8 -0
  8. package/dist/context/baseContext.js.map +1 -0
  9. package/dist/context/index.cjs +45 -0
  10. package/dist/context/index.cjs.map +1 -0
  11. package/dist/context/index.d.cts +21 -0
  12. package/dist/context/index.d.ts +21 -0
  13. package/dist/context/index.js +15 -0
  14. package/dist/context/index.js.map +1 -0
  15. package/dist/context/index.server.cjs +47 -0
  16. package/dist/context/index.server.cjs.map +1 -0
  17. package/dist/context/index.server.d.cts +10 -0
  18. package/dist/context/index.server.d.ts +10 -0
  19. package/dist/context/index.server.js +17 -0
  20. package/dist/context/index.server.js.map +1 -0
  21. package/dist/cross-file-resolver/index.d.ts +199 -0
  22. package/dist/cross-file-resolver/index.js +535 -0
  23. package/dist/cross-file-resolver/index.js.map +1 -0
  24. package/dist/index.cjs +2 -0
  25. package/dist/index.cjs.map +1 -0
  26. package/dist/index.d.cts +320 -0
  27. package/dist/index.d.ts +320 -0
  28. package/dist/index.js +2 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/internal.cjs +544 -0
  31. package/dist/internal.cjs.map +1 -0
  32. package/dist/internal.d.cts +452 -0
  33. package/dist/internal.d.ts +452 -0
  34. package/dist/internal.js +363 -0
  35. package/dist/internal.js.map +1 -0
  36. package/dist/isolated-source-eval/index.d.ts +30 -0
  37. package/dist/isolated-source-eval/index.js +317 -0
  38. package/dist/isolated-source-eval/index.js.map +1 -0
  39. package/dist/isolated-source-eval/worker.js +59 -0
  40. package/dist/isolated-source-eval/worker.js.map +1 -0
  41. package/dist/jsx-dev-runtime.cjs +2 -0
  42. package/dist/jsx-dev-runtime.cjs.map +1 -0
  43. package/dist/jsx-dev-runtime.d.cts +7 -0
  44. package/dist/jsx-dev-runtime.d.ts +7 -0
  45. package/dist/jsx-dev-runtime.js +2 -0
  46. package/dist/jsx-dev-runtime.js.map +1 -0
  47. package/dist/jsx-runtime.cjs +2 -0
  48. package/dist/jsx-runtime.cjs.map +1 -0
  49. package/dist/jsx-runtime.d.cts +38 -0
  50. package/dist/jsx-runtime.d.ts +38 -0
  51. package/dist/jsx-runtime.js +2 -0
  52. package/dist/jsx-runtime.js.map +1 -0
  53. package/dist/loaders/turbo-loader.cjs +803 -0
  54. package/dist/loaders/turbo-loader.cjs.map +1 -0
  55. package/dist/loaders/turbo-loader.d.cts +15 -0
  56. package/dist/loaders/vite-plugin.d.ts +111 -0
  57. package/dist/loaders/vite-plugin.js +878 -0
  58. package/dist/loaders/vite-plugin.js.map +1 -0
  59. package/dist/loaders/webpack-loader.cjs +697 -0
  60. package/dist/loaders/webpack-loader.cjs.map +1 -0
  61. package/dist/loaders/webpack-loader.d.cts +12 -0
  62. package/dist/rsbuild/index.d.ts +29 -0
  63. package/dist/rsbuild/index.js +52 -0
  64. package/dist/rsbuild/index.js.map +1 -0
  65. package/dist/static/chunk-DK3Fl9T5.js +1 -0
  66. package/dist/static/index.cjs +2 -0
  67. package/dist/static/index.cjs.map +1 -0
  68. package/dist/static/index.d.cts +28 -0
  69. package/dist/static/index.d.ts +28 -0
  70. package/dist/static/index.js +2 -0
  71. package/dist/static/index.js.map +1 -0
  72. package/dist/withYak/index.cjs +208 -0
  73. package/dist/withYak/index.cjs.map +1 -0
  74. package/dist/withYak/index.d.cts +121 -0
  75. package/dist/withYak/index.d.ts +121 -0
  76. package/dist/withYak/index.js +177 -0
  77. package/dist/withYak/index.js.map +1 -0
  78. package/loaders/lib/resolveCrossFileSelectors.ts +162 -0
  79. package/loaders/turbo-evaluator.ts +134 -0
  80. package/loaders/turbo-loader.ts +180 -0
  81. package/loaders/vite-plugin.ts +28 -0
  82. package/loaders/webpack-loader.ts +44 -0
  83. package/package.json +214 -3
  84. package/rsbuild/index.ts +92 -0
  85. package/runtime/__tests__/atoms.test.tsx +48 -0
  86. package/runtime/__tests__/attrs.test.tsx +490 -0
  87. package/runtime/__tests__/cssLiteral.test.tsx +503 -0
  88. package/runtime/__tests__/cssProp.test.tsx +392 -0
  89. package/runtime/__tests__/cssPropTest.tsx +227 -0
  90. package/runtime/__tests__/foldedJsxParity.test.tsx +117 -0
  91. package/runtime/__tests__/styled.test.tsx +653 -0
  92. package/runtime/__tests__/tsconfig.json +18 -0
  93. package/runtime/__tests__/typeTest.tsx +374 -0
  94. package/runtime/atoms.tsx +36 -0
  95. package/runtime/context/README.md +84 -0
  96. package/runtime/context/baseContext.tsx +5 -0
  97. package/runtime/context/index.server.tsx +22 -0
  98. package/runtime/context/index.tsx +36 -0
  99. package/runtime/cssLiteral.tsx +214 -0
  100. package/runtime/globalStyle.tsx +54 -0
  101. package/runtime/index.ts +37 -0
  102. package/runtime/internal.ts +42 -0
  103. package/runtime/internals/mergeClassNames.ts +23 -0
  104. package/runtime/internals/mergeCssProp.ts +69 -0
  105. package/runtime/internals/propMarkers.ts +20 -0
  106. package/runtime/internals/unitPostFix.ts +34 -0
  107. package/runtime/jsx-dev-runtime.ts +6 -0
  108. package/runtime/jsx-runtime.ts +48 -0
  109. package/runtime/keyframes.tsx +30 -0
  110. package/runtime/mocks/cssLiteral.ts +74 -0
  111. package/runtime/mocks/globalStyle.ts +14 -0
  112. package/runtime/mocks/keyframes.ts +29 -0
  113. package/runtime/mocks/styled.ts +8 -0
  114. package/runtime/publicStyledApi.ts +159 -0
  115. package/runtime/styled.tsx +372 -0
  116. package/runtime/styledDom.tsx +139 -0
  117. package/withYak/allow-global-css.ts +94 -0
  118. package/withYak/index.ts +282 -0
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Turbopack evaluator adapter.
3
+ *
4
+ * Bridges the low-level `Evaluator` (worker-thread module evaluator) and
5
+ * turbopack's loader lifecycle. A single `Evaluator` instance is kept as a
6
+ * singleton on `globalThis` because turbopack may create multiple loader
7
+ * instances that share the same process — `Symbol.for` keys guarantee all
8
+ * instances converge on the same evaluator and modification time map.
9
+ *
10
+ * Invalidation uses synchronous modification time polling rather than `fs.watch` because
11
+ * turbopack can re-run a loader before a filesystem watcher event fires,
12
+ * which would cause the evaluator to return stale cached results.
13
+ */
14
+ import { statSync } from "node:fs";
15
+ import type { Evaluator } from "../isolated-source-eval/index.js";
16
+
17
+ const EVALUATOR_KEY = Symbol.for("@yak/react-evaluator");
18
+ const MTIMES_KEY = Symbol.for("@yak/react-mtimes");
19
+
20
+ /**
21
+ * A shared `Map` of file paths to their last known modification times, used to detect changes on disk
22
+ *
23
+ * e.g. bar.ts -> 1680000000000 (Sat Mar 28 2024 12:00:00 GMT+0000)
24
+ *
25
+ * fs.fileWatch is not used as it might be out of sync with turbopacks own file watching also turbopack
26
+ * spawns a loader pool which could cause a lot of file watchers to be created which can cause performance issues and hitting OS limits
27
+ */
28
+ const getFileModificationTimes = () =>
29
+ ((globalThis as typeof globalThis & { [MTIMES_KEY]?: Map<string, number> })[MTIMES_KEY] ??=
30
+ new Map<string, number>());
31
+
32
+ /**
33
+ * Returns the shared evaluator, creating it on first call.
34
+ *
35
+ * Uses `Symbol.for` keys on `globalThis` so every turbopack loader instance
36
+ * in the process converges on the same evaluator and modification time map. A
37
+ * `beforeExit` handler terminates the worker threads when the process winds
38
+ * down.
39
+ */
40
+ export const getEvaluatorSingleton = async (): Promise<Evaluator> => {
41
+ const processGlobal = globalThis as typeof globalThis & {
42
+ [EVALUATOR_KEY]?: Promise<Evaluator>;
43
+ };
44
+ if (!processGlobal[EVALUATOR_KEY]) {
45
+ processGlobal[EVALUATOR_KEY] = import("../isolated-source-eval/index.js").then(
46
+ ({ createEvaluator }) => createEvaluator(),
47
+ );
48
+ // Kill the worker threads when the process exits
49
+ process.on("beforeExit", async () => {
50
+ const evaluator = await processGlobal[EVALUATOR_KEY]!;
51
+ await evaluator.dispose();
52
+ });
53
+ }
54
+ return processGlobal[EVALUATOR_KEY]!;
55
+ };
56
+
57
+ /**
58
+ * Turbopack runs the loader for the same compilation file-by-file, but multiple files can share the
59
+ * same dependency. This function detects which dependencies actually changed
60
+ * on disk and invalidates them once — this prevents re-evaluating the same module multiple times in the same compilation
61
+ */
62
+ function invalidateDependenciesWithDiskModifications(evaluator: Evaluator): void {
63
+ const modificationTimes = getFileModificationTimes();
64
+ const modifiedDependencies: string[] = [];
65
+ for (const [dep, lastModificationTime] of modificationTimes) {
66
+ try {
67
+ const currentModificationTime = statSync(dep).mtimeMs;
68
+ if (currentModificationTime !== lastModificationTime) {
69
+ modifiedDependencies.push(dep);
70
+ modificationTimes.set(dep, currentModificationTime);
71
+ }
72
+ } catch {
73
+ modifiedDependencies.push(dep);
74
+ modificationTimes.delete(dep);
75
+ }
76
+ }
77
+ if (modifiedDependencies.length > 0) {
78
+ evaluator.invalidate(...modifiedDependencies);
79
+ }
80
+ }
81
+
82
+ /** Snapshots the current modification times of `deps` so the next evaluation can detect changes. */
83
+ function recordModificationTimes(deps: string[]): void {
84
+ const modificationTimes = getFileModificationTimes();
85
+ for (const dep of deps) {
86
+ try {
87
+ modificationTimes.set(dep, statSync(dep).mtimeMs);
88
+ } catch {
89
+ /* file may not exist */
90
+ }
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Creates an evaluator function scoped to a single loader invocation.
96
+ *
97
+ * Before evaluation, checks whether any previously recorded dependency has
98
+ * changed on disk and invalidates the evaluator cache if so. After a
99
+ * successful evaluation, records fresh modification times and notifies the caller of
100
+ * every transitive dependency via `onDependency`.
101
+ *
102
+ * @returns A function that evaluates a yak module and returns its exports.
103
+ * The returned function accepts:
104
+ * - `modulePath` — absolute path to the module to evaluate.
105
+ * - `onDependency` — called once per transitive dependency so the loader
106
+ * can register file watchers with turbopack.
107
+ * @throws If the evaluated module throws at runtime — the original stack
108
+ * trace from the worker thread is preserved.
109
+ */
110
+ export async function createCompilationEvaluator(): Promise<
111
+ (modulePath: string, onDependency?: (dep: string) => void) => Promise<Record<string, unknown>>
112
+ > {
113
+ const evaluator = await getEvaluatorSingleton();
114
+ invalidateDependenciesWithDiskModifications(evaluator);
115
+
116
+ return async (modulePath, onDependency?) => {
117
+ const result = await evaluator.evaluate(modulePath);
118
+ if (!result.ok) {
119
+ const error = new Error(result.error.message);
120
+ if (result.error.stack) {
121
+ error.stack = result.error.stack;
122
+ }
123
+ throw error;
124
+ }
125
+ // Store times of newly discovered dependencies for next compilation
126
+ recordModificationTimes(result.dependencies);
127
+ if (onDependency) {
128
+ for (const dep of result.dependencies) {
129
+ onDependency(dep);
130
+ }
131
+ }
132
+ return result.value;
133
+ };
134
+ }
@@ -0,0 +1,180 @@
1
+ import { transform as swcTransform } from "@swc/core";
2
+ import { createRequire } from "node:module";
3
+ import { dirname } from "node:path";
4
+ import type { LoaderContext } from "webpack";
5
+ import { parseModule } from "yak-internals/cross-file-resolver/parse-module";
6
+ import { resolveCrossFileConstant } from "yak-internals/cross-file-resolver/resolve";
7
+ import type { YakConfigOptions } from "../withYak/index.js";
8
+ import { createDebugLogger } from "yak-internals/debug-logger";
9
+ import { extractCss } from "yak-internals/extract-css";
10
+ import { parseExports } from "yak-internals/parse-exports";
11
+ import { getSwcParserOptions } from "yak-internals/swc-parser-options";
12
+
13
+ const universalRequire = typeof require === "undefined" ? createRequire(import.meta.url) : require;
14
+ const yakSwcPluginPath = universalRequire.resolve("@yak/swc");
15
+ const dataUrlImportPrefix = 'import "data:text/css;base64,';
16
+
17
+ /**
18
+ * This loader transforms styled-components styles to a static data-url import
19
+ * The compile-time nexy-yak transformation takes javascript/typescript as input,
20
+ * strips all inline css code and adds the css as static css urls
21
+ * e.g.: `import "data:text/css;base64,"`
22
+ */
23
+ export default async function cssExtractLoader(
24
+ this: LoaderContext<{ yakOptions: YakConfigOptions; yakPluginOptions: any }>,
25
+ code: string,
26
+ sourceMap: string | undefined,
27
+ ): Promise<string | void> {
28
+ const callback = this.async();
29
+
30
+ // process only files which include @yak/react for maximal compile performance
31
+ if (!code.includes("@yak/react")) {
32
+ return callback(null, code, sourceMap);
33
+ }
34
+
35
+ const {
36
+ yakPluginOptions,
37
+ yakOptions: { experiments },
38
+ } = this.getOptions();
39
+ const debugLog = createDebugLogger(experiments?.debug, this.rootContext);
40
+ const resolveTurbopack = this.getResolve({});
41
+ const transform = createTransform(yakPluginOptions, yakSwcPluginPath);
42
+
43
+ const resolveFn = (specifier: string, importer: string) => {
44
+ return new Promise<string>((resolve, reject) => {
45
+ resolveTurbopack(dirname(importer), specifier, (err, result) => {
46
+ if (err) return reject(err);
47
+ if (!result) return reject(new Error(`Could not resolve ${specifier}`));
48
+ resolve(result);
49
+ });
50
+ });
51
+ };
52
+
53
+ const crossFileDeps = new Set<string>();
54
+ let evaluate:
55
+ | Awaited<ReturnType<typeof import("./turbo-evaluator.js").createCompilationEvaluator>>
56
+ | undefined;
57
+ const fsReadFile = (filePath: string) => {
58
+ crossFileDeps.add(filePath);
59
+ return new Promise<string>((resolve, reject) =>
60
+ this.fs.readFile(filePath, "utf-8", (err, result) => {
61
+ if (err) return reject(err);
62
+ if (!result) return reject(new Error(`File not found: ${filePath}`));
63
+ resolve(result);
64
+ }),
65
+ );
66
+ };
67
+
68
+ try {
69
+ const result = await transform(code, this.resourcePath, this.rootContext, sourceMap);
70
+ debugLog("ts", result.code, this.resourcePath);
71
+
72
+ let css = extractCss(result.code, "Css");
73
+ debugLog("css", css, this.resourcePath);
74
+
75
+ const { resolved } = await resolveCrossFileConstant(
76
+ {
77
+ parse: (modulePath) => {
78
+ return parseModule(
79
+ {
80
+ transpilationMode: "Css",
81
+ extractExports: async (modulePath) => {
82
+ const sourceContents = await fsReadFile(modulePath);
83
+ return parseExports(sourceContents);
84
+ },
85
+ getTransformed: async (modulePath) => {
86
+ const sourceContent = await fsReadFile(modulePath);
87
+ return transform(sourceContent, modulePath, this.rootContext);
88
+ },
89
+ evaluateYakModule: async (modulePath: string) => {
90
+ crossFileDeps.add(modulePath);
91
+ /*
92
+ * Turbopack doesn't let us know when a compilation start so by using a singleton evaluator we
93
+ * we can at least ensture that we scan for file modifications only once per loader call
94
+ */
95
+ evaluate ??= await (
96
+ await import("./turbo-evaluator.js")
97
+ ).createCompilationEvaluator();
98
+ return evaluate(modulePath, (dep) => crossFileDeps.add(dep));
99
+ },
100
+ },
101
+ modulePath,
102
+ );
103
+ },
104
+ resolve: resolveFn,
105
+ },
106
+ this.resourcePath,
107
+ css,
108
+ );
109
+
110
+ // Register cross-file dependencies so turbopack re-runs this loader
111
+ // when any dependency changes (analogous to webpack's this.addDependency)
112
+ for (const dep of crossFileDeps) {
113
+ this.addDependency(dep);
114
+ }
115
+
116
+ const codeWithCrossFileResolved = replaceDataUrlImport(result.code, resolved);
117
+
118
+ debugLog("css-resolved", resolved, this.resourcePath);
119
+ return callback(null, codeWithCrossFileResolved, result.map);
120
+ } catch (error) {
121
+ // Register cross-file dependencies even on error so turbopack re-runs
122
+ // this loader when a broken dependency is fixed.
123
+ for (const dep of crossFileDeps) {
124
+ this.addDependency(dep);
125
+ }
126
+ return callback(error instanceof Error ? error : new Error(String(error)));
127
+ }
128
+ }
129
+
130
+ /**
131
+ * Swap the data-url import the SWC plugin emitted for one carrying the resolved css.
132
+ *
133
+ * Modules which import @yak/react without declaring styles get no such import and are
134
+ * returned unchanged. The import is matched from the start of the line so that source
135
+ * code merely mentioning a data url cannot be mistaken for it.
136
+ */
137
+ function replaceDataUrlImport(code: string, resolvedCss: string): string {
138
+ const lines = code.split("\n");
139
+ const lineIndex = lines.findIndex((line) => line.trimStart().startsWith(dataUrlImportPrefix));
140
+ if (lineIndex === -1) {
141
+ return code;
142
+ }
143
+ lines[lineIndex] = `${dataUrlImportPrefix}${Buffer.from(resolvedCss).toString("base64")}";`;
144
+ return lines.join("\n");
145
+ }
146
+
147
+ function createTransform(yakPluginOptions: any, yakSwcPluginPath: string) {
148
+ return (data: string, modulePath: string, rootPath: string, sourceMap?: any) =>
149
+ // https://github.com/vercel/next.js/blob/canary/packages/next/src/build/webpack/loaders/next-swc-loader.ts#L143
150
+ swcTransform(data, {
151
+ filename: modulePath,
152
+ inputSourceMap: sourceMap,
153
+ sourceMaps: true,
154
+ sourceFileName: modulePath,
155
+ sourceRoot: rootPath,
156
+ jsc: {
157
+ // Derive the parser from the file name the same way Next.js does
158
+ parser: getSwcParserOptions(modulePath),
159
+ experimental: {
160
+ // Keep `import data from "./data.json" with { type: "json" }` intact
161
+ keepImportAttributes: true,
162
+ plugins: [[yakSwcPluginPath, yakPluginOptions]],
163
+ },
164
+ transform: {
165
+ react: {
166
+ runtime: "preserve",
167
+ },
168
+ },
169
+ target: "es2022",
170
+ loose: false,
171
+ minify: {
172
+ compress: false,
173
+ mangle: false,
174
+ },
175
+ preserveAllComments: true,
176
+ },
177
+ minify: false,
178
+ isModule: true,
179
+ });
180
+ }
@@ -0,0 +1,28 @@
1
+ import { createViteYakPlugin } from "yak-internals/vite-plugin-core";
2
+
3
+ export type { ViteYakPluginOptions } from "yak-internals/vite-plugin-core";
4
+
5
+ /**
6
+ * Vite plugin for @yak/react: compiles the css``, styled`` and css prop
7
+ * styles in your source code to plain CSS at build time.
8
+ *
9
+ * Add it before the framework's plugin so it sees your original source code.
10
+ *
11
+ * @usage
12
+ * ```ts
13
+ * // vite.config.ts
14
+ * import { defineConfig } from "vite";
15
+ * import react from "@vitejs/plugin-react-swc";
16
+ * import { viteYak } from "@yak/react/vite";
17
+ *
18
+ * export default defineConfig({
19
+ * plugins: [viteYak(), react()],
20
+ * });
21
+ * ```
22
+ */
23
+ export const viteYak = createViteYakPlugin({
24
+ name: "@yak/react",
25
+ reactRefreshReg: true,
26
+ excludePattern: /packages\/yak-react/,
27
+ foldStatic: true,
28
+ });
@@ -0,0 +1,44 @@
1
+ import type { LoaderContext } from "webpack";
2
+ import type { YakConfigOptions } from "../withYak/index.js";
3
+ import { createDebugLogger } from "yak-internals/debug-logger";
4
+ import { extractCss } from "yak-internals/extract-css";
5
+ import { resolveCrossFileConstant } from "./lib/resolveCrossFileSelectors.js";
6
+
7
+ /**
8
+ * Transform typescript to css
9
+ *
10
+ * This loader takes the cached result from the yak tsloader
11
+ * and extracts the css from the generated comments
12
+ */
13
+ export default async function cssExtractLoader(
14
+ this: LoaderContext<YakConfigOptions>,
15
+ // Instead of the source code, we receive the extracted css
16
+ // from the yak-swc transformation
17
+ _code: string,
18
+ sourceMap: string | undefined,
19
+ ): Promise<string | void> {
20
+ const callback = this.async();
21
+ // Load the module from the original typescript request (without !=! and the query)
22
+ return this.loadModule(this.resourcePath, (err, source) => {
23
+ if (err) {
24
+ return callback(err);
25
+ }
26
+ if (!source) {
27
+ return callback(new Error(`Source code for ${this.resourcePath} is empty`));
28
+ }
29
+ const { experiments } = this.getOptions();
30
+ const debugLog = createDebugLogger(
31
+ experiments?.debug,
32
+ this._compiler?.context ?? process.cwd(),
33
+ );
34
+
35
+ debugLog("ts", source, this.resourcePath);
36
+ const css = extractCss(source, experiments?.transpilationMode);
37
+ debugLog("css", css, this.resourcePath);
38
+
39
+ return resolveCrossFileConstant(this, this.context, css).then((result) => {
40
+ debugLog("css-resolved", result, this.resourcePath);
41
+ return callback(null, result, sourceMap);
42
+ }, callback);
43
+ });
44
+ }
package/package.json CHANGED
@@ -1,6 +1,217 @@
1
1
  {
2
2
  "name": "@yak/react",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "10.0.0-rc.0",
4
+ "description": "@yak/react is a CSS-in-JS library for React: styled-components syntax with CSS extracted at build time. Works with Next.js, Vite and Rsbuild.",
5
+ "keywords": [
6
+ "css-in-js",
7
+ "next.js",
8
+ "react",
9
+ "styled-components",
10
+ "typescript"
11
+ ],
12
+ "homepage": "https://yak.js.org/",
13
+ "bugs": {
14
+ "url": "https://github.com/DigitecGalaxus/next-yak/issues"
15
+ },
16
+ "license": "MIT",
17
+ "author": {
18
+ "name": "Jan Nicklas"
19
+ },
20
+ "maintainers": [
21
+ {
22
+ "name": "Luca Schneider"
23
+ }
24
+ ],
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "https://github.com/DigitecGalaxus/next-yak.git"
28
+ },
29
+ "files": [
30
+ "dist",
31
+ "loaders",
32
+ "runtime",
33
+ "withYak",
34
+ "rsbuild",
35
+ "LICENSE"
36
+ ],
37
+ "type": "module",
38
+ "sideEffects": false,
39
+ "types": "./dist/",
40
+ "exports": {
41
+ ".": {
42
+ "import": {
43
+ "types": "./dist/index.d.ts",
44
+ "default": "./dist/index.js"
45
+ },
46
+ "require": {
47
+ "types": "./dist/index.d.cts",
48
+ "default": "./dist/index.cjs"
49
+ }
50
+ },
51
+ "./static": {
52
+ "import": {
53
+ "types": "./dist/static/index.d.ts",
54
+ "default": "./dist/static/index.js"
55
+ },
56
+ "require": {
57
+ "types": "./dist/static/index.d.cts",
58
+ "default": "./dist/static/index.cjs"
59
+ }
60
+ },
61
+ "./internal": {
62
+ "import": {
63
+ "types": "./dist/internal.d.ts",
64
+ "default": "./dist/internal.js"
65
+ },
66
+ "require": {
67
+ "types": "./dist/internal.d.cts",
68
+ "default": "./dist/internal.cjs"
69
+ }
70
+ },
71
+ "./withYak": {
72
+ "import": {
73
+ "types": "./dist/withYak/index.d.ts",
74
+ "default": "./dist/withYak/index.js"
75
+ },
76
+ "require": {
77
+ "types": "./dist/withYak/index.d.cts",
78
+ "default": "./dist/withYak/index.cjs"
79
+ }
80
+ },
81
+ "./context/baseContext": {
82
+ "import": {
83
+ "types": "./dist/context/baseContext.d.ts",
84
+ "default": "./dist/context/baseContext.js"
85
+ },
86
+ "require": {
87
+ "types": "./dist/context/baseContext.d.cts",
88
+ "default": "./dist/context/baseContext.cjs"
89
+ }
90
+ },
91
+ "./context": {
92
+ "react-server": {
93
+ "import": {
94
+ "types": "./dist/context/index.server.d.ts",
95
+ "default": "./dist/context/index.server.js"
96
+ },
97
+ "require": {
98
+ "types": "./dist/context/index.server.d.cts",
99
+ "default": "./dist/context/index.server.cjs"
100
+ }
101
+ },
102
+ "default": {
103
+ "import": {
104
+ "types": "./dist/context/index.d.ts",
105
+ "default": "./dist/context/index.js"
106
+ },
107
+ "require": {
108
+ "types": "./dist/context/index.d.cts",
109
+ "default": "./dist/context/index.cjs"
110
+ }
111
+ }
112
+ },
113
+ "./jsx-runtime": {
114
+ "import": {
115
+ "types": "./dist/jsx-runtime.d.ts",
116
+ "default": "./dist/jsx-runtime.js"
117
+ },
118
+ "require": {
119
+ "types": "./dist/jsx-runtime.d.cts",
120
+ "default": "./dist/jsx-runtime.cjs"
121
+ }
122
+ },
123
+ "./jsx-dev-runtime": {
124
+ "import": {
125
+ "types": "./dist/jsx-dev-runtime.d.ts",
126
+ "default": "./dist/jsx-dev-runtime.js"
127
+ },
128
+ "require": {
129
+ "types": "./dist/jsx-dev-runtime.d.cts",
130
+ "default": "./dist/jsx-dev-runtime.cjs"
131
+ }
132
+ },
133
+ "./loaders/webpack-loader": "./dist/loaders/webpack-loader.cjs",
134
+ "./vite": {
135
+ "import": {
136
+ "types": "./dist/loaders/vite-plugin.d.ts",
137
+ "default": "./dist/loaders/vite-plugin.js"
138
+ }
139
+ },
140
+ "./cross-file-resolver": {
141
+ "import": {
142
+ "types": "./dist/cross-file-resolver/index.d.ts",
143
+ "default": "./dist/cross-file-resolver/index.js"
144
+ }
145
+ },
146
+ "./isolated-source-eval": {
147
+ "import": {
148
+ "types": "./dist/isolated-source-eval/index.d.ts",
149
+ "default": "./dist/isolated-source-eval/index.js"
150
+ }
151
+ },
152
+ "./rsbuild": {
153
+ "import": {
154
+ "types": "./dist/rsbuild/index.d.ts",
155
+ "default": "./dist/rsbuild/index.js"
156
+ }
157
+ }
158
+ },
159
+ "publishConfig": {
160
+ "access": "public"
161
+ },
162
+ "dependencies": {
163
+ "@babel/parser": "^8.0.4",
164
+ "@swc/core": "~1.15.47",
165
+ "@yak/swc": "10.0.0-rc.0"
166
+ },
167
+ "devDependencies": {
168
+ "@rsbuild/core": "2.2.2",
169
+ "@testing-library/react": "16.3.3",
170
+ "@types/jest": "30.0.0",
171
+ "@types/node": "26.4.1",
172
+ "@types/react": "19.2.18",
173
+ "@types/react-dom": "19.2.5",
174
+ "@types/webpack": "5.28.5",
175
+ "jsdom": "30.0.1",
176
+ "next": "16.3.4",
177
+ "react": "19.2.8",
178
+ "tsdown": "0.22.14",
179
+ "typescript": "6.0.3",
180
+ "vite": "8.2.2",
181
+ "vitest": "4.1.11",
182
+ "yak-internals": "0.0.0"
183
+ },
184
+ "peerDependencies": {
185
+ "@rsbuild/core": ">=2.0.0",
186
+ "@types/react": ">=19",
187
+ "next": ">=16.1.0",
188
+ "react": ">=19.0.0",
189
+ "vite": ">=7.0.0"
190
+ },
191
+ "peerDependenciesMeta": {
192
+ "@rsbuild/core": {
193
+ "optional": true
194
+ },
195
+ "@types/react": {
196
+ "optional": true
197
+ },
198
+ "next": {
199
+ "optional": true
200
+ },
201
+ "vite": {
202
+ "optional": true
203
+ },
204
+ "react": {
205
+ "optional": true
206
+ }
207
+ },
208
+ "scripts": {
209
+ "build": "tsdown",
210
+ "watch": "tsdown --watch",
211
+ "test": "vitest run",
212
+ "test:snapshots": "vitest run -u",
213
+ "test:types:code": "tsc -p tsconfig.json",
214
+ "test:types:test": "tsc -p ./runtime/__tests__/tsconfig.json",
215
+ "test:watch": "vitest --watch"
216
+ }
6
217
  }