@newlogic-digital/core 4.1.7 → 4.1.9
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/index.js +73 -18
- package/package.json +9 -9
- package/types/index.d.ts +2 -0
package/index.js
CHANGED
|
@@ -46,6 +46,7 @@ const defaultOptions = {
|
|
|
46
46
|
cert: 'localhost',
|
|
47
47
|
format: ['latte'],
|
|
48
48
|
codeSplitting: undefined,
|
|
49
|
+
preloadRemover: false,
|
|
49
50
|
input: {
|
|
50
51
|
assets: [
|
|
51
52
|
'./src/styles/*.{css,pcss,scss,sass,less,styl,stylus}',
|
|
@@ -114,6 +115,23 @@ const plugin = async (options = {}) => {
|
|
|
114
115
|
*/
|
|
115
116
|
const optionalPlugins = []
|
|
116
117
|
|
|
118
|
+
if (options.preloadRemover || options.experimental) {
|
|
119
|
+
optionalPlugins.push({
|
|
120
|
+
name: '@newlogic-digital/preload-remover',
|
|
121
|
+
configResolved(config) {
|
|
122
|
+
if (config.command !== 'build') return
|
|
123
|
+
|
|
124
|
+
const pI = config.plugins.findIndex(
|
|
125
|
+
p => p.name === 'native:import-analysis-build',
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
const plugins = /** @type {import('vite').Plugin[]} */ (config.plugins)
|
|
129
|
+
|
|
130
|
+
if (pI !== -1) plugins.splice(pI, 1)
|
|
131
|
+
},
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
|
|
117
135
|
if (options.format.includes('twig')) {
|
|
118
136
|
const twig = (await import('@vituum/vite-plugin-twig')).default
|
|
119
137
|
|
|
@@ -136,9 +154,21 @@ const plugin = async (options = {}) => {
|
|
|
136
154
|
}
|
|
137
155
|
}
|
|
138
156
|
|
|
139
|
-
if (options.fontless?.options) {
|
|
157
|
+
if (options.fontless?.options || options.experimental) {
|
|
140
158
|
const { fontless } = await import('fontless')
|
|
141
159
|
|
|
160
|
+
if (!options.fontless.options && options.experimental) {
|
|
161
|
+
options.fontless.options = {
|
|
162
|
+
processCSSVariables: true,
|
|
163
|
+
defaults: { weights: ['400 700'], subsets: ['latin', 'latin-ext'] },
|
|
164
|
+
assets: { prefix: '/assets/fonts' },
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (!options.fontless.manifest && options.experimental) {
|
|
169
|
+
options.fontless.manifest = ['Inter']
|
|
170
|
+
}
|
|
171
|
+
|
|
142
172
|
if (Array.isArray(options.fontless.customProvider) && options.fontless.customProvider.length > 0) {
|
|
143
173
|
options.fontless.options.providers ??= {}
|
|
144
174
|
options.fontless.options.providers.custom = createCustomProvider(options.fontless.customProvider)
|
|
@@ -282,27 +312,52 @@ const plugin = async (options = {}) => {
|
|
|
282
312
|
}, userConfig.build.rolldownOptions ?? {})
|
|
283
313
|
}
|
|
284
314
|
else {
|
|
315
|
+
/**
|
|
316
|
+
* @type {import('rolldown').CodeSplittingGroup[]}
|
|
317
|
+
*/
|
|
318
|
+
let groups = [
|
|
319
|
+
{
|
|
320
|
+
name: 'swup',
|
|
321
|
+
test: /node_modules[\\/]swup(?:[\\/]|$)/,
|
|
322
|
+
priority: 30,
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
name: 'hotwired-stimulus',
|
|
326
|
+
test: /node_modules[\\/]@hotwired[\\/]stimulus(?:[\\/]|$)/,
|
|
327
|
+
priority: 30,
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
name: 'naja',
|
|
331
|
+
test: /node_modules[\\/]naja(?:[\\/]|$)/,
|
|
332
|
+
priority: 30,
|
|
333
|
+
},
|
|
334
|
+
]
|
|
335
|
+
|
|
336
|
+
if (options.experimental) {
|
|
337
|
+
groups = [
|
|
338
|
+
{
|
|
339
|
+
name: 'naja',
|
|
340
|
+
test: /node_modules[\\/]naja(?:[\\/]|$)/,
|
|
341
|
+
priority: 30,
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
name: 'webuum',
|
|
345
|
+
test: id => [
|
|
346
|
+
/node_modules[\\/]webuum(?:[\\/]|$)/,
|
|
347
|
+
/node_modules[\\/]@newlogic-digital[\\/]utils-js(?:[\\/]|$)/,
|
|
348
|
+
/node_modules[\\/]winduum[\\/]src[\\/]supports\.js$/,
|
|
349
|
+
/node_modules[\\/]winduum[\\/]src[\\/]common\.js$/,
|
|
350
|
+
].some(pattern => pattern.test(id)),
|
|
351
|
+
priority: 30,
|
|
352
|
+
},
|
|
353
|
+
]
|
|
354
|
+
}
|
|
355
|
+
|
|
285
356
|
userConfig.build.rolldownOptions = Object.assign({
|
|
286
357
|
input: defaultInput,
|
|
287
358
|
output: {
|
|
288
359
|
codeSplitting: options.codeSplitting ?? {
|
|
289
|
-
groups
|
|
290
|
-
{
|
|
291
|
-
name: 'swup',
|
|
292
|
-
test: /node_modules[\\/]swup(?:[\\/]|$)/,
|
|
293
|
-
priority: 30,
|
|
294
|
-
},
|
|
295
|
-
{
|
|
296
|
-
name: 'hotwired-stimulus',
|
|
297
|
-
test: /node_modules[\\/]@hotwired[\\/]stimulus(?:[\\/]|$)/,
|
|
298
|
-
priority: 30,
|
|
299
|
-
},
|
|
300
|
-
{
|
|
301
|
-
name: 'naja',
|
|
302
|
-
test: /node_modules[\\/]naja(?:[\\/]|$)/,
|
|
303
|
-
priority: 30,
|
|
304
|
-
},
|
|
305
|
-
],
|
|
360
|
+
groups,
|
|
306
361
|
},
|
|
307
362
|
},
|
|
308
363
|
}, userConfig.build.rolldownOptions ?? {})
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newlogic-digital/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.1.
|
|
4
|
+
"version": "4.1.9",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"newlogic-core": "./bin/newlogic-core.js"
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"@stylistic/eslint-plugin": "^5.10",
|
|
23
23
|
"@stylistic/stylelint-config": "^5.0.0",
|
|
24
24
|
"@vituum/vite-plugin-css-inline": "^2.1.0",
|
|
25
|
-
"@vituum/vite-plugin-latte": "^2.0.
|
|
26
|
-
"@vituum/vite-plugin-send": "^2.0
|
|
27
|
-
"browserslist": "^4.28.
|
|
25
|
+
"@vituum/vite-plugin-latte": "^2.0.3",
|
|
26
|
+
"@vituum/vite-plugin-send": "^2.1.0",
|
|
27
|
+
"browserslist": "^4.28.4",
|
|
28
28
|
"browserslist-to-esbuild": "^2.1.1",
|
|
29
29
|
"lightningcss": "^1.32.0",
|
|
30
|
-
"npm-check-updates": "^22.2.
|
|
31
|
-
"oxlint": "^1.
|
|
30
|
+
"npm-check-updates": "^22.2.9",
|
|
31
|
+
"oxlint": "^1.72.0",
|
|
32
32
|
"postcss-custom-properties": "^15.0.1",
|
|
33
33
|
"stylelint-config-standard": "^40.0.0",
|
|
34
34
|
"vituum": "^2.0.2"
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@tailwindcss/vite": "^4.3.
|
|
55
|
-
"@types/node": "^
|
|
54
|
+
"@tailwindcss/vite": "^4.3.2",
|
|
55
|
+
"@types/node": "^26.1",
|
|
56
56
|
"@vituum/vite-plugin-twig": "^2.0.1",
|
|
57
57
|
"fontless": "^0.2.1",
|
|
58
|
-
"rolldown": "^1.1.
|
|
58
|
+
"rolldown": "^1.1.4",
|
|
59
59
|
"typescript": "^6"
|
|
60
60
|
},
|
|
61
61
|
"files": [
|
package/types/index.d.ts
CHANGED
|
@@ -6,10 +6,12 @@ interface Input {
|
|
|
6
6
|
|
|
7
7
|
export interface PluginUserConfig {
|
|
8
8
|
mode?: 'development' | 'production' | 'emails' | string
|
|
9
|
+
experimental?: boolean
|
|
9
10
|
format?: string[]
|
|
10
11
|
input?: Input
|
|
11
12
|
cert?: string
|
|
12
13
|
codeSplitting?: import('rolldown').OutputOptions['codeSplitting']
|
|
14
|
+
preloadRemover?: boolean
|
|
13
15
|
vituum?: import('vituum').UserConfig
|
|
14
16
|
css?: import('vite').CSSOptions
|
|
15
17
|
cssInline?: import('@vituum/vite-plugin-css-inline').PluginUserConfig
|