From 4c58d0dfd69e02ac748319fec639685fce2f0efa Mon Sep 17 00:00:00 2001 From: Zn4rK Date: Wed, 10 Apr 2024 16:57:18 +0200 Subject: [PATCH 1/2] fix the cache for next.js --- examples/with-next-app-dir/package.json | 4 +- .../with-next-app-dir/src/app/edge/page.tsx | 4 +- examples/with-next-app-dir/src/app/page.tsx | 4 +- package.json | 2 +- packages/next-plugin/src/index.ts | 62 +++++- packages/webpack-plugin/src/index.ts | 24 ++- pnpm-lock.yaml | 197 ++++++++++++++++-- scripts/build/tsconfig.json | 2 +- 8 files changed, 265 insertions(+), 34 deletions(-) diff --git a/examples/with-next-app-dir/package.json b/examples/with-next-app-dir/package.json index fdbd2d1..d24b45a 100644 --- a/examples/with-next-app-dir/package.json +++ b/examples/with-next-app-dir/package.json @@ -3,8 +3,8 @@ "name": "with-next-app-dir", "version": "0.0.0", "scripts": { - "dev": "rimraf .next && next dev", - "build": "rimraf .next && next build", + "dev": "next dev", + "build": "next build", "start": "next start", "lint": "next lint" }, diff --git a/examples/with-next-app-dir/src/app/edge/page.tsx b/examples/with-next-app-dir/src/app/edge/page.tsx index 268f67f..7f08ab0 100644 --- a/examples/with-next-app-dir/src/app/edge/page.tsx +++ b/examples/with-next-app-dir/src/app/edge/page.tsx @@ -1,7 +1,9 @@ import { style } from "@navita/css"; const y = style({ - background: 'dimgray', + background: 'hotpink', + color: 'white', + padding: 20, }); export default function Edge() { diff --git a/examples/with-next-app-dir/src/app/page.tsx b/examples/with-next-app-dir/src/app/page.tsx index 934737b..4f6a2f4 100644 --- a/examples/with-next-app-dir/src/app/page.tsx +++ b/examples/with-next-app-dir/src/app/page.tsx @@ -1,8 +1,8 @@ import { style } from "@navita/css"; const container = style({ - background: 'royalblue', - color: 'white', + background: 'orange', + color: 'black', fontSize: '2rem', padding: '1rem', }); diff --git a/package.json b/package.json index 3bcc384..cde409e 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "jest": "workspace:*", "prettier": "latest", "turbo": "^1.10.7", - "typescript": "5.1.3" + "typescript": "5.4.5" }, "devDependencies": { "@types/node": "^18.14.0" diff --git a/packages/next-plugin/src/index.ts b/packages/next-plugin/src/index.ts index 9e259d7..ede98f1 100644 --- a/packages/next-plugin/src/index.ts +++ b/packages/next-plugin/src/index.ts @@ -1,4 +1,6 @@ -import type { Options } from "@navita/webpack-plugin"; +import * as fs from "fs"; +import path from "node:path"; +import type { Options, Renderer } from "@navita/webpack-plugin"; import { getNavitaModule, NavitaPlugin, NAVITA_MODULE_TYPE } from "@navita/webpack-plugin"; import type MiniCssExtractPluginType from "mini-css-extract-plugin"; import type { NextConfig } from "next"; @@ -8,11 +10,12 @@ import { findPagesDir } from "next/dist/lib/find-pages-dir"; import type { Configuration } from "webpack"; import { optimizeCSSOutput } from "./optimizeCSSOutput"; -const MiniCssExtractPlugin = NextMiniCssExtractPluginDefault['default'] as typeof MiniCssExtractPluginType; +let renderer: Renderer; +let lastCache: string; -type WebpackOptions = Options; +const MiniCssExtractPlugin = NextMiniCssExtractPluginDefault['default'] as typeof MiniCssExtractPluginType; -interface Config extends WebpackOptions { +interface Config extends Omit { singleCssFile?: boolean; } @@ -94,8 +97,59 @@ export const createNavitaStylePlugin = (navitaConfig: Config = {}) => }; } + // Next.js creates at least three webpack instances. We can't rely on the webpack cache. + const { cache, mode } = config; + + const cacheDirectory = ( + typeof cache !== "boolean" && cache.type === "filesystem" ? + path.resolve(cache.cacheDirectory, `navita-${mode}`) : + undefined + ); + + const cacheDestination = path.resolve(cacheDirectory, 'data.txt'); + + const onRenderInitialized = async (createdRenderer: Renderer) => { + renderer = createdRenderer; + + try { + // Ensure the cache directory exists: + await fs.promises.mkdir(cacheDirectory, { recursive: true }); + + const content = await fs.promises.readFile(cacheDestination, 'utf-8'); + + await renderer.engine.deserialize(content); + + lastCache = renderer.engine.serialize(); + } catch { + // This will happen if the user doesn't have write access to the cache directory. + // But the same should happen with the webpack cache. + } + }; + + config.plugins?.push({ + apply(compiler) { + compiler.hooks.afterEmit.tapPromise(`${NavitaPlugin.pluginName}-nextjs-custom-cache`, async () => { + if (!renderer) { + return; + } + + const newCache = renderer.engine.serialize(); + + if (newCache === lastCache) { + return; + } + + lastCache = newCache; + + await fs.promises.writeFile(cacheDestination, newCache); + }); + } + }); + config.plugins?.push( new NavitaPlugin({ + useWebpackCache: false, + onRenderInitialized, outputCss, ...navitaConfig, optimizeCSSOutput, diff --git a/packages/webpack-plugin/src/index.ts b/packages/webpack-plugin/src/index.ts index a063bd1..c9054f5 100644 --- a/packages/webpack-plugin/src/index.ts +++ b/packages/webpack-plugin/src/index.ts @@ -14,6 +14,7 @@ import { prepareCssOutput } from "./prepareCssOutput"; export { getNavitaDependency, getNavitaModule, NAVITA_MODULE_TYPE }; export { CSSOutput, Engine, Compilation, UsedIdCache }; +export type { Renderer }; type MiniCSSExtractPlugin = { options: { @@ -28,10 +29,19 @@ export interface Options { importMap?: ImportMap; optimizeCSSOutput?: (output: CSSOutput, compilation?: Compilation, engine?: Engine) => CSSOutput; engineOptions?: EngineOptions; + onRenderInitialized?: (renderer: Renderer) => Promise; + /** + * This uses webpacks cache to store the engine state between builds. + * If you have more than one webpack instance running at the same time, + * you should disable this option, and instead do something similar to + * what is done in the `next-plugin` package. + */ + useWebpackCache?: boolean; } const defaultOptions: Options = { outputCss: true, + useWebpackCache: true, exclude: /node_modules/, importMap: [], }; @@ -63,6 +73,8 @@ export class NavitaPlugin { outputCss, optimizeCSSOutput, engineOptions, + useWebpackCache, + onRenderInitialized, } = this.options; const importMap = [ @@ -72,8 +84,6 @@ export class NavitaPlugin { const dev = compiler.options.mode !== "production"; - const cacheName = `${NavitaPlugin.pluginName}-${compiler.options.mode}`; - const defaultEngineOptions = { enableSourceMaps: dev, enableDebugIdentifiers: dev, @@ -116,6 +126,16 @@ export class NavitaPlugin { } }); + if (onRenderInitialized) { + await onRenderInitialized(renderer); + } + + if (!useWebpackCache) { + return; + } + + const cacheName = `${NavitaPlugin.pluginName}-${compiler.options.mode}`; + const result = await compilation .getCache(cacheName) .getPromise(NavitaPlugin.pluginName, cacheKey); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 75fdd37..9ee004c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -33,8 +33,8 @@ importers: specifier: ^1.10.7 version: 1.10.7 typescript: - specifier: 5.1.3 - version: 5.1.3 + specifier: 5.4.5 + version: 5.4.5 devDependencies: '@types/node': specifier: ^18.14.0 @@ -454,7 +454,7 @@ importers: version: 5.0.2(rollup@3.29.4) '@rollup/plugin-typescript': specifier: ^11.1.1 - version: 11.1.1(rollup@3.29.4)(tslib@2.5.2)(typescript@5.1.6) + version: 11.1.1(rollup@3.29.4)(tslib@2.5.2)(typescript@5.4.5) '@swc/core': specifier: 1.3.3 version: 1.3.3 @@ -475,7 +475,7 @@ importers: version: 3.4.0 rollup-plugin-dts: specifier: ^5.3.0 - version: 5.3.0(rollup@3.29.4)(typescript@5.1.6) + version: 5.3.0(rollup@3.29.4)(typescript@5.4.5) rollup-plugin-multi-input: specifier: ^1.4.1 version: 1.4.1 @@ -487,7 +487,7 @@ importers: version: 0.8.1(@swc/core@1.3.3)(rollup@3.29.4) ts-node: specifier: ^10.9.1 - version: 10.9.1(@swc/core@1.3.3)(@types/node@20.4.8)(typescript@5.1.6) + version: 10.9.1(@swc/core@1.3.3)(@types/node@20.4.8)(typescript@5.4.5) tslib: specifier: ^2.5.2 version: 2.5.2 @@ -503,10 +503,10 @@ importers: dependencies: '@typescript-eslint/eslint-plugin': specifier: ^5.57.1 - version: 5.57.1(@typescript-eslint/parser@5.57.1)(eslint@8.46.0)(typescript@5.1.6) + version: 5.57.1(@typescript-eslint/parser@5.57.1)(eslint@8.46.0)(typescript@5.4.5) '@typescript-eslint/parser': specifier: ^5.57.1 - version: 5.57.1(eslint@8.46.0)(typescript@5.1.6) + version: 5.57.1(eslint@8.46.0)(typescript@5.4.5) eslint-config-prettier: specifier: ^8.9.0 version: 8.9.0(eslint@8.46.0) @@ -3752,7 +3752,7 @@ packages: rollup: 3.29.4 dev: false - /@rollup/plugin-typescript@11.1.1(rollup@3.29.4)(tslib@2.5.2)(typescript@5.1.6): + /@rollup/plugin-typescript@11.1.1(rollup@3.29.4)(tslib@2.5.2)(typescript@5.4.5): resolution: {integrity: sha512-Ioir+x5Bejv72Lx2Zbz3/qGg7tvGbxQZALCLoJaGrkNXak/19+vKgKYJYM3i/fJxvsb23I9FuFQ8CUBEfsmBRg==} engines: {node: '>=14.0.0'} peerDependencies: @@ -3769,7 +3769,7 @@ packages: resolve: 1.22.2 rollup: 3.29.4 tslib: 2.5.2 - typescript: 5.1.6 + typescript: 5.4.5 dev: false /@rollup/pluginutils@4.2.1: @@ -4525,6 +4525,35 @@ packages: typescript: 5.1.6 transitivePeerDependencies: - supports-color + dev: true + + /@typescript-eslint/eslint-plugin@5.57.1(@typescript-eslint/parser@5.57.1)(eslint@8.46.0)(typescript@5.4.5): + resolution: {integrity: sha512-1MeobQkQ9tztuleT3v72XmY0XuKXVXusAhryoLuU5YZ+mXoYKZP9SQ7Flulh1NX4DTjpGTc2b/eMu4u7M7dhnQ==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + '@typescript-eslint/parser': ^5.0.0 + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@eslint-community/regexpp': 4.6.2 + '@typescript-eslint/parser': 5.57.1(eslint@8.46.0)(typescript@5.4.5) + '@typescript-eslint/scope-manager': 5.57.1 + '@typescript-eslint/type-utils': 5.57.1(eslint@8.46.0)(typescript@5.4.5) + '@typescript-eslint/utils': 5.57.1(eslint@8.46.0)(typescript@5.4.5) + debug: 4.3.4 + eslint: 8.46.0 + grapheme-splitter: 1.0.4 + ignore: 5.2.4 + natural-compare-lite: 1.4.0 + semver: 7.5.3 + tsutils: 3.21.0(typescript@5.4.5) + typescript: 5.4.5 + transitivePeerDependencies: + - supports-color + dev: false /@typescript-eslint/parser@5.57.1(eslint@8.43.0)(typescript@5.1.6): resolution: {integrity: sha512-hlA0BLeVSA/wBPKdPGxoVr9Pp6GutGoY380FEhbVi0Ph4WNe8kLvqIRx76RSQt1lynZKfrXKs0/XeEk4zZycuA==} @@ -4584,6 +4613,27 @@ packages: typescript: 5.1.6 transitivePeerDependencies: - supports-color + dev: true + + /@typescript-eslint/parser@5.57.1(eslint@8.46.0)(typescript@5.4.5): + resolution: {integrity: sha512-hlA0BLeVSA/wBPKdPGxoVr9Pp6GutGoY380FEhbVi0Ph4WNe8kLvqIRx76RSQt1lynZKfrXKs0/XeEk4zZycuA==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/scope-manager': 5.57.1 + '@typescript-eslint/types': 5.57.1 + '@typescript-eslint/typescript-estree': 5.57.1(typescript@5.4.5) + debug: 4.3.4 + eslint: 8.46.0 + typescript: 5.4.5 + transitivePeerDependencies: + - supports-color + dev: false /@typescript-eslint/scope-manager@5.57.1: resolution: {integrity: sha512-N/RrBwEUKMIYxSKl0oDK5sFVHd6VI7p9K5MyUlVYAY6dyNb/wHUqndkTd3XhpGlXgnQsBkRZuu4f9kAHghvgPw==} @@ -4610,6 +4660,27 @@ packages: typescript: 5.1.6 transitivePeerDependencies: - supports-color + dev: true + + /@typescript-eslint/type-utils@5.57.1(eslint@8.46.0)(typescript@5.4.5): + resolution: {integrity: sha512-/RIPQyx60Pt6ga86hKXesXkJ2WOS4UemFrmmq/7eOyiYjYv/MUSHPlkhU6k9T9W1ytnTJueqASW+wOmW4KrViw==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: '*' + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/typescript-estree': 5.57.1(typescript@5.4.5) + '@typescript-eslint/utils': 5.57.1(eslint@8.46.0)(typescript@5.4.5) + debug: 4.3.4 + eslint: 8.46.0 + tsutils: 3.21.0(typescript@5.4.5) + typescript: 5.4.5 + transitivePeerDependencies: + - supports-color + dev: false /@typescript-eslint/types@5.57.1: resolution: {integrity: sha512-bSs4LOgyV3bJ08F5RDqO2KXqg3WAdwHCu06zOqcQ6vqbTJizyBhuh1o1ImC69X4bV2g1OJxbH71PJqiO7Y1RuA==} @@ -4635,6 +4706,27 @@ packages: transitivePeerDependencies: - supports-color + /@typescript-eslint/typescript-estree@5.57.1(typescript@5.4.5): + resolution: {integrity: sha512-A2MZqD8gNT0qHKbk2wRspg7cHbCDCk2tcqt6ScCFLr5Ru8cn+TCfM786DjPhqwseiS+PrYwcXht5ztpEQ6TFTw==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/types': 5.57.1 + '@typescript-eslint/visitor-keys': 5.57.1 + debug: 4.3.4 + globby: 11.1.0 + is-glob: 4.0.3 + semver: 7.5.3 + tsutils: 3.21.0(typescript@5.4.5) + typescript: 5.4.5 + transitivePeerDependencies: + - supports-color + dev: false + /@typescript-eslint/utils@5.57.1(eslint@8.46.0)(typescript@5.1.6): resolution: {integrity: sha512-kN6vzzf9NkEtawECqze6v99LtmDiUJCVpvieTFA1uL7/jDghiJGubGZ5csicYHU1Xoqb3oH/R5cN5df6W41Nfg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -4653,6 +4745,27 @@ packages: transitivePeerDependencies: - supports-color - typescript + dev: true + + /@typescript-eslint/utils@5.57.1(eslint@8.46.0)(typescript@5.4.5): + resolution: {integrity: sha512-kN6vzzf9NkEtawECqze6v99LtmDiUJCVpvieTFA1uL7/jDghiJGubGZ5csicYHU1Xoqb3oH/R5cN5df6W41Nfg==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@8.46.0) + '@types/json-schema': 7.0.12 + '@types/semver': 7.5.0 + '@typescript-eslint/scope-manager': 5.57.1 + '@typescript-eslint/types': 5.57.1 + '@typescript-eslint/typescript-estree': 5.57.1(typescript@5.4.5) + eslint: 8.46.0 + eslint-scope: 5.1.1 + semver: 7.5.3 + transitivePeerDependencies: + - supports-color + - typescript + dev: false /@typescript-eslint/visitor-keys@5.57.1: resolution: {integrity: sha512-RjQrAniDU0CEk5r7iphkm731zKlFiUjvcBS2yHAg8WWqFMCaCrD0rKEVOMUyMMcbGPZ0bPp56srkGWrgfZqLRA==} @@ -6491,6 +6604,7 @@ packages: - eslint-import-resolver-node - eslint-import-resolver-webpack - supports-color + dev: true /eslint-module-utils@2.8.0(@typescript-eslint/parser@5.57.1)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.43.0): resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==} @@ -6580,6 +6694,36 @@ packages: eslint-import-resolver-typescript: 3.5.5(@typescript-eslint/parser@5.57.1)(eslint-import-resolver-node@0.3.7)(eslint-plugin-import@2.27.5)(eslint@8.46.0) transitivePeerDependencies: - supports-color + dev: true + + /eslint-module-utils@2.8.0(@typescript-eslint/parser@5.57.1)(eslint-import-resolver-node@0.3.7)(eslint@8.46.0): + resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==} + engines: {node: '>=4'} + peerDependencies: + '@typescript-eslint/parser': '*' + eslint: '*' + eslint-import-resolver-node: '*' + eslint-import-resolver-typescript: '*' + eslint-import-resolver-webpack: '*' + peerDependenciesMeta: + '@typescript-eslint/parser': + optional: true + eslint: + optional: true + eslint-import-resolver-node: + optional: true + eslint-import-resolver-typescript: + optional: true + eslint-import-resolver-webpack: + optional: true + dependencies: + '@typescript-eslint/parser': 5.57.1(eslint@8.46.0)(typescript@5.4.5) + debug: 3.2.7 + eslint: 8.46.0 + eslint-import-resolver-node: 0.3.7 + transitivePeerDependencies: + - supports-color + dev: false /eslint-plugin-import@2.27.5(@typescript-eslint/parser@5.57.1)(eslint-import-resolver-typescript@3.5.5)(eslint@8.43.0): resolution: {integrity: sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow==} @@ -6678,6 +6822,7 @@ packages: - eslint-import-resolver-typescript - eslint-import-resolver-webpack - supports-color + dev: true /eslint-plugin-import@2.27.5(@typescript-eslint/parser@5.57.1)(eslint@8.46.0): resolution: {integrity: sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow==} @@ -6689,7 +6834,7 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 5.57.1(eslint@8.46.0)(typescript@5.1.6) + '@typescript-eslint/parser': 5.57.1(eslint@8.46.0)(typescript@5.4.5) array-includes: 3.1.6 array.prototype.flat: 1.3.1 array.prototype.flatmap: 1.3.1 @@ -6697,7 +6842,7 @@ packages: doctrine: 2.1.0 eslint: 8.46.0 eslint-import-resolver-node: 0.3.7 - eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.57.1)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.46.0) + eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.57.1)(eslint-import-resolver-node@0.3.7)(eslint@8.46.0) has: 1.0.3 is-core-module: 2.12.1 is-glob: 4.0.3 @@ -6934,7 +7079,7 @@ packages: '@typescript-eslint/eslint-plugin': optional: true dependencies: - '@typescript-eslint/eslint-plugin': 5.57.1(@typescript-eslint/parser@5.57.1)(eslint@8.46.0)(typescript@5.1.6) + '@typescript-eslint/eslint-plugin': 5.57.1(@typescript-eslint/parser@5.57.1)(eslint@8.46.0)(typescript@5.4.5) eslint: 8.46.0 eslint-rule-composer: 0.3.0 dev: false @@ -11200,7 +11345,7 @@ packages: is-plain-object: 3.0.1 dev: false - /rollup-plugin-dts@5.3.0(rollup@3.29.4)(typescript@5.1.6): + /rollup-plugin-dts@5.3.0(rollup@3.29.4)(typescript@5.4.5): resolution: {integrity: sha512-8FXp0ZkyZj1iU5klkIJYLjIq/YZSwBoERu33QBDxm/1yw5UU4txrEtcmMkrq+ZiKu3Q4qvPCNqc3ovX6rjqzbQ==} engines: {node: '>=v14'} peerDependencies: @@ -11209,7 +11354,7 @@ packages: dependencies: magic-string: 0.30.3 rollup: 3.29.4 - typescript: 5.1.6 + typescript: 5.4.5 optionalDependencies: '@babel/code-frame': 7.22.5 dev: false @@ -11974,7 +12119,7 @@ packages: resolution: {integrity: sha512-AqTiAOLcj85xS7vQ8QkAV41hPDIJ71XJB4RCUrzo/1GM2CQwhkJGaf9Hgr7BOugMRpgGUrqRg/DrBDl4H40+8g==} dev: true - /ts-node@10.9.1(@swc/core@1.3.3)(@types/node@20.4.8)(typescript@5.1.6): + /ts-node@10.9.1(@swc/core@1.3.3)(@types/node@20.4.8)(typescript@5.4.5): resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true peerDependencies: @@ -12001,7 +12146,7 @@ packages: create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 5.1.6 + typescript: 5.4.5 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 dev: false @@ -12046,6 +12191,16 @@ packages: tslib: 1.14.1 typescript: 5.1.6 + /tsutils@3.21.0(typescript@5.4.5): + resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} + engines: {node: '>= 6'} + peerDependencies: + typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' + dependencies: + tslib: 1.14.1 + typescript: 5.4.5 + dev: false + /tty-table@4.2.1: resolution: {integrity: sha512-xz0uKo+KakCQ+Dxj1D/tKn2FSyreSYWzdkL/BYhgN6oMW808g8QRMuh1atAV9fjTPbWBjfbkKQpI/5rEcnAc7g==} engines: {node: '>=8.0.0'} @@ -12185,16 +12340,16 @@ packages: for-each: 0.3.3 is-typed-array: 1.1.10 - /typescript@5.1.3: - resolution: {integrity: sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw==} + /typescript@5.1.6: + resolution: {integrity: sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==} engines: {node: '>=14.17'} hasBin: true - dev: false - /typescript@5.1.6: - resolution: {integrity: sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==} + /typescript@5.4.5: + resolution: {integrity: sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==} engines: {node: '>=14.17'} hasBin: true + dev: false /unbox-primitive@1.0.2: resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==} diff --git a/scripts/build/tsconfig.json b/scripts/build/tsconfig.json index 45497e4..04c2381 100644 --- a/scripts/build/tsconfig.json +++ b/scripts/build/tsconfig.json @@ -5,7 +5,7 @@ "transpileOnly": true, "esm": true, "compilerOptions": { - "module": "CommonJS", + "module": "Node16", "moduleResolution": "Node16" } } From acf3b2ff2aec47ad9ca06cb96712a2f9d8e46198 Mon Sep 17 00:00:00 2001 From: Zn4rK Date: Wed, 10 Apr 2024 22:14:12 +0200 Subject: [PATCH 2/2] add changeset --- .changeset/lovely-ducks-join.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/lovely-ducks-join.md diff --git a/.changeset/lovely-ducks-join.md b/.changeset/lovely-ducks-join.md new file mode 100644 index 0000000..79a36d0 --- /dev/null +++ b/.changeset/lovely-ducks-join.md @@ -0,0 +1,6 @@ +--- +"@navita/webpack-plugin": minor +"@navita/next-plugin": minor +--- + +Added functionality to disable the usage of webpacks cache via the plugins constructor. Added a custom cache solution for next.js that uses a single text file to store the cache between compilations.