next-intlayer 9.4.3 → 9.5.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/README.md +0 -2
- package/dist/cjs/extractorLoader.cjs +148 -0
- package/dist/cjs/extractorLoader.cjs.map +1 -0
- package/dist/cjs/proxy/intlayerProxy.cjs +1 -1
- package/dist/cjs/server/prepareSwcOptimization.cjs +12 -20
- package/dist/cjs/server/prepareSwcOptimization.cjs.map +1 -1
- package/dist/cjs/server/startContentWatcher.cjs +91 -0
- package/dist/cjs/server/startContentWatcher.cjs.map +1 -0
- package/dist/cjs/server/withIntlayer.cjs +98 -13
- package/dist/cjs/server/withIntlayer.cjs.map +1 -1
- package/dist/esm/extractorLoader.mjs +146 -0
- package/dist/esm/extractorLoader.mjs.map +1 -0
- package/dist/esm/proxy/intlayerProxy.mjs +1 -1
- package/dist/esm/server/prepareSwcOptimization.mjs +12 -20
- package/dist/esm/server/prepareSwcOptimization.mjs.map +1 -1
- package/dist/esm/server/startContentWatcher.mjs +90 -0
- package/dist/esm/server/startContentWatcher.mjs.map +1 -0
- package/dist/esm/server/withIntlayer.mjs +98 -13
- package/dist/esm/server/withIntlayer.mjs.map +1 -1
- package/dist/types/@intlayer/babel/dist/types/babel-plugin-intlayer-field-rename.d.ts +1 -0
- package/dist/types/@intlayer/babel/dist/types/babel-plugin-intlayer-field-rename.d.ts.map +1 -1
- package/dist/types/@intlayer/babel/dist/types/babel-plugin-intlayer-optimize.d.ts +1 -1
- package/dist/types/@intlayer/babel/dist/types/babel-plugin-intlayer-purge.d.ts +1 -0
- package/dist/types/@intlayer/babel/dist/types/babel-plugin-intlayer-usage-analyzer.d.ts +3 -2
- package/dist/types/@intlayer/babel/dist/types/index.d.ts +2 -0
- package/dist/types/@intlayer/babel/dist/types/pruneContext.d.ts +1 -0
- package/dist/types/@intlayer/babel/dist/types/staticAstReaders.d.ts +2 -0
- package/dist/types/@intlayer/babel/dist/types/transformers.d.ts +1 -0
- package/dist/types/extractorLoader.d.ts +63 -0
- package/dist/types/extractorLoader.d.ts.map +1 -0
- package/dist/types/server/prepareSwcOptimization.d.ts +2 -2
- package/dist/types/server/prepareSwcOptimization.d.ts.map +1 -1
- package/dist/types/server/startContentWatcher.d.ts +5 -0
- package/dist/types/server/startContentWatcher.d.ts.map +1 -0
- package/dist/types/server/withIntlayer.d.ts +8 -2
- package/dist/types/server/withIntlayer.d.ts.map +1 -1
- package/package.json +17 -9
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
//#region src/extractorLoader.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Options the loader accepts. Turbopack serialises loader options to JSON, so
|
|
4
|
+
* every field has to stay a plain JSON value — the Intlayer configuration
|
|
5
|
+
* itself (which carries functions, e.g. `compiler.output`) is therefore loaded
|
|
6
|
+
* by the loader rather than handed to it.
|
|
7
|
+
*/
|
|
8
|
+
export type IntlayerExtractorLoaderOptions = {
|
|
9
|
+
/**
|
|
10
|
+
* Whether the host bundler is serving (`dev`) or building (`build`).
|
|
11
|
+
*
|
|
12
|
+
* Passed explicitly because a Turbopack loader runs in a worker process whose
|
|
13
|
+
* environment does not necessarily carry `INTLAYER_IS_DEV_COMMAND`.
|
|
14
|
+
*/
|
|
15
|
+
mode?: 'dev' | 'build';
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Structural view of the loader context, limited to what this loader uses.
|
|
19
|
+
* Typed locally rather than imported from `webpack` because the same file is
|
|
20
|
+
* also run by Turbopack's webpack-loader compatibility layer, and `webpack` is
|
|
21
|
+
* only an optional peer dependency.
|
|
22
|
+
*/
|
|
23
|
+
type IntlayerLoaderContext = {
|
|
24
|
+
/** Absolute path of the file being compiled. */
|
|
25
|
+
resourcePath: string;
|
|
26
|
+
/** Switches the loader to asynchronous mode. */
|
|
27
|
+
async: () => (error: Error | null, content?: string) => void;
|
|
28
|
+
/** webpack 5 / Turbopack accessor for the loader options. */
|
|
29
|
+
getOptions?: () => IntlayerExtractorLoaderOptions;
|
|
30
|
+
/** Legacy options holder, used when `getOptions` is unavailable. */
|
|
31
|
+
query?: IntlayerExtractorLoaderOptions | string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Webpack-compatible loader running the Intlayer compiler extraction pass.
|
|
35
|
+
*
|
|
36
|
+
* It replaces the `babel.config.js` setup on Next.js: Turbopack never reads a
|
|
37
|
+
* Babel config, and on webpack a Babel config would opt the whole project out
|
|
38
|
+
* of SWC. Registered automatically by `withIntlayer` on both bundlers.
|
|
39
|
+
*
|
|
40
|
+
* @example next.config.ts — registered by hand
|
|
41
|
+
* ```ts
|
|
42
|
+
* export default {
|
|
43
|
+
* turbopack: {
|
|
44
|
+
* rules: {
|
|
45
|
+
* // No `as`: it renames the module, so naming the extension the rule
|
|
46
|
+
* // already matches would ask for `Component.tsx.tsx`.
|
|
47
|
+
* '*.tsx': {
|
|
48
|
+
* loaders: [
|
|
49
|
+
* {
|
|
50
|
+
* loader: require.resolve('next-intlayer/extractor-loader'),
|
|
51
|
+
* options: { mode: 'dev' },
|
|
52
|
+
* },
|
|
53
|
+
* ],
|
|
54
|
+
* },
|
|
55
|
+
* },
|
|
56
|
+
* },
|
|
57
|
+
* };
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
declare const intlayerExtractorLoader: (this: IntlayerLoaderContext, source: string) => void;
|
|
61
|
+
//#endregion
|
|
62
|
+
export { intlayerExtractorLoader as default };
|
|
63
|
+
//# sourceMappingURL=extractorLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractorLoader.d.ts","names":[],"sources":["../../src/extractorLoader.ts"],"mappings":";;;;;;;YAsBY;;;;;;;EAOV;;;;;;;;KASG;;EAEH;;EAEA,cAAc,OAAO,cAAc;;EAEnC,mBAAmB;;EAEnB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAqPJ,0BAAuB,MACrB,uBAAqB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SerializedFieldRenameMap } from "../@intlayer/babel/dist/types/babel-plugin-intlayer-field-rename.js";
|
|
2
2
|
import "../@intlayer/babel/dist/types/index.js";
|
|
3
3
|
import { Dictionary } from "@intlayer/types/dictionary";
|
|
4
|
-
import {
|
|
4
|
+
import { CallerDescriptor } from "@intlayer/config/callers";
|
|
5
5
|
import { GetConfigurationOptions } from "@intlayer/config/node";
|
|
6
6
|
import { IntlayerConfig } from "@intlayer/types/config";
|
|
7
7
|
//#region src/server/prepareSwcOptimization.d.ts
|
|
@@ -35,7 +35,7 @@ type PrepareSwcOptimizationParams = {
|
|
|
35
35
|
/** Pre-loaded dictionaries, to avoid a second `getDictionaries` call. */
|
|
36
36
|
dictionaries?: Dictionary[];
|
|
37
37
|
/** Compat-adapter callers declared by the consuming plugin, if any. */
|
|
38
|
-
|
|
38
|
+
compatCallers?: CallerDescriptor[];
|
|
39
39
|
/**
|
|
40
40
|
* Whether the `@intlayer/swc` plugin is installed *and* the resolved Next.js
|
|
41
41
|
* version can load it. False leaves the compiled dictionaries untouched.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareSwcOptimization.d.ts","names":[],"sources":["../../../src/server/prepareSwcOptimization.ts"],"mappings":";;;;;;;;;;;YAsBY,gCAAgC,eAE1C;;YAIU;;;;;;;;qBAoDC,qBAAkB,gBACb,mBACf;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"prepareSwcOptimization.d.ts","names":[],"sources":["../../../src/server/prepareSwcOptimization.ts"],"mappings":";;;;;;;;;;;YAsBY,gCAAgC,eAE1C;;YAIU;;;;;;;;qBAoDC,qBAAkB,gBACb,mBACf;;;;;;;;;qBAuFU,8BAA2B,gBACtB;KAyGb;;EAEH,gBAAgB;;EAEhB,eAAe;;EAEf,gBAAgB;;;;;EAKhB;;;;;;;;;;;;;;;;;;;;;;qBAuBW,yBAAsB,gBACjB,gBAAc,QACtB,iCACP,QAAQ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startContentWatcher.d.ts","names":[],"sources":["../../../src/server/startContentWatcher.ts"],"mappings":";;qBA8Ga,sBAAmB,eAAmB"}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { FieldRenameMapByDictionaryKey } from "./prepareSwcOptimization.js";
|
|
2
2
|
import { MINIMUM_SWC_PLUGIN_NEXT_VERSION, getIsSwcPluginSupported } from "./swcPluginCompatibility.js";
|
|
3
3
|
import { NextConfig } from "next";
|
|
4
|
-
import {
|
|
4
|
+
import { CallerDescriptor } from "@intlayer/config/callers";
|
|
5
5
|
import { GetConfigurationOptions } from "@intlayer/config/node";
|
|
6
6
|
//#region src/server/withIntlayer.d.ts
|
|
7
7
|
type WithIntlayerOptions = GetConfigurationOptions & {
|
|
8
8
|
enableTurbopack?: boolean;
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Compat-adapter caller descriptors injected by a compat package's bundler
|
|
11
|
+
* plugin (e.g. `@intlayer/next-intl/plugin`). They drive both the SWC
|
|
12
|
+
* optimize rewrite and the Node-side usage analysis, so one registry slice
|
|
13
|
+
* is all a compat plugin has to pass.
|
|
14
|
+
*/
|
|
15
|
+
compatCallers?: CallerDescriptor[];
|
|
10
16
|
/**
|
|
11
17
|
* Field-rename tables produced by the purge / minify pipeline, forwarded to
|
|
12
18
|
* the `@intlayer/swc` plugin so it rewrites source accesses to match the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withIntlayer.d.ts","names":[],"sources":["../../../src/server/withIntlayer.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"withIntlayer.d.ts","names":[],"sources":["../../../src/server/withIntlayer.ts"],"mappings":";;;;;;KAodK,sBAAsB;EACzB;;;;;;;EAOA,gBAAgB;;;;;;;;;EAUhB,iBAAiB;;;;;;;;;;;;;qBAuDN,mBAAoB,UAAU,QAAQ,aAAW,aAChD,GAAC,gBACG,wBACf,aAAa;;;;;;;;;;;;;;;;qBA2UH,eAAsB,UAAU,aAAa,QAAQ,aAAW,aAC/D,IAAI,QAAQ,IAAE,gBACV,wBACf,QAAQ,aAAa"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-intlayer",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.5.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Simplify internationalization i18n in Next.js with context providers, hooks, locale detection, and multilingual content integration.",
|
|
6
6
|
"keywords": [
|
|
@@ -81,6 +81,11 @@
|
|
|
81
81
|
"require": "./dist/cjs/server/format/index.cjs",
|
|
82
82
|
"import": "./dist/esm/server/format/index.mjs"
|
|
83
83
|
},
|
|
84
|
+
"./extractor-loader": {
|
|
85
|
+
"types": "./dist/types/extractorLoader.d.ts",
|
|
86
|
+
"require": "./dist/cjs/extractorLoader.cjs",
|
|
87
|
+
"import": "./dist/esm/extractorLoader.mjs"
|
|
88
|
+
},
|
|
84
89
|
"./plugin": {
|
|
85
90
|
"types": "./dist/types/plugin/index.d.ts",
|
|
86
91
|
"require": "./dist/cjs/plugin/index.cjs",
|
|
@@ -111,6 +116,9 @@
|
|
|
111
116
|
"server/format": [
|
|
112
117
|
"./dist/types/server/format/index.d.ts"
|
|
113
118
|
],
|
|
119
|
+
"extractor-loader": [
|
|
120
|
+
"./dist/types/extractorLoader.d.ts"
|
|
121
|
+
],
|
|
114
122
|
"package.json": [
|
|
115
123
|
"./package.json"
|
|
116
124
|
]
|
|
@@ -138,18 +146,18 @@
|
|
|
138
146
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
139
147
|
},
|
|
140
148
|
"dependencies": {
|
|
141
|
-
"@intlayer/config": "9.
|
|
142
|
-
"@intlayer/core": "9.
|
|
143
|
-
"@intlayer/dictionaries-entry": "9.
|
|
144
|
-
"@intlayer/engine": "9.
|
|
145
|
-
"@intlayer/types": "9.
|
|
146
|
-
"@intlayer/webpack": "9.
|
|
149
|
+
"@intlayer/config": "9.5.0",
|
|
150
|
+
"@intlayer/core": "9.5.0",
|
|
151
|
+
"@intlayer/dictionaries-entry": "9.5.0",
|
|
152
|
+
"@intlayer/engine": "9.5.0",
|
|
153
|
+
"@intlayer/types": "9.5.0",
|
|
154
|
+
"@intlayer/webpack": "9.5.0",
|
|
147
155
|
"defu": "6.1.7",
|
|
148
156
|
"node-loader": "2.1.0",
|
|
149
|
-
"react-intlayer": "9.
|
|
157
|
+
"react-intlayer": "9.5.0"
|
|
150
158
|
},
|
|
151
159
|
"devDependencies": {
|
|
152
|
-
"@types/node": "26.
|
|
160
|
+
"@types/node": "26.5.0",
|
|
153
161
|
"@types/react": ">=16.0.0",
|
|
154
162
|
"@types/react-dom": ">=16.0.0",
|
|
155
163
|
"@utils/ts-config": "1.0.4",
|