intlayer 8.1.2 → 8.1.3
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/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -29
- package/dist/cjs/cli/index.cjs +1 -9
- package/dist/cjs/cli/script.cjs +1 -7
- package/dist/cjs/cli/script.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -330
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/routing/index.cjs +1 -113
- package/dist/cjs/routing/index.cjs.map +1 -1
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/script.mjs +1 -6
- package/dist/esm/cli/script.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -35
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/routing/index.mjs +1 -104
- package/dist/esm/routing/index.mjs.map +1 -1
- package/dist/types/index.d.ts +6 -3
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -1,29 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
-
__defProp(to, key, {
|
|
14
|
-
get: ((k) => from[k]).bind(null, key),
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
-
value: mod,
|
|
24
|
-
enumerable: true
|
|
25
|
-
}) : target, mod));
|
|
26
|
-
|
|
27
|
-
//#endregion
|
|
28
|
-
|
|
29
|
-
exports.__toESM = __toESM;
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
|
package/dist/cjs/cli/index.cjs
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _intlayer_cli = require("@intlayer/cli");
|
|
4
|
-
Object.keys(_intlayer_cli).forEach(function (k) {
|
|
5
|
-
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function () { return _intlayer_cli[k]; }
|
|
8
|
-
});
|
|
9
|
-
});
|
|
1
|
+
var e=require(`@intlayer/cli`);Object.keys(e).forEach(function(t){t!==`default`&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});
|
package/dist/cjs/cli/script.cjs
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
let _intlayer_cli = require("@intlayer/cli");
|
|
4
|
-
|
|
5
|
-
//#region src/cli/script.ts
|
|
6
|
-
(0, _intlayer_cli.setAPI)();
|
|
7
|
-
|
|
8
|
-
//#endregion
|
|
2
|
+
require(`../_virtual/_rolldown/runtime.cjs`),(0,require(`@intlayer/cli`).setAPI)();
|
|
9
3
|
//# sourceMappingURL=script.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"script.cjs","names":[],"sources":["../../../src/cli/script.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { setAPI } from '@intlayer/cli';\n\nsetAPI();\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"script.cjs","names":[],"sources":["../../../src/cli/script.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { setAPI } from '@intlayer/cli';\n\nsetAPI();\n"],"mappings":";kFAGQ"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,331 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
let _intlayer_types = require("@intlayer/types");
|
|
4
|
-
let _intlayer_config_built = require("@intlayer/config/built");
|
|
5
|
-
_intlayer_config_built = require_runtime.__toESM(_intlayer_config_built);
|
|
6
|
-
let _intlayer_core = require("@intlayer/core");
|
|
7
|
-
let _intlayer_core_file = require("@intlayer/core/file");
|
|
8
|
-
|
|
9
|
-
//#region src/index.ts
|
|
10
|
-
/** biome-ignore-all lint/suspicious/noEmptyInterface: Intlayer module augmentation registries */
|
|
11
|
-
/**
|
|
12
|
-
* Rexport using named import because πof Tsup bug in CJS
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* The configuration of Intlayer.
|
|
16
|
-
*/
|
|
17
|
-
_intlayer_types.Locales.ALL_LOCALES;
|
|
18
|
-
/**
|
|
19
|
-
* Returns the configuration of Intlayer.
|
|
20
|
-
*
|
|
21
|
-
* @deprecated Use `import { configuration } from 'intlayer'` instead.
|
|
22
|
-
*/
|
|
23
|
-
const getConfiguration = () => _intlayer_config_built.default;
|
|
24
|
-
/**
|
|
25
|
-
* The locales defined in the configuration.
|
|
26
|
-
*/
|
|
27
|
-
const locales = _intlayer_config_built.default.internationalization.locales;
|
|
28
|
-
/**
|
|
29
|
-
* The required locales defined in the configuration.
|
|
30
|
-
*/
|
|
31
|
-
const requiredLocales = _intlayer_config_built.default.internationalization.requiredLocales;
|
|
32
|
-
/**
|
|
33
|
-
* The default locale defined in the configuration.
|
|
34
|
-
*/
|
|
35
|
-
const defaultLocale = _intlayer_config_built.default.internationalization.defaultLocale;
|
|
36
|
-
|
|
37
|
-
//#endregion
|
|
38
|
-
Object.defineProperty(exports, 'Intl', {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
get: function () {
|
|
41
|
-
return _intlayer_core.Intl;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
Object.defineProperty(exports, 'Locales', {
|
|
45
|
-
enumerable: true,
|
|
46
|
-
get: function () {
|
|
47
|
-
return _intlayer_types.Locales;
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
Object.defineProperty(exports, 'compact', {
|
|
51
|
-
enumerable: true,
|
|
52
|
-
get: function () {
|
|
53
|
-
return _intlayer_core.compact;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
Object.defineProperty(exports, 'cond', {
|
|
57
|
-
enumerable: true,
|
|
58
|
-
get: function () {
|
|
59
|
-
return _intlayer_core.cond;
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
exports.configuration = _intlayer_config_built.default;
|
|
63
|
-
Object.defineProperty(exports, 'currency', {
|
|
64
|
-
enumerable: true,
|
|
65
|
-
get: function () {
|
|
66
|
-
return _intlayer_core.currency;
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
Object.defineProperty(exports, 'date', {
|
|
70
|
-
enumerable: true,
|
|
71
|
-
get: function () {
|
|
72
|
-
return _intlayer_core.date;
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
exports.defaultLocale = defaultLocale;
|
|
76
|
-
Object.defineProperty(exports, 'enu', {
|
|
77
|
-
enumerable: true,
|
|
78
|
-
get: function () {
|
|
79
|
-
return _intlayer_core.enu;
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
Object.defineProperty(exports, 'file', {
|
|
83
|
-
enumerable: true,
|
|
84
|
-
get: function () {
|
|
85
|
-
return _intlayer_core_file.file;
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
Object.defineProperty(exports, 'gender', {
|
|
89
|
-
enumerable: true,
|
|
90
|
-
get: function () {
|
|
91
|
-
return _intlayer_core.gender;
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
Object.defineProperty(exports, 'getBrowserLocale', {
|
|
95
|
-
enumerable: true,
|
|
96
|
-
get: function () {
|
|
97
|
-
return _intlayer_core.getBrowserLocale;
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
Object.defineProperty(exports, 'getCanonicalPath', {
|
|
101
|
-
enumerable: true,
|
|
102
|
-
get: function () {
|
|
103
|
-
return _intlayer_core.getCanonicalPath;
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
exports.getConfiguration = getConfiguration;
|
|
107
|
-
Object.defineProperty(exports, 'getCookie', {
|
|
108
|
-
enumerable: true,
|
|
109
|
-
get: function () {
|
|
110
|
-
return _intlayer_core.getCookie;
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
Object.defineProperty(exports, 'getDictionary', {
|
|
114
|
-
enumerable: true,
|
|
115
|
-
get: function () {
|
|
116
|
-
return _intlayer_core.getDictionary;
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
Object.defineProperty(exports, 'getEnumeration', {
|
|
120
|
-
enumerable: true,
|
|
121
|
-
get: function () {
|
|
122
|
-
return _intlayer_core.getEnumeration;
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
Object.defineProperty(exports, 'getEnumerationContent', {
|
|
126
|
-
enumerable: true,
|
|
127
|
-
get: function () {
|
|
128
|
-
return _intlayer_core.getEnumeration;
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
Object.defineProperty(exports, 'getHTMLTextDir', {
|
|
132
|
-
enumerable: true,
|
|
133
|
-
get: function () {
|
|
134
|
-
return _intlayer_core.getHTMLTextDir;
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
Object.defineProperty(exports, 'getIntlayer', {
|
|
138
|
-
enumerable: true,
|
|
139
|
-
get: function () {
|
|
140
|
-
return _intlayer_core.getIntlayer;
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
Object.defineProperty(exports, 'getLocale', {
|
|
144
|
-
enumerable: true,
|
|
145
|
-
get: function () {
|
|
146
|
-
return _intlayer_core.getLocale;
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
Object.defineProperty(exports, 'getLocaleFromPath', {
|
|
150
|
-
enumerable: true,
|
|
151
|
-
get: function () {
|
|
152
|
-
return _intlayer_core.getLocaleFromPath;
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
Object.defineProperty(exports, 'getLocaleFromStorage', {
|
|
156
|
-
enumerable: true,
|
|
157
|
-
get: function () {
|
|
158
|
-
return _intlayer_core.getLocaleFromStorage;
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
Object.defineProperty(exports, 'getLocaleLang', {
|
|
162
|
-
enumerable: true,
|
|
163
|
-
get: function () {
|
|
164
|
-
return _intlayer_core.getLocaleLang;
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
Object.defineProperty(exports, 'getLocaleName', {
|
|
168
|
-
enumerable: true,
|
|
169
|
-
get: function () {
|
|
170
|
-
return _intlayer_core.getLocaleName;
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
Object.defineProperty(exports, 'getLocalizedPath', {
|
|
174
|
-
enumerable: true,
|
|
175
|
-
get: function () {
|
|
176
|
-
return _intlayer_core.getLocalizedPath;
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
Object.defineProperty(exports, 'getLocalizedUrl', {
|
|
180
|
-
enumerable: true,
|
|
181
|
-
get: function () {
|
|
182
|
-
return _intlayer_core.getLocalizedUrl;
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
Object.defineProperty(exports, 'getMarkdownMetadata', {
|
|
186
|
-
enumerable: true,
|
|
187
|
-
get: function () {
|
|
188
|
-
return _intlayer_core.getMarkdownMetadata;
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
Object.defineProperty(exports, 'getMultilingualUrls', {
|
|
192
|
-
enumerable: true,
|
|
193
|
-
get: function () {
|
|
194
|
-
return _intlayer_core.getMultilingualUrls;
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
Object.defineProperty(exports, 'getNesting', {
|
|
198
|
-
enumerable: true,
|
|
199
|
-
get: function () {
|
|
200
|
-
return _intlayer_core.getNesting;
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
Object.defineProperty(exports, 'getPathWithoutLocale', {
|
|
204
|
-
enumerable: true,
|
|
205
|
-
get: function () {
|
|
206
|
-
return _intlayer_core.getPathWithoutLocale;
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
Object.defineProperty(exports, 'getPrefix', {
|
|
210
|
-
enumerable: true,
|
|
211
|
-
get: function () {
|
|
212
|
-
return _intlayer_core.getPrefix;
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
Object.defineProperty(exports, 'getRewriteRules', {
|
|
216
|
-
enumerable: true,
|
|
217
|
-
get: function () {
|
|
218
|
-
return _intlayer_core.getRewriteRules;
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
Object.defineProperty(exports, 'getTranslation', {
|
|
222
|
-
enumerable: true,
|
|
223
|
-
get: function () {
|
|
224
|
-
return _intlayer_core.getTranslation;
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
Object.defineProperty(exports, 'getTranslationContent', {
|
|
228
|
-
enumerable: true,
|
|
229
|
-
get: function () {
|
|
230
|
-
return _intlayer_core.getTranslation;
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
Object.defineProperty(exports, 'html', {
|
|
234
|
-
enumerable: true,
|
|
235
|
-
get: function () {
|
|
236
|
-
return _intlayer_core.html;
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
Object.defineProperty(exports, 'insert', {
|
|
240
|
-
enumerable: true,
|
|
241
|
-
get: function () {
|
|
242
|
-
return _intlayer_core.insert;
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
Object.defineProperty(exports, 'localeDetector', {
|
|
246
|
-
enumerable: true,
|
|
247
|
-
get: function () {
|
|
248
|
-
return _intlayer_core.localeDetector;
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
Object.defineProperty(exports, 'localeFlatMap', {
|
|
252
|
-
enumerable: true,
|
|
253
|
-
get: function () {
|
|
254
|
-
return _intlayer_core.localeFlatMap;
|
|
255
|
-
}
|
|
256
|
-
});
|
|
257
|
-
Object.defineProperty(exports, 'localeMap', {
|
|
258
|
-
enumerable: true,
|
|
259
|
-
get: function () {
|
|
260
|
-
return _intlayer_core.localeMap;
|
|
261
|
-
}
|
|
262
|
-
});
|
|
263
|
-
Object.defineProperty(exports, 'localeRecord', {
|
|
264
|
-
enumerable: true,
|
|
265
|
-
get: function () {
|
|
266
|
-
return _intlayer_core.localeRecord;
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
Object.defineProperty(exports, 'localeResolver', {
|
|
270
|
-
enumerable: true,
|
|
271
|
-
get: function () {
|
|
272
|
-
return _intlayer_core.localeResolver;
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
exports.locales = locales;
|
|
276
|
-
Object.defineProperty(exports, 'md', {
|
|
277
|
-
enumerable: true,
|
|
278
|
-
get: function () {
|
|
279
|
-
return _intlayer_core.md;
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
Object.defineProperty(exports, 'nest', {
|
|
283
|
-
enumerable: true,
|
|
284
|
-
get: function () {
|
|
285
|
-
return _intlayer_core.nest;
|
|
286
|
-
}
|
|
287
|
-
});
|
|
288
|
-
Object.defineProperty(exports, 'number', {
|
|
289
|
-
enumerable: true,
|
|
290
|
-
get: function () {
|
|
291
|
-
return _intlayer_core.number;
|
|
292
|
-
}
|
|
293
|
-
});
|
|
294
|
-
Object.defineProperty(exports, 'percentage', {
|
|
295
|
-
enumerable: true,
|
|
296
|
-
get: function () {
|
|
297
|
-
return _intlayer_core.percentage;
|
|
298
|
-
}
|
|
299
|
-
});
|
|
300
|
-
Object.defineProperty(exports, 'relativeTime', {
|
|
301
|
-
enumerable: true,
|
|
302
|
-
get: function () {
|
|
303
|
-
return _intlayer_core.relativeTime;
|
|
304
|
-
}
|
|
305
|
-
});
|
|
306
|
-
exports.requiredLocales = requiredLocales;
|
|
307
|
-
Object.defineProperty(exports, 'setLocaleInStorage', {
|
|
308
|
-
enumerable: true,
|
|
309
|
-
get: function () {
|
|
310
|
-
return _intlayer_core.setLocaleInStorage;
|
|
311
|
-
}
|
|
312
|
-
});
|
|
313
|
-
Object.defineProperty(exports, 't', {
|
|
314
|
-
enumerable: true,
|
|
315
|
-
get: function () {
|
|
316
|
-
return _intlayer_core.t;
|
|
317
|
-
}
|
|
318
|
-
});
|
|
319
|
-
Object.defineProperty(exports, 'units', {
|
|
320
|
-
enumerable: true,
|
|
321
|
-
get: function () {
|
|
322
|
-
return _intlayer_core.units;
|
|
323
|
-
}
|
|
324
|
-
});
|
|
325
|
-
Object.defineProperty(exports, 'validatePrefix', {
|
|
326
|
-
enumerable: true,
|
|
327
|
-
get: function () {
|
|
328
|
-
return _intlayer_core.validatePrefix;
|
|
329
|
-
}
|
|
330
|
-
});
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./_virtual/_rolldown/runtime.cjs`);let t=require(`@intlayer/types`),n=require(`@intlayer/config/built`);n=e.__toESM(n);let r=require(`@intlayer/core/file`),i=require(`@intlayer/core/formatters`),a=require(`@intlayer/core/interpreter`),o=require(`@intlayer/core/localization`),s=require(`@intlayer/core/markdown`),c=require(`@intlayer/core/transpiler`),l=require(`@intlayer/core/utils`);t.Locales.ALL_LOCALES;const u=()=>n.default,d=n.default.internationalization.locales,f=n.default.internationalization.requiredLocales,p=n.default.internationalization.defaultLocale;Object.defineProperty(exports,`Intl`,{enumerable:!0,get:function(){return i.Intl}}),Object.defineProperty(exports,`Locales`,{enumerable:!0,get:function(){return t.Locales}}),Object.defineProperty(exports,`compact`,{enumerable:!0,get:function(){return i.compact}}),Object.defineProperty(exports,`cond`,{enumerable:!0,get:function(){return c.cond}}),exports.configuration=n.default,Object.defineProperty(exports,`currency`,{enumerable:!0,get:function(){return i.currency}}),Object.defineProperty(exports,`date`,{enumerable:!0,get:function(){return i.date}}),exports.defaultLocale=p,Object.defineProperty(exports,`enu`,{enumerable:!0,get:function(){return c.enu}}),Object.defineProperty(exports,`file`,{enumerable:!0,get:function(){return r.file}}),Object.defineProperty(exports,`gender`,{enumerable:!0,get:function(){return c.gender}}),Object.defineProperty(exports,`getBrowserLocale`,{enumerable:!0,get:function(){return o.getBrowserLocale}}),Object.defineProperty(exports,`getCanonicalPath`,{enumerable:!0,get:function(){return o.getCanonicalPath}}),exports.getConfiguration=u,Object.defineProperty(exports,`getCookie`,{enumerable:!0,get:function(){return l.getCookie}}),Object.defineProperty(exports,`getDictionary`,{enumerable:!0,get:function(){return a.getDictionary}}),Object.defineProperty(exports,`getEnumeration`,{enumerable:!0,get:function(){return a.getEnumeration}}),Object.defineProperty(exports,`getEnumerationContent`,{enumerable:!0,get:function(){return a.getEnumeration}}),Object.defineProperty(exports,`getHTMLTextDir`,{enumerable:!0,get:function(){return o.getHTMLTextDir}}),Object.defineProperty(exports,`getIntlayer`,{enumerable:!0,get:function(){return a.getIntlayer}}),Object.defineProperty(exports,`getLocale`,{enumerable:!0,get:function(){return o.getLocale}}),Object.defineProperty(exports,`getLocaleFromPath`,{enumerable:!0,get:function(){return o.getLocaleFromPath}}),Object.defineProperty(exports,`getLocaleFromStorage`,{enumerable:!0,get:function(){return l.getLocaleFromStorage}}),Object.defineProperty(exports,`getLocaleLang`,{enumerable:!0,get:function(){return o.getLocaleLang}}),Object.defineProperty(exports,`getLocaleName`,{enumerable:!0,get:function(){return o.getLocaleName}}),Object.defineProperty(exports,`getLocalizedPath`,{enumerable:!0,get:function(){return o.getLocalizedPath}}),Object.defineProperty(exports,`getLocalizedUrl`,{enumerable:!0,get:function(){return o.getLocalizedUrl}}),Object.defineProperty(exports,`getMarkdownMetadata`,{enumerable:!0,get:function(){return s.getMarkdownMetadata}}),Object.defineProperty(exports,`getMultilingualUrls`,{enumerable:!0,get:function(){return o.getMultilingualUrls}}),Object.defineProperty(exports,`getNesting`,{enumerable:!0,get:function(){return a.getNesting}}),Object.defineProperty(exports,`getPathWithoutLocale`,{enumerable:!0,get:function(){return o.getPathWithoutLocale}}),Object.defineProperty(exports,`getPrefix`,{enumerable:!0,get:function(){return o.getPrefix}}),Object.defineProperty(exports,`getRewriteRules`,{enumerable:!0,get:function(){return o.getRewriteRules}}),Object.defineProperty(exports,`getTranslation`,{enumerable:!0,get:function(){return a.getTranslation}}),Object.defineProperty(exports,`getTranslationContent`,{enumerable:!0,get:function(){return a.getTranslation}}),Object.defineProperty(exports,`html`,{enumerable:!0,get:function(){return c.html}}),Object.defineProperty(exports,`insert`,{enumerable:!0,get:function(){return c.insert}}),Object.defineProperty(exports,`localeDetector`,{enumerable:!0,get:function(){return o.localeDetector}}),Object.defineProperty(exports,`localeFlatMap`,{enumerable:!0,get:function(){return o.localeFlatMap}}),Object.defineProperty(exports,`localeMap`,{enumerable:!0,get:function(){return o.localeMap}}),Object.defineProperty(exports,`localeRecord`,{enumerable:!0,get:function(){return o.localeRecord}}),Object.defineProperty(exports,`localeResolver`,{enumerable:!0,get:function(){return o.localeResolver}}),exports.locales=d,Object.defineProperty(exports,`md`,{enumerable:!0,get:function(){return c.md}}),Object.defineProperty(exports,`nest`,{enumerable:!0,get:function(){return c.nest}}),Object.defineProperty(exports,`number`,{enumerable:!0,get:function(){return i.number}}),Object.defineProperty(exports,`percentage`,{enumerable:!0,get:function(){return i.percentage}}),Object.defineProperty(exports,`relativeTime`,{enumerable:!0,get:function(){return i.relativeTime}}),exports.requiredLocales=f,Object.defineProperty(exports,`setLocaleInStorage`,{enumerable:!0,get:function(){return l.setLocaleInStorage}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return c.t}}),Object.defineProperty(exports,`units`,{enumerable:!0,get:function(){return i.units}}),Object.defineProperty(exports,`validatePrefix`,{enumerable:!0,get:function(){return o.validatePrefix}});
|
|
331
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["Locales","configuration"],"sources":["../../src/index.ts"],"sourcesContent":["/** biome-ignore-all lint/suspicious/noEmptyInterface: Intlayer module augmentation registries */\nimport {\n type Dictionary as DictionaryCore,\n type CustomIntlayerConfig as IntlayerConfig,\n Locales,\n type SchemaKeys,\n} from '@intlayer/types';\n\n/**\n * The dictionary type used to define the structure of a dictionary.\n * It is used to provide type safety and autocompletion when defining a dictionary.\n *\n * @example\n * ```ts\n * import { Dictionary } from 'intlayer';\n *\n * const dictionary: Dictionary = { ... };\n * ```\n */\ntype Dictionary<\n T = undefined,\n SchemaKey extends SchemaKeys | undefined = undefined,\n> = DictionaryCore<T, SchemaKey, true>;\n\n/**\n * The content of a dictionary.\n *\n * @deprecated Use `Dictionary<T>` instead.\n */\ntype DeclarationContent<\n T = undefined,\n SchemaKey extends SchemaKeys | undefined = undefined,\n> = Dictionary<T, SchemaKey>;\n\n/**\n * A list of all supported locales.\n *\n * @deprecated Use `Locales.ALL_LOCALES` instead.\n */\nconst localeList = Locales.ALL_LOCALES;\n\nexport {\n type ContentNode,\n type Locale,\n Locales,\n type LocalesValues,\n type StrictModeLocaleMap,\n} from '@intlayer/types';\nexport type { DeclarationContent, Dictionary, IntlayerConfig, localeList };\n\n/**\n * Rexport using named import because πof Tsup bug in CJS\n */\n/**\n * The configuration of Intlayer.\n */\nimport configuration from '@intlayer/config/built';\n\n/**\n * Returns the configuration of Intlayer.\n
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["Locales","configuration"],"sources":["../../src/index.ts"],"sourcesContent":["/** biome-ignore-all lint/suspicious/noEmptyInterface: Intlayer module augmentation registries */\nimport {\n type Dictionary as DictionaryCore,\n type CustomIntlayerConfig as IntlayerConfig,\n Locales,\n type SchemaKeys,\n} from '@intlayer/types';\n\n/**\n * The dictionary type used to define the structure of a dictionary.\n * It is used to provide type safety and autocompletion when defining a dictionary.\n *\n * @example\n * ```ts\n * import { Dictionary } from 'intlayer';\n *\n * const dictionary: Dictionary = { ... };\n * ```\n */\ntype Dictionary<\n T = undefined,\n SchemaKey extends SchemaKeys | undefined = undefined,\n> = DictionaryCore<T, SchemaKey, true>;\n\n/**\n * The content of a dictionary.\n *\n * @deprecated Use `Dictionary<T>` instead.\n */\ntype DeclarationContent<\n T = undefined,\n SchemaKey extends SchemaKeys | undefined = undefined,\n> = Dictionary<T, SchemaKey>;\n\n/**\n * A list of all supported locales.\n *\n * @deprecated Use `Locales.ALL_LOCALES` instead.\n */\nconst localeList = Locales.ALL_LOCALES;\n\nexport {\n type ContentNode,\n type Locale,\n Locales,\n type LocalesValues,\n type StrictModeLocaleMap,\n} from '@intlayer/types';\nexport type { DeclarationContent, Dictionary, IntlayerConfig, localeList };\n\n/**\n * Rexport using named import because πof Tsup bug in CJS\n */\n/**\n * The configuration of Intlayer.\n */\nimport configuration from '@intlayer/config/built';\n\n/**\n * Returns the configuration of Intlayer.\n */\nconst getConfiguration = () => configuration;\n\n/**\n * The locales defined in the configuration.\n */\nconst locales = configuration.internationalization.locales;\n\n/**\n * The required locales defined in the configuration.\n */\nconst requiredLocales = configuration.internationalization.requiredLocales;\n\n/**\n * The default locale defined in the configuration.\n */\nconst defaultLocale = configuration.internationalization.defaultLocale;\n\n// Reexport here for CJS compatibility\n// Fix ReferenceError: Cannot access 'xxx' before initialization\nexport {\n configuration,\n getConfiguration,\n locales,\n requiredLocales,\n defaultLocale,\n};\n\nexport { file } from '@intlayer/core/file'; // Include specific export for browser because of node js function that can't be used in browser\nexport {\n compact,\n currency,\n date,\n Intl,\n number,\n percentage,\n relativeTime,\n units,\n} from '@intlayer/core/formatters';\nexport {\n getDictionary,\n getEnumeration /**\n * @deprecated Use `getEnumeration` instead.\n */,\n getEnumeration as getEnumerationContent,\n getIntlayer,\n getNesting,\n getTranslation /**\n * @deprecated Use `getTranslation` instead.\n */,\n getTranslation as getTranslationContent,\n} from '@intlayer/core/interpreter';\nexport {\n getBrowserLocale,\n getCanonicalPath,\n getHTMLTextDir,\n getLocale,\n getLocaleFromPath,\n getLocaleLang,\n getLocaleName,\n getLocalizedPath,\n getLocalizedUrl,\n getMultilingualUrls,\n getPathWithoutLocale,\n getPrefix,\n getRewriteRules,\n localeDetector,\n localeFlatMap,\n localeMap,\n localeRecord,\n localeResolver,\n validatePrefix,\n} from '@intlayer/core/localization';\nexport { getMarkdownMetadata } from '@intlayer/core/markdown';\nexport {\n cond,\n enu,\n gender,\n html,\n insert,\n md,\n nest,\n t,\n} from '@intlayer/core/transpiler';\nexport {\n getCookie,\n getLocaleFromStorage,\n setLocaleInStorage,\n} from '@intlayer/core/utils';\n\n// --- Registries to be augmented by the generator ---\nexport interface __DictionaryRegistry {} // id -> interfaceof ictionary\nexport interface __DeclaredLocalesRegistry {} // 'fr': 1, 'en': 1, ...\nexport interface __RequiredLocalesRegistry {} // 'en': 1, ...\nexport interface __SchemaRegistry {} // id -> interface of schema\nexport interface __StrictModeRegistry {} // one of: { strict: true } | { inclusive: true } | { loose: true }\n"],"mappings":"sdAuCmBA,EAAAA,QAAQ,YAsB3B,MAAM,MAAyBC,EAAAA,QAKzB,EAAUA,EAAAA,QAAc,qBAAqB,QAK7C,EAAkBA,EAAAA,QAAc,qBAAqB,gBAKrD,EAAgBA,EAAAA,QAAc,qBAAqB"}
|
|
@@ -1,114 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
|
|
3
|
-
//#region src/routing/index.ts
|
|
4
|
-
const buildRules = (rules, processor) => ({ rules: Object.entries(rules).map(([canonical, localized]) => ({
|
|
5
|
-
canonical: processor(canonical),
|
|
6
|
-
localized: Object.fromEntries(Object.entries(localized).map(([locale, pattern]) => [locale, pattern ? processor(pattern) : pattern]))
|
|
7
|
-
})) });
|
|
8
|
-
const cleanPath = (pattern) => pattern.startsWith("/") ? pattern : `/${pattern}`;
|
|
9
|
-
/**
|
|
10
|
-
* Standardizes pattern to :param syntax.
|
|
11
|
-
* Supports:
|
|
12
|
-
* - Next.js/SvelteKit/Nuxt: [slug], [...slug], [[slug]]
|
|
13
|
-
* - TanStack Router: $slug
|
|
14
|
-
* - Solid Router: *slug
|
|
15
|
-
* - React/Vue Router: :slug, *
|
|
16
|
-
*/
|
|
17
|
-
const normalizePattern = (pattern, framework) => {
|
|
18
|
-
let normalized = pattern;
|
|
19
|
-
if (framework === "nextjs") normalized = normalized.replace(/\[\[\.\.\.([^\]]+)\]\]/g, ":$1*").replace(/\[\.\.\.([^\]]+)\]/g, ":$1+").replace(/\[([^\]]+)\]/g, ":$1");
|
|
20
|
-
else if (framework === "sveltekit") normalized = normalized.replace(/\[\.\.\.([^\]]+)\]/g, ":$1*").replace(/\[\[([^\]]+)\]\]/g, ":$1?").replace(/\[([^\]]+)\]/g, ":$1");
|
|
21
|
-
else if (framework === "nuxt") normalized = normalized.replace(/\[\.\.\.([^\]]+)\]/g, ":$1*").replace(/\[([^\]]+)\]/g, ":$1");
|
|
22
|
-
else normalized = normalized.replace(/\$([^/]+)/g, ":$1").replace(/\*([^/]+)/g, ":$1*").replace(/:([^/]+)\?/g, ":$1?").replace(/\*/g, ":path*");
|
|
23
|
-
return normalized;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Removes locale markers from the pattern.
|
|
27
|
-
*/
|
|
28
|
-
const stripLocale = (pattern) => pattern.replace(/\/?(:locale|\[locale\]|\$locale)\/?/g, "/").replace(/\/+/g, "/").replace(/\/$/, "") || "/";
|
|
29
|
-
/**
|
|
30
|
-
* Factory to create formatters that populate 'url' and a specific proxy key.
|
|
31
|
-
*/
|
|
32
|
-
const createFormatter = (proxyKey, framework) => (rules) => {
|
|
33
|
-
const normalize = (pattern) => normalizePattern(pattern, framework);
|
|
34
|
-
const strip = (pattern) => stripLocale(normalize(pattern));
|
|
35
|
-
return {
|
|
36
|
-
url: buildRules(rules, (pattern) => cleanPath(strip(pattern))),
|
|
37
|
-
[proxyKey]: buildRules(rules, (pattern) => cleanPath(normalize(pattern)))
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Formatter for Next.js style rewrites.
|
|
42
|
-
* Patterns use Next.js dynamic routing syntax:
|
|
43
|
-
* - Slug: `[slug]`
|
|
44
|
-
* - Catch-all: `[...slug]` (1+)
|
|
45
|
-
* - Optional catch-all: `[[...slug]]` (0+)
|
|
46
|
-
* - Locale: `[locale]`
|
|
47
|
-
*/
|
|
48
|
-
const nextjsRewrite = createFormatter("nextjs", "nextjs");
|
|
49
|
-
/**
|
|
50
|
-
* Formatter for SvelteKit style rewrites.
|
|
51
|
-
* Patterns use SvelteKit dynamic routing syntax:
|
|
52
|
-
* - Slug: `[slug]`
|
|
53
|
-
* - Catch-all: `[...slug]` (0+)
|
|
54
|
-
* - Locale: `[locale]`
|
|
55
|
-
*/
|
|
56
|
-
const svelteKitRewrite = createFormatter("vite", "sveltekit");
|
|
57
|
-
/**
|
|
58
|
-
* Formatter for React Router style rewrites.
|
|
59
|
-
* Patterns use React Router dynamic routing syntax:
|
|
60
|
-
* - Slug: `:slug`
|
|
61
|
-
* - Optional slug: `:slug?`
|
|
62
|
-
* - Catch-all: `*`
|
|
63
|
-
* - Locale: `:locale`
|
|
64
|
-
*/
|
|
65
|
-
const reactRouterRewrite = createFormatter("vite");
|
|
66
|
-
/**
|
|
67
|
-
* Formatter for Vue style rewrites.
|
|
68
|
-
* Patterns use Vue Router 4 dynamic routing syntax:
|
|
69
|
-
* - Slug: `:slug`
|
|
70
|
-
* - Optional slug: `:slug?`
|
|
71
|
-
* - Catch-all: `:slug*` or `:slug+`
|
|
72
|
-
* - Locale: `:locale`
|
|
73
|
-
*/
|
|
74
|
-
const vueRouterRewrite = createFormatter("vite");
|
|
75
|
-
/**
|
|
76
|
-
* Formatter for Solid Router style rewrites.
|
|
77
|
-
* Patterns use Solid Router dynamic routing syntax:
|
|
78
|
-
* - Slug: `:slug`
|
|
79
|
-
* - Catch-all: `*slug`
|
|
80
|
-
* - Locale: `:locale`
|
|
81
|
-
*/
|
|
82
|
-
const solidRouterRewrite = createFormatter("vite");
|
|
83
|
-
/**
|
|
84
|
-
* Formatter for Nuxt style rewrites.
|
|
85
|
-
* Patterns use Nuxt 3 dynamic routing syntax:
|
|
86
|
-
* - Slug: `[slug]`
|
|
87
|
-
* - Catch-all: `[...slug]` (0+)
|
|
88
|
-
* - Locale: `[locale]`
|
|
89
|
-
*/
|
|
90
|
-
const nuxtRewrite = createFormatter("vite", "nuxt");
|
|
91
|
-
/**
|
|
92
|
-
* Formatter for TanStack Router style rewrites.
|
|
93
|
-
* Patterns use TanStack Router dynamic routing syntax:
|
|
94
|
-
* - Slug: `$slug`
|
|
95
|
-
* - Catch-all: `*`
|
|
96
|
-
* - Locale: `$locale`
|
|
97
|
-
*/
|
|
98
|
-
const tanstackRouterRewrite = createFormatter("vite");
|
|
99
|
-
/**
|
|
100
|
-
* Generic formatter for Vite-based projects.
|
|
101
|
-
* Supports most dynamic routing syntaxes and normalizes them for the Vite proxy.
|
|
102
|
-
*/
|
|
103
|
-
const viteRewrite = createFormatter("vite");
|
|
104
|
-
|
|
105
|
-
//#endregion
|
|
106
|
-
exports.nextjsRewrite = nextjsRewrite;
|
|
107
|
-
exports.nuxtRewrite = nuxtRewrite;
|
|
108
|
-
exports.reactRouterRewrite = reactRouterRewrite;
|
|
109
|
-
exports.solidRouterRewrite = solidRouterRewrite;
|
|
110
|
-
exports.svelteKitRewrite = svelteKitRewrite;
|
|
111
|
-
exports.tanstackRouterRewrite = tanstackRouterRewrite;
|
|
112
|
-
exports.viteRewrite = viteRewrite;
|
|
113
|
-
exports.vueRouterRewrite = vueRouterRewrite;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=(e,t)=>({rules:Object.entries(e).map(([e,n])=>({canonical:t(e),localized:Object.fromEntries(Object.entries(n).map(([e,n])=>[e,n&&t(n)]))}))}),t=e=>e.startsWith(`/`)?e:`/${e}`,n=(e,t)=>{let n=e;return n=t===`nextjs`?n.replace(/\[\[\.\.\.([^\]]+)\]\]/g,`:$1*`).replace(/\[\.\.\.([^\]]+)\]/g,`:$1+`).replace(/\[([^\]]+)\]/g,`:$1`):t===`sveltekit`?n.replace(/\[\.\.\.([^\]]+)\]/g,`:$1*`).replace(/\[\[([^\]]+)\]\]/g,`:$1?`).replace(/\[([^\]]+)\]/g,`:$1`):t===`nuxt`?n.replace(/\[\.\.\.([^\]]+)\]/g,`:$1*`).replace(/\[([^\]]+)\]/g,`:$1`):n.replace(/\$([^/]+)/g,`:$1`).replace(/\*([^/]+)/g,`:$1*`).replace(/:([^/]+)\?/g,`:$1?`).replace(/\*/g,`:path*`),n},r=e=>e.replace(/\/?(:locale|\[locale\]|\$locale)\/?/g,`/`).replace(/\/+/g,`/`).replace(/\/$/,``)||`/`,i=(i,a)=>o=>{let s=e=>n(e,a),c=e=>r(s(e));return{url:e(o,e=>t(c(e))),[i]:e(o,e=>t(s(e)))}},a=i(`nextjs`,`nextjs`),o=i(`vite`,`sveltekit`),s=i(`vite`),c=i(`vite`),l=i(`vite`),u=i(`vite`,`nuxt`),d=i(`vite`),f=i(`vite`);exports.nextjsRewrite=a,exports.nuxtRewrite=u,exports.reactRouterRewrite=s,exports.solidRouterRewrite=l,exports.svelteKitRewrite=o,exports.tanstackRouterRewrite=d,exports.viteRewrite=f,exports.vueRouterRewrite=c;
|
|
114
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../../src/routing/index.ts"],"sourcesContent":["import type {\n RewriteObject,\n RewriteRule,\n RewriteRules,\n StrictModeLocaleMap,\n} from '@intlayer/types';\n\nconst buildRules = (\n rules: Record<string, StrictModeLocaleMap<string>>,\n processor: (pattern: string) => string\n): RewriteRules => ({\n rules: Object.entries(rules).map(([canonical, localized]) => ({\n canonical: processor(canonical),\n localized: Object.fromEntries(\n Object.entries(localized).map(([locale, pattern]) => [\n locale,\n pattern ? processor(pattern) : pattern,\n ])\n ) as StrictModeLocaleMap<string>,\n })) as RewriteRule[],\n});\n\nconst cleanPath = (pattern: string) =>\n pattern.startsWith('/') ? pattern : `/${pattern}`;\n\n/**\n * Standardizes pattern to :param syntax.\n * Supports:\n * - Next.js/SvelteKit/Nuxt: [slug], [...slug], [[slug]]\n * - TanStack Router: $slug\n * - Solid Router: *slug\n * - React/Vue Router: :slug, *\n */\nconst normalizePattern = (pattern: string, framework?: string) => {\n let normalized = pattern;\n\n if (framework === 'nextjs') {\n normalized = normalized\n .replace(/\\[\\[\\.\\.\\.([^\\]]+)\\]\\]/g, ':$1*') // [[...slug]] -> :slug* (0+)\n .replace(/\\[\\.\\.\\.([^\\]]+)\\]/g, ':$1+') // [...slug] -> :slug+ (1+)\n .replace(/\\[([^\\]]+)\\]/g, ':$1'); // [slug] -> :slug (1)\n } else if (framework === 'sveltekit') {\n normalized = normalized\n .replace(/\\[\\.\\.\\.([^\\]]+)\\]/g, ':$1*') // [...path] -> :path* (0+)\n .replace(/\\[\\[([^\\]]+)\\]\\]/g, ':$1?') // [[optional]] -> :optional? (0-1)\n .replace(/\\[([^\\]]+)\\]/g, ':$1'); // [slug] -> :slug (1)\n } else if (framework === 'nuxt') {\n normalized = normalized\n .replace(/\\[\\.\\.\\.([^\\]]+)\\]/g, ':$1*') // [...slug] -> :slug* (0+)\n .replace(/\\[([^\\]]+)\\]/g, ':$1'); // [slug] -> :slug (1)\n } else {\n // Default / Generic (React Router, Vue Router, Solid Router, TanStack Router)\n normalized = normalized\n .replace(/\\$([^/]+)/g, ':$1') // TanStack $slug -> :slug\n .replace(/\\*([^/]+)/g, ':$1*') // Solid *slug -> :slug*\n .replace(/:([^/]+)\\?/g, ':$1?') // Vue Router/React Router :slug? -> :slug?\n .replace(/\\*/g, ':path*'); // React Router * -> :path*\n }\n\n return normalized;\n};\n\n/**\n * Removes locale markers from the pattern.\n */\nconst stripLocale = (pattern: string) =>\n pattern\n .replace(/\\/?(:locale|\\[locale\\]|\\$locale)\\/?/g, '/')\n .replace(/\\/+/g, '/')\n .replace(/\\/$/, '') || '/';\n\n/**\n * Factory to create formatters that populate 'url' and a specific proxy key.\n */\nconst createFormatter =\n (proxyKey: 'nextjs' | 'vite', framework?: string) =>\n <T extends string = string>(\n rules: Record<T, StrictModeLocaleMap<string>>\n ): RewriteObject => {\n const normalize = (pattern: string) => normalizePattern(pattern, framework);\n const strip = (pattern: string) => stripLocale(normalize(pattern));\n\n return {\n url: buildRules(rules as any, (pattern) => cleanPath(strip(pattern))),\n [proxyKey]: buildRules(rules as any, (pattern) =>\n cleanPath(normalize(pattern))\n ),\n } as RewriteObject;\n };\n\n/**\n * Formatter for Next.js style rewrites.\n * Patterns use Next.js dynamic routing syntax:\n * - Slug: `[slug]`\n * - Catch-all: `[...slug]` (1+)\n * - Optional catch-all: `[[...slug]]` (0+)\n * - Locale: `[locale]`\n */\nexport const nextjsRewrite = createFormatter('nextjs', 'nextjs');\n\n/**\n * Formatter for SvelteKit style rewrites.\n * Patterns use SvelteKit dynamic routing syntax:\n * - Slug: `[slug]`\n * - Catch-all: `[...slug]` (0+)\n * - Locale: `[locale]`\n */\nexport const svelteKitRewrite = createFormatter('vite', 'sveltekit');\n\n/**\n * Formatter for React Router style rewrites.\n * Patterns use React Router dynamic routing syntax:\n * - Slug: `:slug`\n * - Optional slug: `:slug?`\n * - Catch-all: `*`\n * - Locale: `:locale`\n */\nexport const reactRouterRewrite = createFormatter('vite');\n\n/**\n * Formatter for Vue style rewrites.\n * Patterns use Vue Router 4 dynamic routing syntax:\n * - Slug: `:slug`\n * - Optional slug: `:slug?`\n * - Catch-all: `:slug*` or `:slug+`\n * - Locale: `:locale`\n */\nexport const vueRouterRewrite = createFormatter('vite');\n\n/**\n * Formatter for Solid Router style rewrites.\n * Patterns use Solid Router dynamic routing syntax:\n * - Slug: `:slug`\n * - Catch-all: `*slug`\n * - Locale: `:locale`\n */\nexport const solidRouterRewrite = createFormatter('vite');\n\n/**\n * Formatter for Nuxt style rewrites.\n * Patterns use Nuxt 3 dynamic routing syntax:\n * - Slug: `[slug]`\n * - Catch-all: `[...slug]` (0+)\n * - Locale: `[locale]`\n */\nexport const nuxtRewrite = createFormatter('vite', 'nuxt');\n\n/**\n * Formatter for TanStack Router style rewrites.\n * Patterns use TanStack Router dynamic routing syntax:\n * - Slug: `$slug`\n * - Catch-all: `*`\n * - Locale: `$locale`\n */\nexport const tanstackRouterRewrite = createFormatter('vite');\n\n/**\n * Generic formatter for Vite-based projects.\n * Supports most dynamic routing syntaxes and normalizes them for the Vite proxy.\n */\nexport const viteRewrite = createFormatter('vite');\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../src/routing/index.ts"],"sourcesContent":["import type {\n RewriteObject,\n RewriteRule,\n RewriteRules,\n StrictModeLocaleMap,\n} from '@intlayer/types';\n\nconst buildRules = (\n rules: Record<string, StrictModeLocaleMap<string>>,\n processor: (pattern: string) => string\n): RewriteRules => ({\n rules: Object.entries(rules).map(([canonical, localized]) => ({\n canonical: processor(canonical),\n localized: Object.fromEntries(\n Object.entries(localized).map(([locale, pattern]) => [\n locale,\n pattern ? processor(pattern) : pattern,\n ])\n ) as StrictModeLocaleMap<string>,\n })) as RewriteRule[],\n});\n\nconst cleanPath = (pattern: string) =>\n pattern.startsWith('/') ? pattern : `/${pattern}`;\n\n/**\n * Standardizes pattern to :param syntax.\n * Supports:\n * - Next.js/SvelteKit/Nuxt: [slug], [...slug], [[slug]]\n * - TanStack Router: $slug\n * - Solid Router: *slug\n * - React/Vue Router: :slug, *\n */\nconst normalizePattern = (pattern: string, framework?: string) => {\n let normalized = pattern;\n\n if (framework === 'nextjs') {\n normalized = normalized\n .replace(/\\[\\[\\.\\.\\.([^\\]]+)\\]\\]/g, ':$1*') // [[...slug]] -> :slug* (0+)\n .replace(/\\[\\.\\.\\.([^\\]]+)\\]/g, ':$1+') // [...slug] -> :slug+ (1+)\n .replace(/\\[([^\\]]+)\\]/g, ':$1'); // [slug] -> :slug (1)\n } else if (framework === 'sveltekit') {\n normalized = normalized\n .replace(/\\[\\.\\.\\.([^\\]]+)\\]/g, ':$1*') // [...path] -> :path* (0+)\n .replace(/\\[\\[([^\\]]+)\\]\\]/g, ':$1?') // [[optional]] -> :optional? (0-1)\n .replace(/\\[([^\\]]+)\\]/g, ':$1'); // [slug] -> :slug (1)\n } else if (framework === 'nuxt') {\n normalized = normalized\n .replace(/\\[\\.\\.\\.([^\\]]+)\\]/g, ':$1*') // [...slug] -> :slug* (0+)\n .replace(/\\[([^\\]]+)\\]/g, ':$1'); // [slug] -> :slug (1)\n } else {\n // Default / Generic (React Router, Vue Router, Solid Router, TanStack Router)\n normalized = normalized\n .replace(/\\$([^/]+)/g, ':$1') // TanStack $slug -> :slug\n .replace(/\\*([^/]+)/g, ':$1*') // Solid *slug -> :slug*\n .replace(/:([^/]+)\\?/g, ':$1?') // Vue Router/React Router :slug? -> :slug?\n .replace(/\\*/g, ':path*'); // React Router * -> :path*\n }\n\n return normalized;\n};\n\n/**\n * Removes locale markers from the pattern.\n */\nconst stripLocale = (pattern: string) =>\n pattern\n .replace(/\\/?(:locale|\\[locale\\]|\\$locale)\\/?/g, '/')\n .replace(/\\/+/g, '/')\n .replace(/\\/$/, '') || '/';\n\n/**\n * Factory to create formatters that populate 'url' and a specific proxy key.\n */\nconst createFormatter =\n (proxyKey: 'nextjs' | 'vite', framework?: string) =>\n <T extends string = string>(\n rules: Record<T, StrictModeLocaleMap<string>>\n ): RewriteObject => {\n const normalize = (pattern: string) => normalizePattern(pattern, framework);\n const strip = (pattern: string) => stripLocale(normalize(pattern));\n\n return {\n url: buildRules(rules as any, (pattern) => cleanPath(strip(pattern))),\n [proxyKey]: buildRules(rules as any, (pattern) =>\n cleanPath(normalize(pattern))\n ),\n } as RewriteObject;\n };\n\n/**\n * Formatter for Next.js style rewrites.\n * Patterns use Next.js dynamic routing syntax:\n * - Slug: `[slug]`\n * - Catch-all: `[...slug]` (1+)\n * - Optional catch-all: `[[...slug]]` (0+)\n * - Locale: `[locale]`\n */\nexport const nextjsRewrite = createFormatter('nextjs', 'nextjs');\n\n/**\n * Formatter for SvelteKit style rewrites.\n * Patterns use SvelteKit dynamic routing syntax:\n * - Slug: `[slug]`\n * - Catch-all: `[...slug]` (0+)\n * - Locale: `[locale]`\n */\nexport const svelteKitRewrite = createFormatter('vite', 'sveltekit');\n\n/**\n * Formatter for React Router style rewrites.\n * Patterns use React Router dynamic routing syntax:\n * - Slug: `:slug`\n * - Optional slug: `:slug?`\n * - Catch-all: `*`\n * - Locale: `:locale`\n */\nexport const reactRouterRewrite = createFormatter('vite');\n\n/**\n * Formatter for Vue style rewrites.\n * Patterns use Vue Router 4 dynamic routing syntax:\n * - Slug: `:slug`\n * - Optional slug: `:slug?`\n * - Catch-all: `:slug*` or `:slug+`\n * - Locale: `:locale`\n */\nexport const vueRouterRewrite = createFormatter('vite');\n\n/**\n * Formatter for Solid Router style rewrites.\n * Patterns use Solid Router dynamic routing syntax:\n * - Slug: `:slug`\n * - Catch-all: `*slug`\n * - Locale: `:locale`\n */\nexport const solidRouterRewrite = createFormatter('vite');\n\n/**\n * Formatter for Nuxt style rewrites.\n * Patterns use Nuxt 3 dynamic routing syntax:\n * - Slug: `[slug]`\n * - Catch-all: `[...slug]` (0+)\n * - Locale: `[locale]`\n */\nexport const nuxtRewrite = createFormatter('vite', 'nuxt');\n\n/**\n * Formatter for TanStack Router style rewrites.\n * Patterns use TanStack Router dynamic routing syntax:\n * - Slug: `$slug`\n * - Catch-all: `*`\n * - Locale: `$locale`\n */\nexport const tanstackRouterRewrite = createFormatter('vite');\n\n/**\n * Generic formatter for Vite-based projects.\n * Supports most dynamic routing syntaxes and normalizes them for the Vite proxy.\n */\nexport const viteRewrite = createFormatter('vite');\n"],"mappings":"mEAOA,MAAM,GACJ,EACA,KACkB,CAClB,MAAO,OAAO,QAAQ,EAAM,CAAC,KAAK,CAAC,EAAW,MAAgB,CAC5D,UAAW,EAAU,EAAU,CAC/B,UAAW,OAAO,YAChB,OAAO,QAAQ,EAAU,CAAC,KAAK,CAAC,EAAQ,KAAa,CACnD,EACA,GAAU,EAAU,EAAQ,CAC7B,CAAC,CACH,CACF,EAAE,CACJ,EAEK,EAAa,GACjB,EAAQ,WAAW,IAAI,CAAG,EAAU,IAAI,IAUpC,GAAoB,EAAiB,IAAuB,CAChE,IAAI,EAAa,EAyBjB,MAvBA,CAgBE,EAhBE,IAAc,SACH,EACV,QAAQ,0BAA2B,OAAO,CAC1C,QAAQ,sBAAuB,OAAO,CACtC,QAAQ,gBAAiB,MAAM,CACzB,IAAc,YACV,EACV,QAAQ,sBAAuB,OAAO,CACtC,QAAQ,oBAAqB,OAAO,CACpC,QAAQ,gBAAiB,MAAM,CACzB,IAAc,OACV,EACV,QAAQ,sBAAuB,OAAO,CACtC,QAAQ,gBAAiB,MAAM,CAGrB,EACV,QAAQ,aAAc,MAAM,CAC5B,QAAQ,aAAc,OAAO,CAC7B,QAAQ,cAAe,OAAO,CAC9B,QAAQ,MAAO,SAAS,CAGtB,GAMH,EAAe,GACnB,EACG,QAAQ,uCAAwC,IAAI,CACpD,QAAQ,OAAQ,IAAI,CACpB,QAAQ,MAAO,GAAG,EAAI,IAKrB,GACH,EAA6B,IAE5B,GACkB,CAClB,IAAM,EAAa,GAAoB,EAAiB,EAAS,EAAU,CACrE,EAAS,GAAoB,EAAY,EAAU,EAAQ,CAAC,CAElE,MAAO,CACL,IAAK,EAAW,EAAe,GAAY,EAAU,EAAM,EAAQ,CAAC,CAAC,EACpE,GAAW,EAAW,EAAe,GACpC,EAAU,EAAU,EAAQ,CAAC,CAC9B,CACF,EAWQ,EAAgB,EAAgB,SAAU,SAAS,CASnD,EAAmB,EAAgB,OAAQ,YAAY,CAUvD,EAAqB,EAAgB,OAAO,CAU5C,EAAmB,EAAgB,OAAO,CAS1C,EAAqB,EAAgB,OAAO,CAS5C,EAAc,EAAgB,OAAQ,OAAO,CAS7C,EAAwB,EAAgB,OAAO,CAM/C,EAAc,EAAgB,OAAO"}
|
package/dist/esm/cli/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export*from"@intlayer/cli";
|
package/dist/esm/cli/script.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"script.mjs","names":[],"sources":["../../../src/cli/script.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { setAPI } from '@intlayer/cli';\n\nsetAPI();\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"script.mjs","names":[],"sources":["../../../src/cli/script.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { setAPI } from '@intlayer/cli';\n\nsetAPI();\n"],"mappings":";uCAGA,GAAQ"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,36 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import configuration from "@intlayer/config/built";
|
|
3
|
-
import { Intl, compact, cond, currency, date, enu, gender, getBrowserLocale, getCanonicalPath, getCookie, getDictionary, getEnumeration, getEnumeration as getEnumerationContent, getHTMLTextDir, getIntlayer, getLocale, getLocaleFromPath, getLocaleFromStorage, getLocaleLang, getLocaleName, getLocalizedPath, getLocalizedUrl, getMarkdownMetadata, getMultilingualUrls, getNesting, getPathWithoutLocale, getPrefix, getRewriteRules, getTranslation, getTranslation as getTranslationContent, html, insert, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, md, nest, number, percentage, relativeTime, setLocaleInStorage, t, units, validatePrefix } from "@intlayer/core";
|
|
4
|
-
import { file } from "@intlayer/core/file";
|
|
5
|
-
|
|
6
|
-
//#region src/index.ts
|
|
7
|
-
/** biome-ignore-all lint/suspicious/noEmptyInterface: Intlayer module augmentation registries */
|
|
8
|
-
/**
|
|
9
|
-
* Rexport using named import because πof Tsup bug in CJS
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* The configuration of Intlayer.
|
|
13
|
-
*/
|
|
14
|
-
Locales$1.ALL_LOCALES;
|
|
15
|
-
/**
|
|
16
|
-
* Returns the configuration of Intlayer.
|
|
17
|
-
*
|
|
18
|
-
* @deprecated Use `import { configuration } from 'intlayer'` instead.
|
|
19
|
-
*/
|
|
20
|
-
const getConfiguration = () => configuration;
|
|
21
|
-
/**
|
|
22
|
-
* The locales defined in the configuration.
|
|
23
|
-
*/
|
|
24
|
-
const locales = configuration.internationalization.locales;
|
|
25
|
-
/**
|
|
26
|
-
* The required locales defined in the configuration.
|
|
27
|
-
*/
|
|
28
|
-
const requiredLocales = configuration.internationalization.requiredLocales;
|
|
29
|
-
/**
|
|
30
|
-
* The default locale defined in the configuration.
|
|
31
|
-
*/
|
|
32
|
-
const defaultLocale = configuration.internationalization.defaultLocale;
|
|
33
|
-
|
|
34
|
-
//#endregion
|
|
35
|
-
export { Intl, Locales, compact, cond, configuration, currency, date, defaultLocale, enu, file, gender, getBrowserLocale, getCanonicalPath, getConfiguration, getCookie, getDictionary, getEnumeration, getEnumerationContent, getHTMLTextDir, getIntlayer, getLocale, getLocaleFromPath, getLocaleFromStorage, getLocaleLang, getLocaleName, getLocalizedPath, getLocalizedUrl, getMarkdownMetadata, getMultilingualUrls, getNesting, getPathWithoutLocale, getPrefix, getRewriteRules, getTranslation, getTranslationContent, html, insert, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, locales, md, nest, number, percentage, relativeTime, requiredLocales, setLocaleInStorage, t, units, validatePrefix };
|
|
1
|
+
import{Locales as e,Locales as t}from"@intlayer/types";import n from"@intlayer/config/built";import{file as r}from"@intlayer/core/file";import{Intl as i,compact as a,currency as o,date as s,number as c,percentage as l,relativeTime as u,units as d}from"@intlayer/core/formatters";import{getDictionary as f,getEnumeration as p,getEnumeration as m,getIntlayer as h,getNesting as g,getTranslation as _,getTranslation as v}from"@intlayer/core/interpreter";import{getBrowserLocale as y,getCanonicalPath as b,getHTMLTextDir as x,getLocale as S,getLocaleFromPath as C,getLocaleLang as w,getLocaleName as T,getLocalizedPath as E,getLocalizedUrl as D,getMultilingualUrls as O,getPathWithoutLocale as k,getPrefix as A,getRewriteRules as j,localeDetector as M,localeFlatMap as N,localeMap as P,localeRecord as F,localeResolver as I,validatePrefix as L}from"@intlayer/core/localization";import{getMarkdownMetadata as R}from"@intlayer/core/markdown";import{cond as z,enu as B,gender as V,html as H,insert as U,md as W,nest as G,t as K}from"@intlayer/core/transpiler";import{getCookie as q,getLocaleFromStorage as J,setLocaleInStorage as Y}from"@intlayer/core/utils";t.ALL_LOCALES;const X=()=>n,Z=n.internationalization.locales,Q=n.internationalization.requiredLocales,$=n.internationalization.defaultLocale;export{i as Intl,e as Locales,a as compact,z as cond,n as configuration,o as currency,s as date,$ as defaultLocale,B as enu,r as file,V as gender,y as getBrowserLocale,b as getCanonicalPath,X as getConfiguration,q as getCookie,f as getDictionary,p as getEnumeration,m as getEnumerationContent,x as getHTMLTextDir,h as getIntlayer,S as getLocale,C as getLocaleFromPath,J as getLocaleFromStorage,w as getLocaleLang,T as getLocaleName,E as getLocalizedPath,D as getLocalizedUrl,R as getMarkdownMetadata,O as getMultilingualUrls,g as getNesting,k as getPathWithoutLocale,A as getPrefix,j as getRewriteRules,_ as getTranslation,v as getTranslationContent,H as html,U as insert,M as localeDetector,N as localeFlatMap,P as localeMap,F as localeRecord,I as localeResolver,Z as locales,W as md,G as nest,c as number,l as percentage,u as relativeTime,Q as requiredLocales,Y as setLocaleInStorage,K as t,d as units,L as validatePrefix};
|
|
36
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["Locales"],"sources":["../../src/index.ts"],"sourcesContent":["/** biome-ignore-all lint/suspicious/noEmptyInterface: Intlayer module augmentation registries */\nimport {\n type Dictionary as DictionaryCore,\n type CustomIntlayerConfig as IntlayerConfig,\n Locales,\n type SchemaKeys,\n} from '@intlayer/types';\n\n/**\n * The dictionary type used to define the structure of a dictionary.\n * It is used to provide type safety and autocompletion when defining a dictionary.\n *\n * @example\n * ```ts\n * import { Dictionary } from 'intlayer';\n *\n * const dictionary: Dictionary = { ... };\n * ```\n */\ntype Dictionary<\n T = undefined,\n SchemaKey extends SchemaKeys | undefined = undefined,\n> = DictionaryCore<T, SchemaKey, true>;\n\n/**\n * The content of a dictionary.\n *\n * @deprecated Use `Dictionary<T>` instead.\n */\ntype DeclarationContent<\n T = undefined,\n SchemaKey extends SchemaKeys | undefined = undefined,\n> = Dictionary<T, SchemaKey>;\n\n/**\n * A list of all supported locales.\n *\n * @deprecated Use `Locales.ALL_LOCALES` instead.\n */\nconst localeList = Locales.ALL_LOCALES;\n\nexport {\n type ContentNode,\n type Locale,\n Locales,\n type LocalesValues,\n type StrictModeLocaleMap,\n} from '@intlayer/types';\nexport type { DeclarationContent, Dictionary, IntlayerConfig, localeList };\n\n/**\n * Rexport using named import because πof Tsup bug in CJS\n */\n/**\n * The configuration of Intlayer.\n */\nimport configuration from '@intlayer/config/built';\n\n/**\n * Returns the configuration of Intlayer.\n
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["Locales"],"sources":["../../src/index.ts"],"sourcesContent":["/** biome-ignore-all lint/suspicious/noEmptyInterface: Intlayer module augmentation registries */\nimport {\n type Dictionary as DictionaryCore,\n type CustomIntlayerConfig as IntlayerConfig,\n Locales,\n type SchemaKeys,\n} from '@intlayer/types';\n\n/**\n * The dictionary type used to define the structure of a dictionary.\n * It is used to provide type safety and autocompletion when defining a dictionary.\n *\n * @example\n * ```ts\n * import { Dictionary } from 'intlayer';\n *\n * const dictionary: Dictionary = { ... };\n * ```\n */\ntype Dictionary<\n T = undefined,\n SchemaKey extends SchemaKeys | undefined = undefined,\n> = DictionaryCore<T, SchemaKey, true>;\n\n/**\n * The content of a dictionary.\n *\n * @deprecated Use `Dictionary<T>` instead.\n */\ntype DeclarationContent<\n T = undefined,\n SchemaKey extends SchemaKeys | undefined = undefined,\n> = Dictionary<T, SchemaKey>;\n\n/**\n * A list of all supported locales.\n *\n * @deprecated Use `Locales.ALL_LOCALES` instead.\n */\nconst localeList = Locales.ALL_LOCALES;\n\nexport {\n type ContentNode,\n type Locale,\n Locales,\n type LocalesValues,\n type StrictModeLocaleMap,\n} from '@intlayer/types';\nexport type { DeclarationContent, Dictionary, IntlayerConfig, localeList };\n\n/**\n * Rexport using named import because πof Tsup bug in CJS\n */\n/**\n * The configuration of Intlayer.\n */\nimport configuration from '@intlayer/config/built';\n\n/**\n * Returns the configuration of Intlayer.\n */\nconst getConfiguration = () => configuration;\n\n/**\n * The locales defined in the configuration.\n */\nconst locales = configuration.internationalization.locales;\n\n/**\n * The required locales defined in the configuration.\n */\nconst requiredLocales = configuration.internationalization.requiredLocales;\n\n/**\n * The default locale defined in the configuration.\n */\nconst defaultLocale = configuration.internationalization.defaultLocale;\n\n// Reexport here for CJS compatibility\n// Fix ReferenceError: Cannot access 'xxx' before initialization\nexport {\n configuration,\n getConfiguration,\n locales,\n requiredLocales,\n defaultLocale,\n};\n\nexport { file } from '@intlayer/core/file'; // Include specific export for browser because of node js function that can't be used in browser\nexport {\n compact,\n currency,\n date,\n Intl,\n number,\n percentage,\n relativeTime,\n units,\n} from '@intlayer/core/formatters';\nexport {\n getDictionary,\n getEnumeration /**\n * @deprecated Use `getEnumeration` instead.\n */,\n getEnumeration as getEnumerationContent,\n getIntlayer,\n getNesting,\n getTranslation /**\n * @deprecated Use `getTranslation` instead.\n */,\n getTranslation as getTranslationContent,\n} from '@intlayer/core/interpreter';\nexport {\n getBrowserLocale,\n getCanonicalPath,\n getHTMLTextDir,\n getLocale,\n getLocaleFromPath,\n getLocaleLang,\n getLocaleName,\n getLocalizedPath,\n getLocalizedUrl,\n getMultilingualUrls,\n getPathWithoutLocale,\n getPrefix,\n getRewriteRules,\n localeDetector,\n localeFlatMap,\n localeMap,\n localeRecord,\n localeResolver,\n validatePrefix,\n} from '@intlayer/core/localization';\nexport { getMarkdownMetadata } from '@intlayer/core/markdown';\nexport {\n cond,\n enu,\n gender,\n html,\n insert,\n md,\n nest,\n t,\n} from '@intlayer/core/transpiler';\nexport {\n getCookie,\n getLocaleFromStorage,\n setLocaleInStorage,\n} from '@intlayer/core/utils';\n\n// --- Registries to be augmented by the generator ---\nexport interface __DictionaryRegistry {} // id -> interfaceof ictionary\nexport interface __DeclaredLocalesRegistry {} // 'fr': 1, 'en': 1, ...\nexport interface __RequiredLocalesRegistry {} // 'en': 1, ...\nexport interface __SchemaRegistry {} // id -> interface of schema\nexport interface __StrictModeRegistry {} // one of: { strict: true } | { inclusive: true } | { loose: true }\n"],"mappings":"goCAuCmBA,EAAQ,YAsB3B,MAAM,MAAyB,EAKzB,EAAU,EAAc,qBAAqB,QAK7C,EAAkB,EAAc,qBAAqB,gBAKrD,EAAgB,EAAc,qBAAqB"}
|
|
@@ -1,105 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
const buildRules = (rules, processor) => ({ rules: Object.entries(rules).map(([canonical, localized]) => ({
|
|
3
|
-
canonical: processor(canonical),
|
|
4
|
-
localized: Object.fromEntries(Object.entries(localized).map(([locale, pattern]) => [locale, pattern ? processor(pattern) : pattern]))
|
|
5
|
-
})) });
|
|
6
|
-
const cleanPath = (pattern) => pattern.startsWith("/") ? pattern : `/${pattern}`;
|
|
7
|
-
/**
|
|
8
|
-
* Standardizes pattern to :param syntax.
|
|
9
|
-
* Supports:
|
|
10
|
-
* - Next.js/SvelteKit/Nuxt: [slug], [...slug], [[slug]]
|
|
11
|
-
* - TanStack Router: $slug
|
|
12
|
-
* - Solid Router: *slug
|
|
13
|
-
* - React/Vue Router: :slug, *
|
|
14
|
-
*/
|
|
15
|
-
const normalizePattern = (pattern, framework) => {
|
|
16
|
-
let normalized = pattern;
|
|
17
|
-
if (framework === "nextjs") normalized = normalized.replace(/\[\[\.\.\.([^\]]+)\]\]/g, ":$1*").replace(/\[\.\.\.([^\]]+)\]/g, ":$1+").replace(/\[([^\]]+)\]/g, ":$1");
|
|
18
|
-
else if (framework === "sveltekit") normalized = normalized.replace(/\[\.\.\.([^\]]+)\]/g, ":$1*").replace(/\[\[([^\]]+)\]\]/g, ":$1?").replace(/\[([^\]]+)\]/g, ":$1");
|
|
19
|
-
else if (framework === "nuxt") normalized = normalized.replace(/\[\.\.\.([^\]]+)\]/g, ":$1*").replace(/\[([^\]]+)\]/g, ":$1");
|
|
20
|
-
else normalized = normalized.replace(/\$([^/]+)/g, ":$1").replace(/\*([^/]+)/g, ":$1*").replace(/:([^/]+)\?/g, ":$1?").replace(/\*/g, ":path*");
|
|
21
|
-
return normalized;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Removes locale markers from the pattern.
|
|
25
|
-
*/
|
|
26
|
-
const stripLocale = (pattern) => pattern.replace(/\/?(:locale|\[locale\]|\$locale)\/?/g, "/").replace(/\/+/g, "/").replace(/\/$/, "") || "/";
|
|
27
|
-
/**
|
|
28
|
-
* Factory to create formatters that populate 'url' and a specific proxy key.
|
|
29
|
-
*/
|
|
30
|
-
const createFormatter = (proxyKey, framework) => (rules) => {
|
|
31
|
-
const normalize = (pattern) => normalizePattern(pattern, framework);
|
|
32
|
-
const strip = (pattern) => stripLocale(normalize(pattern));
|
|
33
|
-
return {
|
|
34
|
-
url: buildRules(rules, (pattern) => cleanPath(strip(pattern))),
|
|
35
|
-
[proxyKey]: buildRules(rules, (pattern) => cleanPath(normalize(pattern)))
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Formatter for Next.js style rewrites.
|
|
40
|
-
* Patterns use Next.js dynamic routing syntax:
|
|
41
|
-
* - Slug: `[slug]`
|
|
42
|
-
* - Catch-all: `[...slug]` (1+)
|
|
43
|
-
* - Optional catch-all: `[[...slug]]` (0+)
|
|
44
|
-
* - Locale: `[locale]`
|
|
45
|
-
*/
|
|
46
|
-
const nextjsRewrite = createFormatter("nextjs", "nextjs");
|
|
47
|
-
/**
|
|
48
|
-
* Formatter for SvelteKit style rewrites.
|
|
49
|
-
* Patterns use SvelteKit dynamic routing syntax:
|
|
50
|
-
* - Slug: `[slug]`
|
|
51
|
-
* - Catch-all: `[...slug]` (0+)
|
|
52
|
-
* - Locale: `[locale]`
|
|
53
|
-
*/
|
|
54
|
-
const svelteKitRewrite = createFormatter("vite", "sveltekit");
|
|
55
|
-
/**
|
|
56
|
-
* Formatter for React Router style rewrites.
|
|
57
|
-
* Patterns use React Router dynamic routing syntax:
|
|
58
|
-
* - Slug: `:slug`
|
|
59
|
-
* - Optional slug: `:slug?`
|
|
60
|
-
* - Catch-all: `*`
|
|
61
|
-
* - Locale: `:locale`
|
|
62
|
-
*/
|
|
63
|
-
const reactRouterRewrite = createFormatter("vite");
|
|
64
|
-
/**
|
|
65
|
-
* Formatter for Vue style rewrites.
|
|
66
|
-
* Patterns use Vue Router 4 dynamic routing syntax:
|
|
67
|
-
* - Slug: `:slug`
|
|
68
|
-
* - Optional slug: `:slug?`
|
|
69
|
-
* - Catch-all: `:slug*` or `:slug+`
|
|
70
|
-
* - Locale: `:locale`
|
|
71
|
-
*/
|
|
72
|
-
const vueRouterRewrite = createFormatter("vite");
|
|
73
|
-
/**
|
|
74
|
-
* Formatter for Solid Router style rewrites.
|
|
75
|
-
* Patterns use Solid Router dynamic routing syntax:
|
|
76
|
-
* - Slug: `:slug`
|
|
77
|
-
* - Catch-all: `*slug`
|
|
78
|
-
* - Locale: `:locale`
|
|
79
|
-
*/
|
|
80
|
-
const solidRouterRewrite = createFormatter("vite");
|
|
81
|
-
/**
|
|
82
|
-
* Formatter for Nuxt style rewrites.
|
|
83
|
-
* Patterns use Nuxt 3 dynamic routing syntax:
|
|
84
|
-
* - Slug: `[slug]`
|
|
85
|
-
* - Catch-all: `[...slug]` (0+)
|
|
86
|
-
* - Locale: `[locale]`
|
|
87
|
-
*/
|
|
88
|
-
const nuxtRewrite = createFormatter("vite", "nuxt");
|
|
89
|
-
/**
|
|
90
|
-
* Formatter for TanStack Router style rewrites.
|
|
91
|
-
* Patterns use TanStack Router dynamic routing syntax:
|
|
92
|
-
* - Slug: `$slug`
|
|
93
|
-
* - Catch-all: `*`
|
|
94
|
-
* - Locale: `$locale`
|
|
95
|
-
*/
|
|
96
|
-
const tanstackRouterRewrite = createFormatter("vite");
|
|
97
|
-
/**
|
|
98
|
-
* Generic formatter for Vite-based projects.
|
|
99
|
-
* Supports most dynamic routing syntaxes and normalizes them for the Vite proxy.
|
|
100
|
-
*/
|
|
101
|
-
const viteRewrite = createFormatter("vite");
|
|
102
|
-
|
|
103
|
-
//#endregion
|
|
104
|
-
export { nextjsRewrite, nuxtRewrite, reactRouterRewrite, solidRouterRewrite, svelteKitRewrite, tanstackRouterRewrite, viteRewrite, vueRouterRewrite };
|
|
1
|
+
const e=(e,t)=>({rules:Object.entries(e).map(([e,n])=>({canonical:t(e),localized:Object.fromEntries(Object.entries(n).map(([e,n])=>[e,n&&t(n)]))}))}),t=e=>e.startsWith(`/`)?e:`/${e}`,n=(e,t)=>{let n=e;return n=t===`nextjs`?n.replace(/\[\[\.\.\.([^\]]+)\]\]/g,`:$1*`).replace(/\[\.\.\.([^\]]+)\]/g,`:$1+`).replace(/\[([^\]]+)\]/g,`:$1`):t===`sveltekit`?n.replace(/\[\.\.\.([^\]]+)\]/g,`:$1*`).replace(/\[\[([^\]]+)\]\]/g,`:$1?`).replace(/\[([^\]]+)\]/g,`:$1`):t===`nuxt`?n.replace(/\[\.\.\.([^\]]+)\]/g,`:$1*`).replace(/\[([^\]]+)\]/g,`:$1`):n.replace(/\$([^/]+)/g,`:$1`).replace(/\*([^/]+)/g,`:$1*`).replace(/:([^/]+)\?/g,`:$1?`).replace(/\*/g,`:path*`),n},r=e=>e.replace(/\/?(:locale|\[locale\]|\$locale)\/?/g,`/`).replace(/\/+/g,`/`).replace(/\/$/,``)||`/`,i=(i,a)=>o=>{let s=e=>n(e,a),c=e=>r(s(e));return{url:e(o,e=>t(c(e))),[i]:e(o,e=>t(s(e)))}},a=i(`nextjs`,`nextjs`),o=i(`vite`,`sveltekit`),s=i(`vite`),c=i(`vite`),l=i(`vite`),u=i(`vite`,`nuxt`),d=i(`vite`),f=i(`vite`);export{a as nextjsRewrite,u as nuxtRewrite,s as reactRouterRewrite,l as solidRouterRewrite,o as svelteKitRewrite,d as tanstackRouterRewrite,f as viteRewrite,c as vueRouterRewrite};
|
|
105
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/routing/index.ts"],"sourcesContent":["import type {\n RewriteObject,\n RewriteRule,\n RewriteRules,\n StrictModeLocaleMap,\n} from '@intlayer/types';\n\nconst buildRules = (\n rules: Record<string, StrictModeLocaleMap<string>>,\n processor: (pattern: string) => string\n): RewriteRules => ({\n rules: Object.entries(rules).map(([canonical, localized]) => ({\n canonical: processor(canonical),\n localized: Object.fromEntries(\n Object.entries(localized).map(([locale, pattern]) => [\n locale,\n pattern ? processor(pattern) : pattern,\n ])\n ) as StrictModeLocaleMap<string>,\n })) as RewriteRule[],\n});\n\nconst cleanPath = (pattern: string) =>\n pattern.startsWith('/') ? pattern : `/${pattern}`;\n\n/**\n * Standardizes pattern to :param syntax.\n * Supports:\n * - Next.js/SvelteKit/Nuxt: [slug], [...slug], [[slug]]\n * - TanStack Router: $slug\n * - Solid Router: *slug\n * - React/Vue Router: :slug, *\n */\nconst normalizePattern = (pattern: string, framework?: string) => {\n let normalized = pattern;\n\n if (framework === 'nextjs') {\n normalized = normalized\n .replace(/\\[\\[\\.\\.\\.([^\\]]+)\\]\\]/g, ':$1*') // [[...slug]] -> :slug* (0+)\n .replace(/\\[\\.\\.\\.([^\\]]+)\\]/g, ':$1+') // [...slug] -> :slug+ (1+)\n .replace(/\\[([^\\]]+)\\]/g, ':$1'); // [slug] -> :slug (1)\n } else if (framework === 'sveltekit') {\n normalized = normalized\n .replace(/\\[\\.\\.\\.([^\\]]+)\\]/g, ':$1*') // [...path] -> :path* (0+)\n .replace(/\\[\\[([^\\]]+)\\]\\]/g, ':$1?') // [[optional]] -> :optional? (0-1)\n .replace(/\\[([^\\]]+)\\]/g, ':$1'); // [slug] -> :slug (1)\n } else if (framework === 'nuxt') {\n normalized = normalized\n .replace(/\\[\\.\\.\\.([^\\]]+)\\]/g, ':$1*') // [...slug] -> :slug* (0+)\n .replace(/\\[([^\\]]+)\\]/g, ':$1'); // [slug] -> :slug (1)\n } else {\n // Default / Generic (React Router, Vue Router, Solid Router, TanStack Router)\n normalized = normalized\n .replace(/\\$([^/]+)/g, ':$1') // TanStack $slug -> :slug\n .replace(/\\*([^/]+)/g, ':$1*') // Solid *slug -> :slug*\n .replace(/:([^/]+)\\?/g, ':$1?') // Vue Router/React Router :slug? -> :slug?\n .replace(/\\*/g, ':path*'); // React Router * -> :path*\n }\n\n return normalized;\n};\n\n/**\n * Removes locale markers from the pattern.\n */\nconst stripLocale = (pattern: string) =>\n pattern\n .replace(/\\/?(:locale|\\[locale\\]|\\$locale)\\/?/g, '/')\n .replace(/\\/+/g, '/')\n .replace(/\\/$/, '') || '/';\n\n/**\n * Factory to create formatters that populate 'url' and a specific proxy key.\n */\nconst createFormatter =\n (proxyKey: 'nextjs' | 'vite', framework?: string) =>\n <T extends string = string>(\n rules: Record<T, StrictModeLocaleMap<string>>\n ): RewriteObject => {\n const normalize = (pattern: string) => normalizePattern(pattern, framework);\n const strip = (pattern: string) => stripLocale(normalize(pattern));\n\n return {\n url: buildRules(rules as any, (pattern) => cleanPath(strip(pattern))),\n [proxyKey]: buildRules(rules as any, (pattern) =>\n cleanPath(normalize(pattern))\n ),\n } as RewriteObject;\n };\n\n/**\n * Formatter for Next.js style rewrites.\n * Patterns use Next.js dynamic routing syntax:\n * - Slug: `[slug]`\n * - Catch-all: `[...slug]` (1+)\n * - Optional catch-all: `[[...slug]]` (0+)\n * - Locale: `[locale]`\n */\nexport const nextjsRewrite = createFormatter('nextjs', 'nextjs');\n\n/**\n * Formatter for SvelteKit style rewrites.\n * Patterns use SvelteKit dynamic routing syntax:\n * - Slug: `[slug]`\n * - Catch-all: `[...slug]` (0+)\n * - Locale: `[locale]`\n */\nexport const svelteKitRewrite = createFormatter('vite', 'sveltekit');\n\n/**\n * Formatter for React Router style rewrites.\n * Patterns use React Router dynamic routing syntax:\n * - Slug: `:slug`\n * - Optional slug: `:slug?`\n * - Catch-all: `*`\n * - Locale: `:locale`\n */\nexport const reactRouterRewrite = createFormatter('vite');\n\n/**\n * Formatter for Vue style rewrites.\n * Patterns use Vue Router 4 dynamic routing syntax:\n * - Slug: `:slug`\n * - Optional slug: `:slug?`\n * - Catch-all: `:slug*` or `:slug+`\n * - Locale: `:locale`\n */\nexport const vueRouterRewrite = createFormatter('vite');\n\n/**\n * Formatter for Solid Router style rewrites.\n * Patterns use Solid Router dynamic routing syntax:\n * - Slug: `:slug`\n * - Catch-all: `*slug`\n * - Locale: `:locale`\n */\nexport const solidRouterRewrite = createFormatter('vite');\n\n/**\n * Formatter for Nuxt style rewrites.\n * Patterns use Nuxt 3 dynamic routing syntax:\n * - Slug: `[slug]`\n * - Catch-all: `[...slug]` (0+)\n * - Locale: `[locale]`\n */\nexport const nuxtRewrite = createFormatter('vite', 'nuxt');\n\n/**\n * Formatter for TanStack Router style rewrites.\n * Patterns use TanStack Router dynamic routing syntax:\n * - Slug: `$slug`\n * - Catch-all: `*`\n * - Locale: `$locale`\n */\nexport const tanstackRouterRewrite = createFormatter('vite');\n\n/**\n * Generic formatter for Vite-based projects.\n * Supports most dynamic routing syntaxes and normalizes them for the Vite proxy.\n */\nexport const viteRewrite = createFormatter('vite');\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/routing/index.ts"],"sourcesContent":["import type {\n RewriteObject,\n RewriteRule,\n RewriteRules,\n StrictModeLocaleMap,\n} from '@intlayer/types';\n\nconst buildRules = (\n rules: Record<string, StrictModeLocaleMap<string>>,\n processor: (pattern: string) => string\n): RewriteRules => ({\n rules: Object.entries(rules).map(([canonical, localized]) => ({\n canonical: processor(canonical),\n localized: Object.fromEntries(\n Object.entries(localized).map(([locale, pattern]) => [\n locale,\n pattern ? processor(pattern) : pattern,\n ])\n ) as StrictModeLocaleMap<string>,\n })) as RewriteRule[],\n});\n\nconst cleanPath = (pattern: string) =>\n pattern.startsWith('/') ? pattern : `/${pattern}`;\n\n/**\n * Standardizes pattern to :param syntax.\n * Supports:\n * - Next.js/SvelteKit/Nuxt: [slug], [...slug], [[slug]]\n * - TanStack Router: $slug\n * - Solid Router: *slug\n * - React/Vue Router: :slug, *\n */\nconst normalizePattern = (pattern: string, framework?: string) => {\n let normalized = pattern;\n\n if (framework === 'nextjs') {\n normalized = normalized\n .replace(/\\[\\[\\.\\.\\.([^\\]]+)\\]\\]/g, ':$1*') // [[...slug]] -> :slug* (0+)\n .replace(/\\[\\.\\.\\.([^\\]]+)\\]/g, ':$1+') // [...slug] -> :slug+ (1+)\n .replace(/\\[([^\\]]+)\\]/g, ':$1'); // [slug] -> :slug (1)\n } else if (framework === 'sveltekit') {\n normalized = normalized\n .replace(/\\[\\.\\.\\.([^\\]]+)\\]/g, ':$1*') // [...path] -> :path* (0+)\n .replace(/\\[\\[([^\\]]+)\\]\\]/g, ':$1?') // [[optional]] -> :optional? (0-1)\n .replace(/\\[([^\\]]+)\\]/g, ':$1'); // [slug] -> :slug (1)\n } else if (framework === 'nuxt') {\n normalized = normalized\n .replace(/\\[\\.\\.\\.([^\\]]+)\\]/g, ':$1*') // [...slug] -> :slug* (0+)\n .replace(/\\[([^\\]]+)\\]/g, ':$1'); // [slug] -> :slug (1)\n } else {\n // Default / Generic (React Router, Vue Router, Solid Router, TanStack Router)\n normalized = normalized\n .replace(/\\$([^/]+)/g, ':$1') // TanStack $slug -> :slug\n .replace(/\\*([^/]+)/g, ':$1*') // Solid *slug -> :slug*\n .replace(/:([^/]+)\\?/g, ':$1?') // Vue Router/React Router :slug? -> :slug?\n .replace(/\\*/g, ':path*'); // React Router * -> :path*\n }\n\n return normalized;\n};\n\n/**\n * Removes locale markers from the pattern.\n */\nconst stripLocale = (pattern: string) =>\n pattern\n .replace(/\\/?(:locale|\\[locale\\]|\\$locale)\\/?/g, '/')\n .replace(/\\/+/g, '/')\n .replace(/\\/$/, '') || '/';\n\n/**\n * Factory to create formatters that populate 'url' and a specific proxy key.\n */\nconst createFormatter =\n (proxyKey: 'nextjs' | 'vite', framework?: string) =>\n <T extends string = string>(\n rules: Record<T, StrictModeLocaleMap<string>>\n ): RewriteObject => {\n const normalize = (pattern: string) => normalizePattern(pattern, framework);\n const strip = (pattern: string) => stripLocale(normalize(pattern));\n\n return {\n url: buildRules(rules as any, (pattern) => cleanPath(strip(pattern))),\n [proxyKey]: buildRules(rules as any, (pattern) =>\n cleanPath(normalize(pattern))\n ),\n } as RewriteObject;\n };\n\n/**\n * Formatter for Next.js style rewrites.\n * Patterns use Next.js dynamic routing syntax:\n * - Slug: `[slug]`\n * - Catch-all: `[...slug]` (1+)\n * - Optional catch-all: `[[...slug]]` (0+)\n * - Locale: `[locale]`\n */\nexport const nextjsRewrite = createFormatter('nextjs', 'nextjs');\n\n/**\n * Formatter for SvelteKit style rewrites.\n * Patterns use SvelteKit dynamic routing syntax:\n * - Slug: `[slug]`\n * - Catch-all: `[...slug]` (0+)\n * - Locale: `[locale]`\n */\nexport const svelteKitRewrite = createFormatter('vite', 'sveltekit');\n\n/**\n * Formatter for React Router style rewrites.\n * Patterns use React Router dynamic routing syntax:\n * - Slug: `:slug`\n * - Optional slug: `:slug?`\n * - Catch-all: `*`\n * - Locale: `:locale`\n */\nexport const reactRouterRewrite = createFormatter('vite');\n\n/**\n * Formatter for Vue style rewrites.\n * Patterns use Vue Router 4 dynamic routing syntax:\n * - Slug: `:slug`\n * - Optional slug: `:slug?`\n * - Catch-all: `:slug*` or `:slug+`\n * - Locale: `:locale`\n */\nexport const vueRouterRewrite = createFormatter('vite');\n\n/**\n * Formatter for Solid Router style rewrites.\n * Patterns use Solid Router dynamic routing syntax:\n * - Slug: `:slug`\n * - Catch-all: `*slug`\n * - Locale: `:locale`\n */\nexport const solidRouterRewrite = createFormatter('vite');\n\n/**\n * Formatter for Nuxt style rewrites.\n * Patterns use Nuxt 3 dynamic routing syntax:\n * - Slug: `[slug]`\n * - Catch-all: `[...slug]` (0+)\n * - Locale: `[locale]`\n */\nexport const nuxtRewrite = createFormatter('vite', 'nuxt');\n\n/**\n * Formatter for TanStack Router style rewrites.\n * Patterns use TanStack Router dynamic routing syntax:\n * - Slug: `$slug`\n * - Catch-all: `*`\n * - Locale: `$locale`\n */\nexport const tanstackRouterRewrite = createFormatter('vite');\n\n/**\n * Generic formatter for Vite-based projects.\n * Supports most dynamic routing syntaxes and normalizes them for the Vite proxy.\n */\nexport const viteRewrite = createFormatter('vite');\n"],"mappings":"AAOA,MAAM,GACJ,EACA,KACkB,CAClB,MAAO,OAAO,QAAQ,EAAM,CAAC,KAAK,CAAC,EAAW,MAAgB,CAC5D,UAAW,EAAU,EAAU,CAC/B,UAAW,OAAO,YAChB,OAAO,QAAQ,EAAU,CAAC,KAAK,CAAC,EAAQ,KAAa,CACnD,EACA,GAAU,EAAU,EAAQ,CAC7B,CAAC,CACH,CACF,EAAE,CACJ,EAEK,EAAa,GACjB,EAAQ,WAAW,IAAI,CAAG,EAAU,IAAI,IAUpC,GAAoB,EAAiB,IAAuB,CAChE,IAAI,EAAa,EAyBjB,MAvBA,CAgBE,EAhBE,IAAc,SACH,EACV,QAAQ,0BAA2B,OAAO,CAC1C,QAAQ,sBAAuB,OAAO,CACtC,QAAQ,gBAAiB,MAAM,CACzB,IAAc,YACV,EACV,QAAQ,sBAAuB,OAAO,CACtC,QAAQ,oBAAqB,OAAO,CACpC,QAAQ,gBAAiB,MAAM,CACzB,IAAc,OACV,EACV,QAAQ,sBAAuB,OAAO,CACtC,QAAQ,gBAAiB,MAAM,CAGrB,EACV,QAAQ,aAAc,MAAM,CAC5B,QAAQ,aAAc,OAAO,CAC7B,QAAQ,cAAe,OAAO,CAC9B,QAAQ,MAAO,SAAS,CAGtB,GAMH,EAAe,GACnB,EACG,QAAQ,uCAAwC,IAAI,CACpD,QAAQ,OAAQ,IAAI,CACpB,QAAQ,MAAO,GAAG,EAAI,IAKrB,GACH,EAA6B,IAE5B,GACkB,CAClB,IAAM,EAAa,GAAoB,EAAiB,EAAS,EAAU,CACrE,EAAS,GAAoB,EAAY,EAAU,EAAQ,CAAC,CAElE,MAAO,CACL,IAAK,EAAW,EAAe,GAAY,EAAU,EAAM,EAAQ,CAAC,CAAC,EACpE,GAAW,EAAW,EAAe,GACpC,EAAU,EAAU,EAAQ,CAAC,CAC9B,CACF,EAWQ,EAAgB,EAAgB,SAAU,SAAS,CASnD,EAAmB,EAAgB,OAAQ,YAAY,CAUvD,EAAqB,EAAgB,OAAO,CAU5C,EAAmB,EAAgB,OAAO,CAS1C,EAAqB,EAAgB,OAAO,CAS5C,EAAc,EAAgB,OAAQ,OAAO,CAS7C,EAAwB,EAAgB,OAAO,CAM/C,EAAc,EAAgB,OAAO"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import * as _intlayer_types0 from "@intlayer/types";
|
|
2
2
|
import { ContentNode, CustomIntlayerConfig as IntlayerConfig, Dictionary as Dictionary$1, Locale, Locales, Locales as Locales$1, LocalesValues, SchemaKeys, StrictModeLocaleMap } from "@intlayer/types";
|
|
3
3
|
import configuration from "@intlayer/config/built";
|
|
4
|
-
import { Intl, compact, cond, currency, date, enu, gender, getBrowserLocale, getCanonicalPath, getCookie, getDictionary, getEnumeration, getEnumeration as getEnumerationContent, getHTMLTextDir, getIntlayer, getLocale, getLocaleFromPath, getLocaleFromStorage, getLocaleLang, getLocaleName, getLocalizedPath, getLocalizedUrl, getMarkdownMetadata, getMultilingualUrls, getNesting, getPathWithoutLocale, getPrefix, getRewriteRules, getTranslation, getTranslation as getTranslationContent, html, insert, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, md, nest, number, percentage, relativeTime, setLocaleInStorage, t, units, validatePrefix } from "@intlayer/core";
|
|
5
4
|
import { file } from "@intlayer/core/file";
|
|
5
|
+
import { Intl, compact, currency, date, number, percentage, relativeTime, units } from "@intlayer/core/formatters";
|
|
6
|
+
import { getDictionary, getEnumeration, getEnumeration as getEnumerationContent, getIntlayer, getNesting, getTranslation, getTranslation as getTranslationContent } from "@intlayer/core/interpreter";
|
|
7
|
+
import { getBrowserLocale, getCanonicalPath, getHTMLTextDir, getLocale, getLocaleFromPath, getLocaleLang, getLocaleName, getLocalizedPath, getLocalizedUrl, getMultilingualUrls, getPathWithoutLocale, getPrefix, getRewriteRules, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, validatePrefix } from "@intlayer/core/localization";
|
|
8
|
+
import { getMarkdownMetadata } from "@intlayer/core/markdown";
|
|
9
|
+
import { cond, enu, gender, html, insert, md, nest, t } from "@intlayer/core/transpiler";
|
|
10
|
+
import { getCookie, getLocaleFromStorage, setLocaleInStorage } from "@intlayer/core/utils";
|
|
6
11
|
|
|
7
12
|
//#region src/index.d.ts
|
|
8
13
|
/**
|
|
@@ -333,8 +338,6 @@ declare const localeList: {
|
|
|
333
338
|
};
|
|
334
339
|
/**
|
|
335
340
|
* Returns the configuration of Intlayer.
|
|
336
|
-
*
|
|
337
|
-
* @deprecated Use `import { configuration } from 'intlayer'` instead.
|
|
338
341
|
*/
|
|
339
342
|
declare const getConfiguration: () => _intlayer_types0.IntlayerConfig;
|
|
340
343
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAMyB;KAapB,UAAA,kCAEe,UAAA,4BAChB,YAAA,CAAe,CAAA,EAAG,SAAA;;;;;;KAOjB,kBAAA,kCAEe,UAAA,4BAChB,UAAA,CAAW,CAAA,EAAG,SAAA;;;;;;cAOZ,UAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsBA,gBAAA,QAAsC,gBAAA,CAAtB,cAAA;;;;cAKhB,OAAA,EAAO,SAAA,CAAA,MAAA;;;;cAKP,eAAA,EAAe,SAAA,CAAA,MAAA;;;;cAKf,aAAA,EAAa,SAAA,CAAA,MAAA;AAAA,UA2EF,oBAAA;AAAA,UACA,yBAAA;AAAA,UACA,yBAAA;AAAA,UACA,gBAAA;AAAA,UACA,oBAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intlayer",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Manage internationalization i18n in a simple way, through TypeScript, declaration file, declare your multilingual content every where in your code.",
|
|
6
6
|
"keywords": [
|
|
@@ -99,10 +99,10 @@
|
|
|
99
99
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
100
100
|
},
|
|
101
101
|
"dependencies": {
|
|
102
|
-
"@intlayer/cli": "8.1.
|
|
103
|
-
"@intlayer/config": "8.1.
|
|
104
|
-
"@intlayer/core": "8.1.
|
|
105
|
-
"@intlayer/types": "8.1.
|
|
102
|
+
"@intlayer/cli": "8.1.3",
|
|
103
|
+
"@intlayer/config": "8.1.3",
|
|
104
|
+
"@intlayer/core": "8.1.3",
|
|
105
|
+
"@intlayer/types": "8.1.3"
|
|
106
106
|
},
|
|
107
107
|
"devDependencies": {
|
|
108
108
|
"@types/node": "25.2.3",
|