@vituum/vite-plugin-latte 0.1.8 → 0.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.
Files changed (3) hide show
  1. package/handler.js +1 -1
  2. package/index.js +9 -7
  3. package/package.json +1 -1
package/handler.js CHANGED
@@ -6,4 +6,4 @@ const name = params[0]
6
6
 
7
7
  params.shift()
8
8
 
9
- vite.plugins.filter(({ name }) => name === 'vite-plugin-latte')[0]._params.filters[name](...params)
9
+ vite.plugins.filter(({ name }) => name === '@vituum/vite-plugin-latte')[0]._params.filters[name](...params)
package/index.js CHANGED
@@ -13,7 +13,11 @@ const defaultParams = {
13
13
  tags: {},
14
14
  globals: {},
15
15
  data: '',
16
- isStringFilter: undefined
16
+ isStringFilter: undefined,
17
+ filetypes: {
18
+ html: /.(json.html|latte.json.html|latte.html)$/,
19
+ json: /.(json.latte.html)$/
20
+ }
17
21
  }
18
22
 
19
23
  const execSync = (cmd) => {
@@ -78,7 +82,7 @@ const latte = (params = {}) => {
78
82
 
79
83
  return {
80
84
  _params: params,
81
- name: 'vite-plugin-latte',
85
+ name: '@vituum/vite-plugin-latte',
82
86
  config: ({ root }) => {
83
87
  params.root = root
84
88
  },
@@ -86,10 +90,8 @@ const latte = (params = {}) => {
86
90
  enforce: 'pre',
87
91
  async transform(content, { path, filename, server }) {
88
92
  if (
89
- !path.endsWith('.json.html') &&
90
- !path.endsWith('.latte.html') &&
91
- !path.endsWith('.json') &&
92
- !path.endsWith('.latte') &&
93
+ !params.filetypes.html.test(path) &&
94
+ !params.filetypes.json.test(path) &&
93
95
  !content.startsWith('<script type="application/json"')
94
96
  ) {
95
97
  return content
@@ -117,7 +119,7 @@ const latte = (params = {}) => {
117
119
  type: 'error',
118
120
  err: {
119
121
  message: renderLatte.output,
120
- plugin: 'vite-plugin-latte'
122
+ plugin: '@vituum/vite-plugin-latte'
121
123
  }
122
124
  })
123
125
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vituum/vite-plugin-latte",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "scripts": {