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

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'
@@ -57,6 +56,7 @@ const defaultOptions = {
57
56
  }
58
57
  },
59
58
  posthtml: {
59
+ enforce: 'pre',
60
60
  root: resolve(process.cwd(), 'src')
61
61
  },
62
62
  juice: {
@@ -80,9 +80,7 @@ const defaultOptions = {
80
80
  }
81
81
  },
82
82
  filters: {
83
- json: async (input, name) => {
84
- return await parseMinifyHtml(input, name)
85
- },
83
+ json: resolve(process.cwd(), 'node_modules/@newlogic-digital/core/latte/JsonFilter.js'),
86
84
  code: 'node_modules/@newlogic-digital/core/latte/CodeFilter.php'
87
85
  },
88
86
  ignoredPaths: ['**/views/email/**/!(*.test).latte', '**/emails/!(*.test).latte']
@@ -126,8 +124,6 @@ const plugin = (options = {}) => {
126
124
  fs.existsSync(join(os.homedir(), `.ssh/${options.cert}-key.pem`))
127
125
 
128
126
  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
127
  './src/styles/*.{css,pcss,scss,sass,less,styl,stylus}',
132
128
  './src/scripts/*.{js,ts,mjs}'
133
129
  ]
@@ -136,14 +132,16 @@ const plugin = (options = {}) => {
136
132
  options.mode = userEnv.mode
137
133
  }
138
134
 
139
- if (userEnv.mode === 'headless') {
140
- userEnv.mode = 'production'
141
-
135
+ if (options.mode === 'development') {
142
136
  defaultInput = [
137
+ './src/views/**/*.{json,latte,twig,liquid,njk,hbs,pug,html}',
138
+ '!./src/views/**/*.{latte,twig,liquid,njk,hbs,pug,html}.json',
143
139
  './src/styles/*.{css,pcss,scss,sass,less,styl,stylus}',
144
140
  './src/scripts/*.{js,ts,mjs}'
145
141
  ]
146
- } else if (userEnv.mode === 'emails') {
142
+ }
143
+
144
+ if (options.mode === 'emails') {
147
145
  userEnv.mode = 'production'
148
146
 
149
147
  defaultInput = [
@@ -152,12 +150,18 @@ const plugin = (options = {}) => {
152
150
  ]
153
151
  }
154
152
 
153
+ const outDir = resolve(userConfig.root ?? process.cwd(), 'public')
154
+
155
+ if (userConfig.build && !userConfig.build.outDir) {
156
+ userConfig.build.outDir = outDir
157
+ }
158
+
155
159
  userConfig.build = Object.assign({
156
160
  manifest: true,
157
161
  emptyOutDir: false,
158
162
  modulePreload: false,
159
163
  assetsInlineLimit: 0,
160
- outDir: resolve(userConfig.root ?? process.cwd(), 'public'),
164
+ outDir,
161
165
  rollupOptions: {
162
166
  input: defaultInput
163
167
  }
@@ -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.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",
@@ -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.1",
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.1",
18
+ "@vituum/vite-plugin-tailwindcss": "^1.0.0-beta.1",
19
+ "@vituum/vite-plugin-send": "^1.0.0-beta.1",
20
+ "vituum": "^1.0.0-beta.3",
21
21
  "posthtml": "^0.16.6",
22
22
  "posthtml-prism": "^2.0.0",
23
23
  "prismjs": "^1.29.0",
@@ -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
+ }