Skip to content

Commit

Permalink
Merge pull request #76 from vite-plugin/v1.6.0
Browse files Browse the repository at this point in the history
V1.6.0
  • Loading branch information
yejimeiming authored Sep 16, 2024
2 parents a7b22c9 + 93b0957 commit d419182
Show file tree
Hide file tree
Showing 5 changed files with 1,036 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@ dist

package-lock.json
pnpm-lock.yaml
yarn.lock
# yarn.lock

/types
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## [2024-09-16] v1.6.0

- 51c5eb2 chore: bump deps
- 5654c85 feat(1.6.0): support glob tail with `/index` for vite-plugin-commonjs#49
- a7b22c9 refactor: hasDynamicImport comment import issue (#75)
- 9d5ce7d Merge pull request #63 from Lee-Si-Yoon/patch-1
- d56ac2d fix typo
- a32caad add License #61

## [2023-07-06] v1.5.0

- c7c380c feat: generate sourcemap #57, closes [#57](https://github.com/vite-plugin/vite-plugin-dynamic-import/issues/57)
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vite-plugin-dynamic-import",
"version": "1.5.0",
"version": "1.6.0",
"description": "Enhance Vite builtin dynamic import",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand All @@ -26,19 +26,19 @@
"prepublishOnly": "npm run build && npm run test"
},
"dependencies": {
"acorn": "^8.8.2",
"es-module-lexer": "^1.2.1",
"fast-glob": "^3.2.12",
"magic-string": "^0.30.1"
"acorn": "^8.12.1",
"es-module-lexer": "^1.5.4",
"fast-glob": "^3.3.2",
"magic-string": "^0.30.11"
},
"devDependencies": {
"@ant-design/icons-svg": "^4.2.1",
"@types/node": "^18.11.18",
"node-fetch": "^3.3.0",
"typescript": "^4.9.4",
"vite": "^4.3.2",
"@ant-design/icons-svg": "^4.4.2",
"@types/node": "^22.5.5",
"node-fetch": "^3.3.2",
"typescript": "^5.6.2",
"vite": "^5.4.5",
"vite-plugin-utils": "^0.4.3",
"vitest": "^0.30.1"
"vitest": "^2.1.1"
},
"keywords": [
"vite",
Expand Down
19 changes: 13 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,20 +351,27 @@ async function globFiles({
return
}

const globs = [].concat(loose ? toLooseGlob(glob) as any : glob)
.map((g: any) => {
const globs = ([] as string[]).concat(loose ? toLooseGlob(glob) : glob)
.map((g) => {
g.includes(PAHT_FILL) && (g = g.replace(PAHT_FILL, ''))
g.endsWith(EXT_FILL) && (g = g.replace(EXT_FILL, ''))
return g
})
const fileGlobs = globs
.map(g => path.extname(g)
? g
.map(g => {
if (path.extname(g)) {
return g
}

// TODO: /jpe?g/ -> [jpg, jpeg]
const ext = `.{${extensions.map(e => e.replace(/^\./, '')).join(',')}}`

// If not ext is not specified, fill necessary extensions
// e.g.
// `./foo/*` -> `./foo/*.{js,ts,vue,...}`
: g + `.{${extensions.map(e => e.replace(/^\./, '')).join(',')}}`
)
// `./foo/*` -> `./foo/*/index.{js,ts,vue,...}`
return [g + ext, `${g}/index${ext}`]
}).flat()

files = fastGlob
.sync(fileGlobs, { cwd: /* 🚧-① */path.dirname(importer) })
Expand Down
Loading

0 comments on commit d419182

Please sign in to comment.