@vituum/vite-plugin-latte 0.1.16 → 0.1.18
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 +6 -4
- package/package.json +5 -4
package/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import process from 'node:process'
|
|
|
5
5
|
import * as childProcess from 'child_process'
|
|
6
6
|
import FastGlob from 'fast-glob'
|
|
7
7
|
import lodash from 'lodash'
|
|
8
|
+
import { minimatch } from 'minimatch'
|
|
8
9
|
import chalk from 'chalk'
|
|
9
10
|
|
|
10
11
|
const defaultParams = {
|
|
@@ -17,6 +18,7 @@ const defaultParams = {
|
|
|
17
18
|
globals: {},
|
|
18
19
|
data: '',
|
|
19
20
|
isStringFilter: undefined,
|
|
21
|
+
ignoredPaths: [],
|
|
20
22
|
filetypes: {
|
|
21
23
|
html: /.(json.html|latte.json.html|latte.html)$/,
|
|
22
24
|
json: /.(json.latte.html)$/
|
|
@@ -99,7 +101,9 @@ const latte = (params = {}) => {
|
|
|
99
101
|
path = path.replace('?raw', '')
|
|
100
102
|
filename = filename.replace('?raw', '')
|
|
101
103
|
|
|
102
|
-
|
|
104
|
+
if (params.ignoredPaths.filter(ignoredPaths => minimatch(path, ignoredPaths)).length !== 0) {
|
|
105
|
+
return content
|
|
106
|
+
}
|
|
103
107
|
|
|
104
108
|
if (
|
|
105
109
|
!params.filetypes.html.test(path) &&
|
|
@@ -118,11 +122,9 @@ const latte = (params = {}) => {
|
|
|
118
122
|
const renderLatte = renderTemplate(path, params, content)
|
|
119
123
|
const warningLog = renderLatte.output.includes('Warning: Undefined')
|
|
120
124
|
|
|
121
|
-
// console.info(`${chalk.cyan('@vituum/vite-plugin-latte')} ${chalk.green(`finished in ${chalk.grey(new Date() - start + 'ms')}`)}`)
|
|
122
|
-
|
|
123
125
|
if (renderLatte.error || warningLog) {
|
|
124
126
|
if (!server) {
|
|
125
|
-
console.error(renderLatte.output)
|
|
127
|
+
console.error(chalk.red(renderLatte.output))
|
|
126
128
|
return
|
|
127
129
|
}
|
|
128
130
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vituum/vite-plugin-latte",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -11,11 +11,12 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"fast-glob": "^3.2.12",
|
|
13
13
|
"lodash": "^4.17.21",
|
|
14
|
-
"chalk": "^5.2.0"
|
|
14
|
+
"chalk": "^5.2.0",
|
|
15
|
+
"minimatch": "^7.3.0"
|
|
15
16
|
},
|
|
16
17
|
"devDependencies": {
|
|
17
|
-
"vite": "^4.0.
|
|
18
|
-
"eslint": "^8.
|
|
18
|
+
"vite": "^4.0.4",
|
|
19
|
+
"eslint": "^8.33.0",
|
|
19
20
|
"eslint-config-standard": "^17.0.0"
|
|
20
21
|
},
|
|
21
22
|
"files": [
|