@lls/vitescripts 2.0.1 → 2.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lls/vitescripts",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "lls vite plugins",
5
5
  "main": "src/index.mjs",
6
6
  "files": [
@@ -12,7 +12,7 @@ const execP = promisify(exec)
12
12
  * @returns config() method that copies assets
13
13
  * transform() method that replaces assets path to be resolved
14
14
  */
15
- const llsAssetsPlugin = (llsRepos, publicDir = 'ladleassets') => {
15
+ const llsAssetsPlugin = (llsRepos, publicDir = 'ladleassets', { stripRoot = true } = {}) => {
16
16
  const publicAssetDir = path.join(publicDir, 'assets')
17
17
  const fileExists = (s) => new Promise(resolve => fs.access(s, e => resolve(!e)))
18
18
  const srcRoot = process.cwd() + '/src'
@@ -34,7 +34,7 @@ const llsAssetsPlugin = (llsRepos, publicDir = 'ladleassets') => {
34
34
  await execP(`cp -rf ${repo} ${publicAssetDir}`)
35
35
  }
36
36
  },
37
- transform(src, id) {
37
+ ...(stripRoot && {transform(src, id) {
38
38
  if (
39
39
  llsRepos.some(repo => id.includes(repo)) ||
40
40
  id.startsWith(srcRoot) ||
@@ -48,7 +48,7 @@ const llsAssetsPlugin = (llsRepos, publicDir = 'ladleassets') => {
48
48
  map: null
49
49
  }
50
50
  }
51
- }
51
+ }})
52
52
  }
53
53
  }
54
54