-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support browser option for bundle (#657)
- Loading branch information
Showing
17 changed files
with
153 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@ice/pkg': minor | ||
--- | ||
|
||
feat: support `browser` option for bundle mode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "@ice/pkg-tests-fixtures-bundle-browser", | ||
"version": "0.0.0", | ||
"private": true, | ||
"dependencies": { | ||
"@ice/pkg": "workspace:*", | ||
"@ice/pkg-tests-fixtures-mock-entry-package": "workspace:*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import { id } from '@ice/pkg-tests-fixtures-mock-entry-package' | ||
console.log(id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const id = 'browser' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export declare const id: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const id = 'main' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const id = 'module' |
12 changes: 12 additions & 0 deletions
12
packages/pkg/tests/fixtures/mock-entry-package/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "@ice/pkg-tests-fixtures-mock-entry-package", | ||
"version": "0.0.0", | ||
"private": true, | ||
"main": "./main.js", | ||
"module": "./module.js", | ||
"browser": "./browser.js", | ||
"types": "./index.d.ts", | ||
"description": "模块入口测试", | ||
"dependencies": { | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
packages/pkg/tests/projects/__snapshots__/bundle-browser.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Vitest Snapshot v1 | ||
|
||
exports[`Run config default > cjs structure 1`] = `null`; | ||
|
||
exports[`Run config default > dist structure 1`] = ` | ||
{ | ||
"files": [ | ||
{ | ||
"name": "index.cjs.es5.production.js", | ||
}, | ||
{ | ||
"name": "index.esm.es5.production.js", | ||
}, | ||
], | ||
"name": "dist", | ||
} | ||
`; | ||
|
||
exports[`Run config default > es2017 structure 1`] = `null`; | ||
|
||
exports[`Run config default > esm structure 1`] = `null`; | ||
|
||
exports[`Run config default > file content dist/index.cjs.es5.production.js 1`] = ` | ||
"\\"use strict\\";console.log(\\"module\\"); | ||
" | ||
`; | ||
|
||
exports[`Run config default > file content dist/index.esm.es5.production.js 1`] = ` | ||
"console.log(\\"module\\"); | ||
" | ||
`; | ||
|
||
exports[`Run config enable-browser > cjs structure 1`] = `null`; | ||
|
||
exports[`Run config enable-browser > dist structure 1`] = ` | ||
{ | ||
"files": [ | ||
{ | ||
"name": "index.cjs.es5.production.js", | ||
}, | ||
{ | ||
"name": "index.esm.es5.production.js", | ||
}, | ||
], | ||
"name": "dist", | ||
} | ||
`; | ||
|
||
exports[`Run config enable-browser > es2017 structure 1`] = `null`; | ||
|
||
exports[`Run config enable-browser > esm structure 1`] = `null`; | ||
|
||
exports[`Run config enable-browser > file content dist/index.cjs.es5.production.js 1`] = ` | ||
"\\"use strict\\";console.log(\\"browser\\"); | ||
" | ||
`; | ||
|
||
exports[`Run config enable-browser > file content dist/index.esm.es5.production.js 1`] = ` | ||
"console.log(\\"browser\\"); | ||
" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { runProjectTest } from "./helper"; | ||
|
||
runProjectTest('bundle-browser', [{ | ||
name: 'default', | ||
config: { | ||
transform: { formats: [] }, | ||
bundle: { | ||
formats: ['esm', 'cjs'] | ||
} | ||
} | ||
}, { | ||
name: 'enable-browser', | ||
config: { | ||
transform: { formats: [] }, | ||
bundle: { | ||
formats: ['esm', 'cjs'], | ||
browser: true | ||
} | ||
} | ||
}]) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters