@newlogic-digital/core 4.0.0-next.9 → 4.0.0-rc.1
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 +29 -32
- package/package.json +18 -16
- package/types/index.d.ts +6 -3
package/index.js
CHANGED
|
@@ -2,14 +2,14 @@ import fs from 'node:fs'
|
|
|
2
2
|
import os from 'node:os'
|
|
3
3
|
import { resolve, join } from 'node:path'
|
|
4
4
|
import vituum from 'vituum'
|
|
5
|
-
import
|
|
6
|
-
import juice from '@vituum/vite-plugin-juice'
|
|
5
|
+
import cssInline from '@vituum/vite-plugin-css-inline'
|
|
7
6
|
import send from '@vituum/vite-plugin-send'
|
|
8
|
-
import { getPackageInfo,
|
|
7
|
+
import { getPackageInfo, deepMergeWith } from 'vituum/utils/common.js'
|
|
9
8
|
import browserslistToEsbuild from 'browserslist-to-esbuild'
|
|
10
9
|
import browserslist from 'browserslist'
|
|
11
10
|
import { Features as LightningCssFeatures, browserslistToTargets } from 'lightningcss'
|
|
12
11
|
import process from 'node:process'
|
|
12
|
+
import heroicons from '@newlogic-digital/vite-plugin-heroicons'
|
|
13
13
|
|
|
14
14
|
const { name } = getPackageInfo(import.meta.url)
|
|
15
15
|
|
|
@@ -42,16 +42,12 @@ const defaultOptions = {
|
|
|
42
42
|
paths: ['./src/styles/*/**', '!./src/styles/emails/*', './src/scripts/*/**'],
|
|
43
43
|
},
|
|
44
44
|
},
|
|
45
|
-
|
|
45
|
+
cssInline: {
|
|
46
46
|
paths: ['src/pages/email'],
|
|
47
|
-
postcss: {
|
|
48
|
-
globalData: {
|
|
49
|
-
files: ['./src/styles/emails/theme/config.css'],
|
|
50
|
-
},
|
|
51
|
-
},
|
|
47
|
+
postcss: {},
|
|
52
48
|
},
|
|
53
49
|
css: {
|
|
54
|
-
transformer: '
|
|
50
|
+
transformer: 'lightningcss',
|
|
55
51
|
lightningcss: {},
|
|
56
52
|
},
|
|
57
53
|
tailwindcss: {},
|
|
@@ -72,6 +68,7 @@ const defaultOptions = {
|
|
|
72
68
|
code: 'node_modules/@newlogic-digital/core/latte/CodeFilter.php',
|
|
73
69
|
},
|
|
74
70
|
},
|
|
71
|
+
heroicons: {},
|
|
75
72
|
}
|
|
76
73
|
|
|
77
74
|
/**
|
|
@@ -79,53 +76,53 @@ const defaultOptions = {
|
|
|
79
76
|
* @returns [import('vite').Plugin]
|
|
80
77
|
*/
|
|
81
78
|
const plugin = async (options = {}) => {
|
|
82
|
-
options =
|
|
79
|
+
options = deepMergeWith(defaultOptions, options)
|
|
83
80
|
|
|
84
|
-
const
|
|
85
|
-
const tailwindcssPlugin = []
|
|
81
|
+
const optionalPlugins = []
|
|
86
82
|
|
|
87
83
|
if (options.format.includes('twig')) {
|
|
88
84
|
const twig = (await import('@vituum/vite-plugin-twig')).default
|
|
89
85
|
|
|
90
|
-
|
|
86
|
+
optionalPlugins.push(twig(options.twig))
|
|
91
87
|
}
|
|
92
88
|
|
|
93
89
|
if (options.format.includes('latte')) {
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (options.css.transformer === 'postcss') {
|
|
98
|
-
const tailwindcss = (await import('@vituum/vite-plugin-tailwindcss')).default
|
|
90
|
+
const latte = (await import('@vituum/vite-plugin-latte')).default
|
|
99
91
|
|
|
100
|
-
|
|
92
|
+
optionalPlugins.push(latte(options.latte))
|
|
101
93
|
}
|
|
102
94
|
|
|
103
95
|
if (options.css.transformer === 'lightningcss') {
|
|
104
|
-
if (!fs.existsSync(resolve(process.cwd(), 'src/+.css'))) {
|
|
105
|
-
fs.writeFileSync(resolve(process.cwd(), 'src/+.css'), '@import "./styles/main.css";')
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// @ts-ignore
|
|
109
96
|
const tailwindcss = (await import('@tailwindcss/vite')).default
|
|
110
97
|
|
|
111
|
-
|
|
98
|
+
optionalPlugins.push(tailwindcss(options.tailwindcss))
|
|
112
99
|
}
|
|
113
100
|
|
|
114
101
|
const plugins = [
|
|
115
102
|
vituum(options.vituum),
|
|
116
|
-
...
|
|
117
|
-
|
|
118
|
-
juice(options.juice),
|
|
103
|
+
...optionalPlugins,
|
|
104
|
+
cssInline(options.cssInline),
|
|
119
105
|
send(options.send),
|
|
106
|
+
heroicons(
|
|
107
|
+
{
|
|
108
|
+
fileName: 'icons.svg',
|
|
109
|
+
iconSets: {
|
|
110
|
+
'simpleicons-solid': 'src/icons/simpleicons',
|
|
111
|
+
'icons-solid': 'src/icons/solid',
|
|
112
|
+
'icons-outline': 'src/icons/outline',
|
|
113
|
+
},
|
|
114
|
+
...options.heroicons,
|
|
115
|
+
},
|
|
116
|
+
),
|
|
120
117
|
]
|
|
121
118
|
|
|
122
119
|
return [{
|
|
123
120
|
name,
|
|
124
121
|
enforce: 'pre',
|
|
125
122
|
/**
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
123
|
+
* @param {import('vite').UserConfig} userConfig
|
|
124
|
+
* @param {import('vite').ConfigEnv} userEnv
|
|
125
|
+
*/
|
|
129
126
|
config(userConfig, userEnv) {
|
|
130
127
|
// @ts-ignore
|
|
131
128
|
const isHttps = userConfig?.server?.https !== false
|
package/package.json
CHANGED
|
@@ -1,36 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newlogic-digital/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.0-
|
|
4
|
+
"version": "4.0.0-rc.1",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "New Logic Studio s.r.o.",
|
|
7
7
|
"description": "Set of tools that can be used to create modern web applications",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"tsc": "tsc",
|
|
11
|
-
"eslint": "eslint
|
|
11
|
+
"eslint": "eslint --fix",
|
|
12
12
|
"publish-next": "npm publish --tag next"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@minify-html/node": "^0.18.1",
|
|
16
|
-
"@
|
|
17
|
-
"@vituum/vite-plugin-
|
|
18
|
-
"@vituum/vite-plugin-
|
|
16
|
+
"@newlogic-digital/vite-plugin-heroicons": "^1.0.0",
|
|
17
|
+
"@vituum/vite-plugin-css-inline": "^2.0.0",
|
|
18
|
+
"@vituum/vite-plugin-latte": "^2.0.0",
|
|
19
|
+
"@vituum/vite-plugin-send": "^2.0.0",
|
|
19
20
|
"browserslist": "^4.28.1",
|
|
20
21
|
"browserslist-to-esbuild": "^2.1.1",
|
|
21
|
-
"lightningcss": "^1.
|
|
22
|
-
"vituum": "^2.0.0
|
|
22
|
+
"lightningcss": "^1.32.0",
|
|
23
|
+
"vituum": "^2.0.0"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
|
-
"@eslint/js": "^
|
|
26
|
-
"@stylistic/eslint-plugin": "^5.
|
|
27
|
-
"@
|
|
28
|
-
"@
|
|
29
|
-
"@vituum/vite-plugin-twig": "^
|
|
30
|
-
"eslint": "^
|
|
31
|
-
"
|
|
26
|
+
"@eslint/js": "^10.0",
|
|
27
|
+
"@stylistic/eslint-plugin": "^5.10",
|
|
28
|
+
"@tailwindcss/vite": "^4.2.1",
|
|
29
|
+
"@types/node": "^25.5",
|
|
30
|
+
"@vituum/vite-plugin-twig": "^2.0.0",
|
|
31
|
+
"eslint": "^10.0.3",
|
|
32
|
+
"globals": "^17.4.0",
|
|
33
|
+
"rolldown": "^1.0.0-rc.9",
|
|
32
34
|
"typescript": "^5",
|
|
33
|
-
"vite": "^8.0.0
|
|
35
|
+
"vite": "^8.0.0"
|
|
34
36
|
},
|
|
35
37
|
"files": [
|
|
36
38
|
"latte",
|
|
@@ -43,7 +45,7 @@
|
|
|
43
45
|
"./types": "./types/*"
|
|
44
46
|
},
|
|
45
47
|
"engines": {
|
|
46
|
-
"node": "^
|
|
48
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
47
49
|
},
|
|
48
50
|
"repository": {
|
|
49
51
|
"type": "git",
|
package/types/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import {HeroiconsOptions} from "@newlogic-digital/vite-plugin-heroicons";
|
|
2
|
+
|
|
1
3
|
interface Input {
|
|
2
4
|
assets?: string[]
|
|
3
5
|
pages?: string[]
|
|
@@ -12,9 +14,10 @@ export interface PluginUserConfig {
|
|
|
12
14
|
codeSplitting?: import('rolldown').OutputOptions['codeSplitting']
|
|
13
15
|
vituum?: import('vituum').UserConfig,
|
|
14
16
|
css?: import('vite').CSSOptions
|
|
15
|
-
|
|
17
|
+
cssInline?: import('@vituum/vite-plugin-css-inline').PluginUserConfig
|
|
16
18
|
send?: import('@vituum/vite-plugin-send').PluginUserConfig
|
|
17
|
-
tailwindcss?: import('@
|
|
19
|
+
tailwindcss?: import('@tailwindcss/vite').PluginOptions
|
|
18
20
|
latte?: import('@vituum/vite-plugin-latte').PluginUserConfig
|
|
19
21
|
twig?: import('@vituum/vite-plugin-twig').PluginUserConfig
|
|
20
|
-
|
|
22
|
+
heroicons?: import('@newlogic-digital/vite-plugin-heroicons').HeroiconsOptions
|
|
23
|
+
}
|