next-with-linaria 0.1.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.
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Dario Lehmhus
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,101 @@
1
+ # Next.js 13 + Linaria
2
+
3
+ ## What is this?
4
+
5
+ The new Next.js 13 app directory feature doesn't work with the [@linaria/webpack5-loader](https://github.com/callstack/linaria/tree/master/packages/webpack5-loader) anymore, therefore the [next-linaria](https://github.com/Mistereo/next-linaria) package sadly also doesn't work. This package tries to solve that issue with a custom linaria webpack loader and [Webpack Virtual Modules](https://github.com/sysgears/webpack-virtual-modules).
6
+
7
+ ## Disclaimer
8
+
9
+ ⚠️ This package is still in development and not battle tested yet! Don't use it in production. ⚠️
10
+
11
+ ## Installation
12
+
13
+ <details open><summary>npm</summary>
14
+
15
+ ```sh
16
+ npm install next-with-linaria @linaria/core @linaria/react
17
+ ```
18
+
19
+ </details>
20
+ <details><summary>pnpm</summary>
21
+
22
+ ```sh
23
+ pnpm install next-with-linaria @linaria/core @linaria/react
24
+ ```
25
+
26
+ </details>
27
+ <details><summary>yarn</summary>
28
+
29
+ ```sh
30
+ yarn add next-with-linaria @linaria/core @linaria/react
31
+ ```
32
+
33
+ </details>
34
+
35
+ ## Usage
36
+
37
+ ```js
38
+ // next.config.js
39
+ const withLinaria = require('next-with-linaria');
40
+
41
+ /** @type {import('next-with-linaria').LinariaConfig} */
42
+ const config = {
43
+ experimental: {
44
+ appDir: true,
45
+ },
46
+ };
47
+ module.exports = withLinaria(config);
48
+ ```
49
+
50
+ Now you can use linaria in all the places where Next.js also allows you to use [CSS Modules](https://beta.nextjs.org/docs/styling/css-modules). That currently means in every file in in the `app` directory. And the `pages` directory of course as well.
51
+
52
+ ## Global Styles Restrictions
53
+
54
+ If you want to use linaria for [global styling](https://beta.nextjs.org/docs/styling/global-styles), you need to place those styles into a file with the suffix `.linaria.global.(js|jsx|ts|tsx)`:
55
+
56
+ ```tsx
57
+ // app/style.linaria.global.tsx
58
+ import { css } from '@linaria/core';
59
+
60
+ export const globals = css`
61
+ :global() {
62
+ html {
63
+ box-sizing: border-box;
64
+ }
65
+
66
+ *,
67
+ *:before,
68
+ *:after {
69
+ box-sizing: inherit;
70
+ }
71
+
72
+ @font-face {
73
+ font-family: 'MaterialIcons';
74
+ src: url(../assets/fonts/MaterialIcons.ttf) format('truetype');
75
+ }
76
+ }
77
+ `;
78
+ ```
79
+
80
+ ```tsx
81
+ // app/layout.tsx
82
+ import './style.linaria.global';
83
+
84
+ export default function RootLayout({
85
+ children,
86
+ }: {
87
+ children: React.ReactNode;
88
+ }) {
89
+ return (
90
+ <html lang="en">
91
+ <body>{children}</body>
92
+ </html>
93
+ );
94
+ }
95
+ ```
96
+
97
+ This convention is needed because the loader needs to know which files contain global styles and which don't.
98
+
99
+ ## Good to know
100
+
101
+ Because webpack 5 caches modules, the virtual CSS Modules need to be cached as well (so at that point the are not really virtual anymore, are they? Anyway...). They are placed in the same directory as where webpack puts its cache files. If the `next-with-linaria` cache is not in sync with the webpack cache anymore, it will cause errors due to missing CSS Modules. If you encounter such an error, you can delete the `.next/cache/webpack` folder and restart the dev server.
@@ -0,0 +1,13 @@
1
+ import type * as Webpack from 'webpack';
2
+ import VirtualModulesPlugin from 'webpack-virtual-modules';
3
+ export default class VirtualModuleStore {
4
+ private vmInstances;
5
+ private initialCachedFiles;
6
+ private cssCache;
7
+ private dependencyCache;
8
+ constructor(config: Webpack.Configuration);
9
+ createStore(name?: string): VirtualModulesPlugin;
10
+ addModule(path: string, content: string, addToCache?: boolean): void;
11
+ addModuleDependencies(modulePath: string, deps: string[]): void;
12
+ getModuleDependencies(modulePath: string): Promise<string[] | null>;
13
+ }
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const file_system_cache_1 = __importDefault(require("file-system-cache"));
7
+ const path_1 = __importDefault(require("path"));
8
+ const webpack_virtual_modules_1 = __importDefault(require("webpack-virtual-modules"));
9
+ const utils_1 = require("./utils");
10
+ class VirtualModuleStore {
11
+ constructor(config) {
12
+ this.vmInstances = new Map();
13
+ this.initialCachedFiles = {};
14
+ this.addModule = this.addModule.bind(this);
15
+ if ((0, utils_1.isFSCache)(config.cache)) {
16
+ const baseDir = config.cache.cacheDirectory ||
17
+ path_1.default.join(process.cwd(), '.linaria-cache');
18
+ const cachePath = path_1.default.join(baseDir, `linaria-${config.mode}`);
19
+ this.cssCache = (0, file_system_cache_1.default)({
20
+ basePath: cachePath,
21
+ ns: config.cache.version,
22
+ });
23
+ this.cssCache.load().then((cachedFiles) => {
24
+ cachedFiles.files.forEach(({ value: { content, path } }) => {
25
+ this.initialCachedFiles[path] = content;
26
+ this.addModule(path, content, false);
27
+ });
28
+ });
29
+ this.dependencyCache = (0, file_system_cache_1.default)({
30
+ basePath: cachePath,
31
+ ns: config.cache.version + '-deps',
32
+ });
33
+ }
34
+ }
35
+ createStore(name = 'default') {
36
+ const vm = new webpack_virtual_modules_1.default(this.initialCachedFiles);
37
+ this.vmInstances.set(name, vm);
38
+ return vm;
39
+ }
40
+ addModule(path, content, addToCache = true) {
41
+ this.vmInstances.forEach((vm) => {
42
+ vm.writeModule(path, content);
43
+ });
44
+ if (this.cssCache && addToCache) {
45
+ this.cssCache.set(path, { content, path });
46
+ }
47
+ }
48
+ addModuleDependencies(modulePath, deps) {
49
+ if (this.dependencyCache) {
50
+ this.dependencyCache.set(modulePath, deps);
51
+ }
52
+ }
53
+ async getModuleDependencies(modulePath) {
54
+ if (this.dependencyCache) {
55
+ return this.dependencyCache.get(modulePath);
56
+ }
57
+ return null;
58
+ }
59
+ }
60
+ exports.default = VirtualModuleStore;
61
+ //# sourceMappingURL=VirtualModuleStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VirtualModuleStore.js","sourceRoot":"","sources":["../src/VirtualModuleStore.ts"],"names":[],"mappings":";;;;;AAAA,0EAAgE;AAChE,gDAAwB;AAExB,sFAA2D;AAE3D,mCAAoC;AASpC,MAAqB,kBAAkB;IAMrC,YAAY,MAA6B;QALjC,gBAAW,GAAsC,IAAI,GAAG,EAAE,CAAC;QAC3D,uBAAkB,GAA2B,EAAE,CAAC;QAKtD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE3C,IAAI,IAAA,iBAAS,EAAC,MAAM,CAAC,KAAK,CAAC,EAAE;YAC3B,MAAM,OAAO,GACX,MAAM,CAAC,KAAK,CAAC,cAAc;gBAC3B,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,gBAAgB,CAAC,CAAC;YAE7C,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,CAAC;QACH,IAAI,IAAI,CAAC,QAAQ,IAAI,UAAU,EAAE;YAC/B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;SAC5C;IACH,CAAC;IAEM,qBAAqB,CAAC,UAAkB,EAAE,IAAc;QAC7D,IAAI,IAAI,CAAC,eAAe,EAAE;YACxB,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;SAC5C;IACH,CAAC;IAEM,KAAK,CAAC,qBAAqB,CAChC,UAAkB;QAElB,IAAI,IAAI,CAAC,eAAe,EAAE;YACxB,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;SAC7C;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAjED,qCAiEC"}
@@ -0,0 +1,8 @@
1
+ import type { RawLoaderDefinitionFunction } from 'webpack';
2
+ import VirtualModuleStore from './VirtualModuleStore';
3
+ declare type OutputLoaderOptions = {
4
+ moduleStore: VirtualModuleStore;
5
+ };
6
+ declare type LoaderType = RawLoaderDefinitionFunction<OutputLoaderOptions>;
7
+ declare const cssOutputLoader: LoaderType;
8
+ export default cssOutputLoader;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const cssOutputLoader = function (content, inputSourceMap) {
4
+ this.async();
5
+ const { moduleStore } = this.getOptions();
6
+ moduleStore
7
+ .getModuleDependencies(this.resourcePath)
8
+ .then((deps) => {
9
+ if (deps) {
10
+ deps.forEach((dep) => {
11
+ this.addDependency(dep);
12
+ });
13
+ }
14
+ })
15
+ .catch((err) => {
16
+ this.emitError(err);
17
+ console.error('Error getting dependencies for ' + this.resourcePath);
18
+ })
19
+ .finally(() => {
20
+ this.callback(null, content, inputSourceMap);
21
+ });
22
+ };
23
+ exports.default = cssOutputLoader;
24
+ //# sourceMappingURL=outputCssLoader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outputCssLoader.js","sourceRoot":"","sources":["../src/outputCssLoader.ts"],"names":[],"mappings":";;AAaA,MAAM,eAAe,GAAe,UAAU,OAAO,EAAE,cAAc;IACnE,IAAI,CAAC,KAAK,EAAE,CAAC;IAEb,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;IAC1C,WAAW;SACR,qBAAqB,CAAC,IAAI,CAAC,YAAY,CAAC;SACxC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;QACb,IAAI,IAAI,EAAE;YACR,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBACnB,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;YAC1B,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACb,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,iCAAiC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC;IACvE,CAAC,CAAC;SACD,OAAO,CAAC,GAAG,EAAE;QACZ,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,kBAAe,eAAe,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { PluginOptions, Preprocessor } from '@linaria/babel-preset';
2
+ import type { RawLoaderDefinitionFunction } from 'webpack';
3
+ import VirtualModuleStore from './VirtualModuleStore';
4
+ export declare const LINARIA_MODULE_EXTENSION = ".linaria.module";
5
+ export declare const LINARIA_GLOBAL_EXTENSION = ".linaria.global";
6
+ export declare const regexLinariaModuleCSS: RegExp;
7
+ export declare const regexLinariaGlobalCSS: RegExp;
8
+ export declare const regexLinariaCSS: RegExp;
9
+ export declare type LinariaLoaderOptions = {
10
+ moduleStore: VirtualModuleStore;
11
+ preprocessor?: Preprocessor;
12
+ sourceMap?: boolean;
13
+ } & Partial<PluginOptions>;
14
+ declare type LoaderType = RawLoaderDefinitionFunction<LinariaLoaderOptions>;
15
+ declare const transformLoader: LoaderType;
16
+ export default transformLoader;
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.regexLinariaCSS = exports.regexLinariaGlobalCSS = exports.regexLinariaModuleCSS = exports.LINARIA_GLOBAL_EXTENSION = exports.LINARIA_MODULE_EXTENSION = void 0;
18
+ const babel_preset_1 = require("@linaria/babel-preset");
19
+ const path_1 = __importDefault(require("path"));
20
+ exports.LINARIA_MODULE_EXTENSION = '.linaria.module';
21
+ exports.LINARIA_GLOBAL_EXTENSION = '.linaria.global';
22
+ exports.regexLinariaModuleCSS = /\.linaria\.module\.css$/;
23
+ exports.regexLinariaGlobalCSS = /\.linaria\.global\.css$/;
24
+ exports.regexLinariaCSS = /\.linaria\.(module|global)\.css$/;
25
+ function convertSourceMap(value, filename) {
26
+ var _a, _b, _c, _d, _e;
27
+ if (typeof value === 'string' || !value) {
28
+ return undefined;
29
+ }
30
+ return Object.assign(Object.assign({}, value), { file: (_a = value.file) !== null && _a !== void 0 ? _a : filename, mappings: (_b = value.mappings) !== null && _b !== void 0 ? _b : '', names: (_c = value.names) !== null && _c !== void 0 ? _c : [], sources: (_d = value.sources) !== null && _d !== void 0 ? _d : [], version: (_e = value.version) !== null && _e !== void 0 ? _e : 3 });
31
+ }
32
+ const transformLoader = function (content, inputSourceMap) {
33
+ this.async();
34
+ const _a = this.getOptions() || {}, { sourceMap = undefined, preprocessor = undefined, moduleStore } = _a, rest = __rest(_a, ["sourceMap", "preprocessor", "moduleStore"]);
35
+ const asyncResolve = (token, importer) => {
36
+ const context = path_1.default.isAbsolute(importer)
37
+ ? path_1.default.dirname(importer)
38
+ : path_1.default.join(process.cwd(), path_1.default.dirname(importer));
39
+ return new Promise((resolve, reject) => {
40
+ this.resolve(context, token, (err, result) => {
41
+ if (err) {
42
+ console.error(err);
43
+ reject(err);
44
+ }
45
+ else if (result) {
46
+ this.addDependency(result);
47
+ resolve(result);
48
+ }
49
+ else {
50
+ reject(new Error(`Cannot resolve ${token}`));
51
+ }
52
+ });
53
+ });
54
+ };
55
+ (0, babel_preset_1.transform)(content.toString(), {
56
+ filename: this.resourcePath,
57
+ inputSourceMap: convertSourceMap(inputSourceMap, this.resourcePath),
58
+ pluginOptions: rest,
59
+ preprocessor,
60
+ }, asyncResolve).then(async (result) => {
61
+ var _a, _b, _c, _d;
62
+ if (result.cssText) {
63
+ let { cssText } = result;
64
+ if (sourceMap) {
65
+ cssText += `/*# sourceMappingURL=data:application/json;base64,${Buffer.from(result.cssSourceMapText || '').toString('base64')}*/`;
66
+ }
67
+ await Promise.all((_b = (_a = result.dependencies) === null || _a === void 0 ? void 0 : _a.map((dep) => asyncResolve(dep, this.resourcePath))) !== null && _b !== void 0 ? _b : []);
68
+ try {
69
+ const filename = path_1.default.basename(this.resourcePath, path_1.default.extname(this.resourcePath));
70
+ const fileDir = path_1.default.dirname(this.resourcePath);
71
+ const isGlobalStyle = filename.endsWith(exports.LINARIA_GLOBAL_EXTENSION);
72
+ const outputFileName = path_1.default.join(fileDir, `${filename}${isGlobalStyle ? '' : exports.LINARIA_MODULE_EXTENSION}.css`);
73
+ moduleStore.addModule(outputFileName, cssText);
74
+ moduleStore.addModuleDependencies(outputFileName, this.getDependencies());
75
+ this.callback(null, `${result.code}\n\nrequire("${outputFileName}");`, (_c = result.sourceMap) !== null && _c !== void 0 ? _c : undefined);
76
+ }
77
+ catch (err) {
78
+ this.callback(err);
79
+ }
80
+ return;
81
+ }
82
+ this.callback(null, result.code, (_d = result.sourceMap) !== null && _d !== void 0 ? _d : undefined);
83
+ }, (err) => this.callback(err));
84
+ };
85
+ exports.default = transformLoader;
86
+ //# sourceMappingURL=transformLoader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformLoader.js","sourceRoot":"","sources":["../src/transformLoader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAcA,wDAAkD;AAClD,gDAAwB;AAKX,QAAA,wBAAwB,GAAG,iBAAiB,CAAC;AAC7C,QAAA,wBAAwB,GAAG,iBAAiB,CAAC;AAE7C,QAAA,qBAAqB,GAAG,yBAAyB,CAAC;AAClD,QAAA,qBAAqB,GAAG,yBAAyB,CAAC;AAClD,QAAA,eAAe,GAAG,kCAAkC,CAAC;AAUlE,SAAS,gBAAgB,CACvB,KAAgC,EAChC,QAAgB;;IAEhB,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,EAAE;QACvC,OAAO,SAAS,CAAC;KAClB;IAED,uCACK,KAAK,KACR,IAAI,EAAE,MAAA,KAAK,CAAC,IAAI,mCAAI,QAAQ,EAC5B,QAAQ,EAAE,MAAA,KAAK,CAAC,QAAQ,mCAAI,EAAE,EAC9B,KAAK,EAAE,MAAA,KAAK,CAAC,KAAK,mCAAI,EAAE,EACxB,OAAO,EAAE,MAAA,KAAK,CAAC,OAAO,mCAAI,EAAE,EAC5B,OAAO,EAAE,MAAA,KAAK,CAAC,OAAO,mCAAI,CAAC,IAC3B;AACJ,CAAC;AAED,MAAM,eAAe,GAAe,UAAU,OAAO,EAAE,cAAc;IAEnE,IAAI,CAAC,KAAK,EAAE,CAAC;IAEb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ACH;YAAC,OAAO,GAAG,EAAE;gBACZ,IAAI,CAAC,QAAQ,CAAC,GAAY,CAAC,CAAC;aAC7B;YAED,OAAO;SACR;QAED,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,MAAA,MAAM,CAAC,SAAS,mCAAI,SAAS,CAAC,CAAC;IAClE,CAAC,EACD,CAAC,GAAU,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CACnC,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,eAAe,CAAC"}
package/lib/utils.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ import type * as Webpack from 'webpack';
2
+ declare type CssModuleType = {
3
+ auto: boolean | RegExp | ((resourcePath: string) => boolean);
4
+ exportGlobals: boolean;
5
+ exportLocalsConvention: 'asIs' | 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly' | ((name: string) => string);
6
+ exportOnlyLocals: boolean;
7
+ getLocalIdent: (context: Webpack.LoaderContext<unknown>, localIdentName: string, exportName: string, options: object) => string;
8
+ localIdentContext: string;
9
+ localIdentHashDigest: string;
10
+ localIdentHashFunction: string;
11
+ localIdentHashSalt: string;
12
+ localIdentName: string;
13
+ localIdentRegExp: string | RegExp;
14
+ mode: 'local' | 'global' | 'pure' | 'icss' | ((resourcePath: string) => 'local' | 'global' | 'pure' | 'icss');
15
+ namedExport: boolean;
16
+ };
17
+ export declare function isCssModule(rule: Webpack.RuleSetRule): rule is Webpack.RuleSetRule & {
18
+ options: {
19
+ modules: CssModuleType;
20
+ };
21
+ };
22
+ export declare function isCssLoader(rule: Webpack.RuleSetRule): boolean;
23
+ export declare function isFSCache(cache: Webpack.Configuration['cache']): cache is Webpack.FileCacheOptions;
24
+ export {};
package/lib/utils.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isFSCache = exports.isCssLoader = exports.isCssModule = void 0;
4
+ function isCssModule(rule) {
5
+ return (rule.options &&
6
+ typeof rule.options === 'object' &&
7
+ rule.options.modules &&
8
+ typeof rule.options.modules.getLocalIdent === 'function');
9
+ }
10
+ exports.isCssModule = isCssModule;
11
+ function isCssLoader(rule) {
12
+ return typeof rule.loader === 'string' && rule.loader.includes('css-loader');
13
+ }
14
+ exports.isCssLoader = isCssLoader;
15
+ function isFSCache(cache) {
16
+ return typeof cache === 'object' && cache.type === 'filesystem';
17
+ }
18
+ exports.isFSCache = isFSCache;
19
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAkCA,SAAgB,WAAW,CACzB,IAAyB;IAEzB,OAAO,CACL,IAAI,CAAC,OAAO;QACZ,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ;QAChC,IAAI,CAAC,OAAO,CAAC,OAAO;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,KAAK,UAAU,CACzD,CAAC;AACJ,CAAC;AATD,kCASC;AAED,SAAgB,WAAW,CAAC,IAAyB;IACnD,OAAO,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AAC/E,CAAC;AAFD,kCAEC;AAED,SAAgB,SAAS,CACvB,KAAqC;IAErC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,CAAC;AAClE,CAAC;AAJD,8BAIC"}
@@ -0,0 +1,104 @@
1
+ import type { NextConfig } from 'next';
2
+ import type * as NextServer from 'next/dist/server/config-shared';
3
+ import type * as Webpack from 'webpack';
4
+ import { LinariaLoaderOptions } from './transformLoader';
5
+ export declare type LinariaConfig = NextConfig & {
6
+ linaria?: Omit<LinariaLoaderOptions, 'moduleStore'>;
7
+ };
8
+ export default function withLinaria({ linaria, ...nextConfig }: LinariaConfig): {
9
+ webpack: (config: Webpack.Configuration, options: NextServer.WebpackConfigContext) => any;
10
+ exportPathMap?: ((defaultMap: NextServer.ExportPathMap, ctx: {
11
+ dev: boolean;
12
+ dir: string;
13
+ outDir: string | null;
14
+ distDir: string;
15
+ buildId: string;
16
+ }) => NextServer.ExportPathMap | Promise<NextServer.ExportPathMap>) | undefined;
17
+ i18n?: NextServer.I18NConfig | null | undefined;
18
+ eslint?: NextServer.ESLintConfig | undefined;
19
+ typescript?: NextServer.TypeScriptConfig | undefined;
20
+ headers?: (() => Promise<import("next/dist/lib/load-custom-routes").Header[]>) | undefined;
21
+ rewrites?: (() => Promise<import("next/dist/lib/load-custom-routes").Rewrite[] | {
22
+ beforeFiles: import("next/dist/lib/load-custom-routes").Rewrite[];
23
+ afterFiles: import("next/dist/lib/load-custom-routes").Rewrite[];
24
+ fallback: import("next/dist/lib/load-custom-routes").Rewrite[];
25
+ }>) | undefined;
26
+ redirects?: (() => Promise<import("next/dist/lib/load-custom-routes").Redirect[]>) | undefined;
27
+ excludeDefaultMomentLocales?: boolean | undefined;
28
+ trailingSlash?: boolean | undefined;
29
+ env?: Record<string, string> | undefined;
30
+ distDir?: string | undefined;
31
+ cleanDistDir?: boolean | undefined;
32
+ assetPrefix?: string | undefined;
33
+ useFileSystemPublicRoutes?: boolean | undefined;
34
+ generateBuildId?: (() => string | Promise<string | null> | null) | undefined;
35
+ generateEtags?: boolean | undefined;
36
+ pageExtensions?: string[] | undefined;
37
+ compress?: boolean | undefined;
38
+ analyticsId?: string | undefined;
39
+ poweredByHeader?: boolean | undefined;
40
+ images?: Partial<import("next/dist/shared/lib/image-config").ImageConfigComplete> | undefined;
41
+ devIndicators?: {
42
+ buildActivity?: boolean | undefined;
43
+ buildActivityPosition?: "bottom-right" | "bottom-left" | "top-right" | "top-left" | undefined;
44
+ } | undefined;
45
+ onDemandEntries?: {
46
+ maxInactiveAge?: number | undefined;
47
+ pagesBufferLength?: number | undefined;
48
+ } | undefined;
49
+ amp?: {
50
+ canonicalBase?: string | undefined;
51
+ } | undefined;
52
+ basePath?: string | undefined;
53
+ sassOptions?: {
54
+ [key: string]: any;
55
+ } | undefined;
56
+ productionBrowserSourceMaps?: boolean | undefined;
57
+ optimizeFonts?: boolean | undefined;
58
+ reactStrictMode?: boolean | null | undefined;
59
+ publicRuntimeConfig?: {
60
+ [key: string]: any;
61
+ } | undefined;
62
+ serverRuntimeConfig?: {
63
+ [key: string]: any;
64
+ } | undefined;
65
+ httpAgentOptions?: {
66
+ keepAlive?: boolean | undefined;
67
+ } | undefined;
68
+ outputFileTracing?: boolean | undefined;
69
+ staticPageGenerationTimeout?: number | undefined;
70
+ crossOrigin?: false | "anonymous" | "use-credentials" | undefined;
71
+ swcMinify?: boolean | undefined;
72
+ compiler?: {
73
+ reactRemoveProperties?: boolean | {
74
+ properties?: string[] | undefined;
75
+ } | undefined;
76
+ relay?: {
77
+ src: string;
78
+ artifactDirectory?: string | undefined;
79
+ language?: "typescript" | "flow" | undefined;
80
+ } | undefined;
81
+ removeConsole?: boolean | {
82
+ exclude?: string[] | undefined;
83
+ } | undefined;
84
+ styledComponents?: boolean | {
85
+ displayName?: boolean | undefined;
86
+ topLevelImportPaths?: string[] | undefined;
87
+ ssr?: boolean | undefined;
88
+ fileName?: boolean | undefined;
89
+ meaninglessFileNames?: string[] | undefined;
90
+ minify?: boolean | undefined;
91
+ transpileTemplateLiterals?: boolean | undefined;
92
+ namespace?: string | undefined;
93
+ pure?: boolean | undefined;
94
+ cssProp?: boolean | undefined;
95
+ } | undefined;
96
+ emotion?: boolean | {
97
+ sourceMap?: boolean | undefined;
98
+ autoLabel?: "dev-only" | "always" | "never" | undefined;
99
+ labelFormat?: string | undefined;
100
+ } | undefined;
101
+ } | undefined;
102
+ output?: "standalone" | undefined;
103
+ experimental?: NextServer.ExperimentalConfig | undefined;
104
+ };
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ const path_1 = __importDefault(require("path"));
18
+ const transformLoader_1 = require("./transformLoader");
19
+ const utils_1 = require("./utils");
20
+ const VirtualModuleStore_1 = __importDefault(require("./VirtualModuleStore"));
21
+ function traverseLoaders(rules) {
22
+ for (const rule of rules) {
23
+ if ((0, utils_1.isCssLoader)(rule)) {
24
+ if ((0, utils_1.isCssModule)(rule)) {
25
+ const nextGetLocalIdent = rule.options.modules.getLocalIdent;
26
+ const nextMode = rule.options.modules.mode;
27
+ rule.options.modules.mode = (path) => {
28
+ const isGlobal = transformLoader_1.regexLinariaGlobalCSS.test(path);
29
+ if (isGlobal) {
30
+ return 'local';
31
+ }
32
+ return typeof nextMode === 'function' ? nextMode(path) : nextMode;
33
+ };
34
+ rule.options.modules.getLocalIdent = (context, _, exportName, ...rest) => {
35
+ if (transformLoader_1.regexLinariaCSS.test(context.resourcePath)) {
36
+ return exportName;
37
+ }
38
+ return nextGetLocalIdent(context, _, exportName, ...rest);
39
+ };
40
+ }
41
+ }
42
+ if (typeof rule.use === 'object') {
43
+ const useRules = rule.use;
44
+ traverseLoaders(Array.isArray(useRules) ? useRules : [useRules]);
45
+ }
46
+ if (Array.isArray(rule.oneOf)) {
47
+ traverseLoaders(rule.oneOf);
48
+ }
49
+ }
50
+ }
51
+ let moduleStore;
52
+ function withLinaria(_a) {
53
+ var { linaria = {} } = _a, nextConfig = __rest(_a, ["linaria"]);
54
+ const webpack = (config, options) => {
55
+ var _a;
56
+ if (((_a = config.module) === null || _a === void 0 ? void 0 : _a.rules) && config.plugins) {
57
+ traverseLoaders(config.module.rules);
58
+ if (!moduleStore) {
59
+ moduleStore = new VirtualModuleStore_1.default(config);
60
+ }
61
+ config.plugins.push(moduleStore.createStore(config.name));
62
+ config.module.rules.push({
63
+ test: transformLoader_1.regexLinariaCSS,
64
+ exclude: /node_modules/,
65
+ use: [
66
+ {
67
+ loader: path_1.default.resolve(__dirname, './outputCssLoader'),
68
+ options: {
69
+ moduleStore,
70
+ },
71
+ },
72
+ ],
73
+ });
74
+ const linariaLoaderOptions = Object.assign(Object.assign({ sourceMap: process.env.NODE_ENV !== 'production', displayName: process.env.NODE_ENV !== 'production', babelOptions: {
75
+ presets: ['next/babel', '@linaria'],
76
+ } }, linaria), { moduleStore });
77
+ config.module.rules.push({
78
+ test: /\.(tsx|ts|js|mjs|jsx)$/,
79
+ exclude: /node_modules/,
80
+ use: [
81
+ {
82
+ loader: path_1.default.resolve(__dirname, './transformLoader'),
83
+ options: linariaLoaderOptions,
84
+ },
85
+ ],
86
+ });
87
+ }
88
+ if (typeof nextConfig.webpack === 'function') {
89
+ return nextConfig.webpack(config, options);
90
+ }
91
+ return config;
92
+ };
93
+ return Object.assign(Object.assign({}, nextConfig), { webpack });
94
+ }
95
+ exports.default = withLinaria;
96
+ module.exports = withLinaria;
97
+ //# sourceMappingURL=webpackConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webpackConfig.js","sourceRoot":"","sources":["../src/webpackConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAEA,gDAAwB;AAGxB,uDAI2B;AAC3B,mCAAmD;AACnD,8EAAsD;AAItD,SAAS,eAAe,CAAC,KAA4B;IACnD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,IAAI,IAAA,mBAAW,EAAC,IAAI,CAAC,EAAE;YACrB,IAAI,IAAA,mBAAW,EAAC,I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mBAAmB,CAAC;wBACpD,OAAO,EAAE,oBAAoB;qBAC9B;iBACF;aACF,CAAC,CAAC;SACJ;QAED,IAAI,OAAO,UAAU,CAAC,OAAO,KAAK,UAAU,EAAE;YAC5C,OAAO,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;SAC5C;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IAEF,uCACK,UAAU,KACb,OAAO,IACP;AACJ,CAAC;AAhED,8BAgEC;AAED,MAAM,CAAC,OAAO,GAAG,WAAW,CAAC"}
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "next-with-linaria",
3
+ "version": "0.1.0",
4
+ "description": "Linaria support for Next.js 13 app directory feature",
5
+ "main": "lib/webpackConfig.js",
6
+ "scripts": {
7
+ "build": "tsc",
8
+ "watch": "tsc -w",
9
+ "clean": "rm -rf lib",
10
+ "lint": "eslint --fix src/**",
11
+ "test": "pnpm test --filter ./tests/example",
12
+ "prepublish": "pnpm run clean && pnpm run build"
13
+ },
14
+ "packageManager": "pnpm@7.14.0",
15
+ "devDependencies": {
16
+ "@typescript-eslint/eslint-plugin": "^5.42.1",
17
+ "@typescript-eslint/parser": "^5.42.1",
18
+ "eslint": "^8.27.0",
19
+ "eslint-config-prettier": "^8.5.0",
20
+ "eslint-plugin-prettier": "^4.2.1",
21
+ "eslint-plugin-simple-import-sort": "^8.0.0",
22
+ "eslint-plugin-typescript-sort-keys": "^2.1.0",
23
+ "eslint-plugin-unused-imports": "^2.0.0",
24
+ "is-ci": "3.0.1",
25
+ "lint-staged": "13.0.3",
26
+ "next": "^13.0.2",
27
+ "prettier": "^2.7.1",
28
+ "simple-git-hooks": "2.8.1",
29
+ "typescript": "^4.8.4",
30
+ "webpack": "^5.74.0"
31
+ },
32
+ "peerDependencies": {
33
+ "webpack": "^5.74.0"
34
+ },
35
+ "dependencies": {
36
+ "@linaria/babel-preset": "^4.3.0",
37
+ "file-system-cache": "2.0.1",
38
+ "webpack-virtual-modules": "0.4.6"
39
+ },
40
+ "pnpm": {
41
+ "patchedDependencies": {
42
+ "webpack-virtual-modules@0.4.6": "patches/webpack-virtual-modules@0.4.6.patch"
43
+ }
44
+ },
45
+ "files": [
46
+ "lib"
47
+ ],
48
+ "simple-git-hooks": {
49
+ "pre-commit": "pnpm exec lint-staged"
50
+ },
51
+ "lint-staged": {
52
+ "**/*.(js|jsx|ts|tsx)": [
53
+ "eslint --fix"
54
+ ],
55
+ "**/*.(js|jsx|ts|tsx|json|css|md|mdx)": [
56
+ "prettier --write"
57
+ ]
58
+ },
59
+ "author": "Dario Lehmhus",
60
+ "license": "MIT",
61
+ "repository": {
62
+ "type": "git",
63
+ "url": "git+https://github.com/dlehmhus/next-with-linaria.git"
64
+ },
65
+ "bugs": {
66
+ "url": "https://github.com/dlehmhus/next-with-linaria/issues"
67
+ },
68
+ "homepage": "https://github.com/dlehmhus/next-with-linaria#readme",
69
+ "keywords": [
70
+ "linaria",
71
+ "next",
72
+ "next.js",
73
+ "css"
74
+ ]
75
+ }