@newlogic-digital/core 2.0.0-alpha.9 → 2.0.0-beta.2

Sign up to get free protection for your applications and to get access to all the features.
package/index.js CHANGED
@@ -10,7 +10,6 @@ import juice from '@vituum/vite-plugin-juice'
10
10
  import send from '@vituum/vite-plugin-send'
11
11
  import tailwindcss from '@vituum/vite-plugin-tailwindcss'
12
12
  import { getPackageInfo, merge } from 'vituum/utils/common.js'
13
- import parseMinifyHtml from './src/minify.js'
14
13
  import highlight from './src/prism.js'
15
14
  import twigOptions from './src/twig.js'
16
15
  import FastGlob from 'fast-glob'
@@ -80,9 +79,7 @@ const defaultOptions = {
80
79
  }
81
80
  },
82
81
  filters: {
83
- json: async (input, name) => {
84
- return await parseMinifyHtml(input, name)
85
- },
82
+ json: resolve(process.cwd(), 'node_modules/@newlogic-digital/core/latte/JsonFilter.js'),
86
83
  code: 'node_modules/@newlogic-digital/core/latte/CodeFilter.php'
87
84
  },
88
85
  ignoredPaths: ['**/views/email/**/!(*.test).latte', '**/emails/!(*.test).latte']
@@ -126,8 +123,6 @@ const plugin = (options = {}) => {
126
123
  fs.existsSync(join(os.homedir(), `.ssh/${options.cert}-key.pem`))
127
124
 
128
125
  let defaultInput = [
129
- './src/views/**/*.{json,latte,twig,liquid,njk,hbs,pug,html}',
130
- '!./src/views/**/*.{latte,twig,liquid,njk,hbs,pug,html}.json',
131
126
  './src/styles/*.{css,pcss,scss,sass,less,styl,stylus}',
132
127
  './src/scripts/*.{js,ts,mjs}'
133
128
  ]
@@ -136,14 +131,16 @@ const plugin = (options = {}) => {
136
131
  options.mode = userEnv.mode
137
132
  }
138
133
 
139
- if (userEnv.mode === 'headless') {
140
- userEnv.mode = 'production'
141
-
134
+ if (options.mode === 'development') {
142
135
  defaultInput = [
136
+ './src/views/**/*.{json,latte,twig,liquid,njk,hbs,pug,html}',
137
+ '!./src/views/**/*.{latte,twig,liquid,njk,hbs,pug,html}.json',
143
138
  './src/styles/*.{css,pcss,scss,sass,less,styl,stylus}',
144
139
  './src/scripts/*.{js,ts,mjs}'
145
140
  ]
146
- } else if (userEnv.mode === 'emails') {
141
+ }
142
+
143
+ if (options.mode === 'emails') {
147
144
  userEnv.mode = 'production'
148
145
 
149
146
  defaultInput = [
@@ -152,12 +149,18 @@ const plugin = (options = {}) => {
152
149
  ]
153
150
  }
154
151
 
152
+ const outDir = resolve(userConfig.root ?? process.cwd(), 'public')
153
+
154
+ if (userConfig.build && !userConfig.build.outDir) {
155
+ userConfig.build.outDir = outDir
156
+ }
157
+
155
158
  userConfig.build = Object.assign({
156
159
  manifest: true,
157
160
  emptyOutDir: false,
158
161
  modulePreload: false,
159
162
  assetsInlineLimit: 0,
160
- outDir: resolve(userConfig.root ?? process.cwd(), 'public'),
163
+ outDir,
161
164
  rollupOptions: {
162
165
  input: defaultInput
163
166
  }
@@ -0,0 +1,7 @@
1
+ import parseMinifyHtml from '../src/minify.js'
2
+
3
+ const json = async (input, name) => {
4
+ return await parseMinifyHtml(input, name)
5
+ }
6
+
7
+ export default json
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@newlogic-digital/core",
3
3
  "type": "module",
4
- "version": "2.0.0-alpha.9",
4
+ "version": "2.0.0-beta.2",
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",
@@ -11,13 +11,13 @@
11
11
  "eslint": "eslint '**/*.js' --fix"
12
12
  },
13
13
  "dependencies": {
14
- "@vituum/vite-plugin-posthtml": "^1.0.0-alpha.3",
15
- "@vituum/vite-plugin-juice": "^1.0.0-alpha.2",
16
- "@vituum/vite-plugin-latte": "^1.0.0-alpha.8",
17
- "@vituum/vite-plugin-twig": "^1.0.0-alpha.6",
18
- "@vituum/vite-plugin-tailwindcss": "^1.0.0-alpha.2",
19
- "@vituum/vite-plugin-send": "^1.0.0-alpha.2",
20
- "vituum": "^1.0.0-alpha.18",
14
+ "@vituum/vite-plugin-posthtml": "^1.0.0-beta.2",
15
+ "@vituum/vite-plugin-juice": "^1.0.0-beta.1",
16
+ "@vituum/vite-plugin-latte": "^1.0.0-beta.1",
17
+ "@vituum/vite-plugin-twig": "^1.0.0-beta.2",
18
+ "@vituum/vite-plugin-tailwindcss": "^1.0.0-beta.1",
19
+ "@vituum/vite-plugin-send": "^1.0.0-beta.2",
20
+ "vituum": "^1.0.0-beta.7",
21
21
  "posthtml": "^0.16.6",
22
22
  "posthtml-prism": "^2.0.0",
23
23
  "prismjs": "^1.29.0",
@@ -28,7 +28,7 @@
28
28
  "picocolors": "^1.0.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@types/node": "^20.3.1",
31
+ "@types/node": "^20.3.2",
32
32
  "eslint": "^8.43.0",
33
33
  "eslint-config-standard": "^17.1.0",
34
34
  "typescript": "^5.1.3",
@@ -36,9 +36,14 @@
36
36
  },
37
37
  "files": [
38
38
  "latte",
39
+ "types",
39
40
  "index.js",
40
41
  "src"
41
42
  ],
43
+ "exports": {
44
+ ".": "./index.js",
45
+ "./types": "./types/*"
46
+ },
42
47
  "engines": {
43
48
  "node": ">=16.0.0",
44
49
  "npm": ">=8.0.0"
@@ -0,0 +1,18 @@
1
+ interface Emails {
2
+ outputDir?: string
3
+ appDir?: string
4
+ }
5
+
6
+ export interface PluginUserConfig {
7
+ mode?: string
8
+ format?: string[]
9
+ cert?: string
10
+ emails?: Emails
11
+ vituum?: import('vituum/types').UserConfig,
12
+ posthtml?: import('@vituum/vite-plugin-posthtml/types').PluginUserConfig
13
+ juice?: import('@vituum/vite-plugin-juice/types').PluginUserConfig
14
+ send?: import('@vituum/vite-plugin-send/types').PluginUserConfig
15
+ tailwindcss?: import('@vituum/vite-plugin-tailwindcss/types').PluginUserConfig
16
+ latte?: import('@vituum/vite-plugin-latte/types').PluginUserConfig
17
+ twig?: import('@vituum/vite-plugin-twig/types').PluginUserConfig
18
+ }