-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
233 additions
and
40 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,46 @@ | ||
# Modern.js Module tests coverage | ||
|
||
Rslib will try to cover the common scenarios in the [integration test cases of Modern.js Module](https://github.com/web-infra-dev/modern.js/tree/main/tests/integration/module). This document is used to record the coverage situation. The supported types are divided into three types: "fully supported", "not supported, but planned to support" and "not supported, not planned to support". | ||
|
||
## build | ||
|
||
| Supported | Will support | Will not support | | ||
| --------- | ------------ | ---------------- | | ||
| 🟢 | 🟡 | ⚪️ | | ||
|
||
| Feature | Status | Note | | ||
| --------------- | ------ | ---- | | ||
| alias | 🟢 | | | ||
| asset | 🟡 | | | ||
| autoExtension | 🟡 | | | ||
| autoExternal | 🟡 | | | ||
| banner-footer | 🟡 | | | ||
| buildType | 🟡 | | | ||
| copy | 🟡 | | | ||
| decorator | 🟡 | | | ||
| define | 🟢 | | | ||
| dts | 🟡 | | | ||
| dts-composite | 🟡 | | | ||
| esbuildOptions | 🟡 | | | ||
| externals | 🟡 | | | ||
| format | 🟡 | | | ||
| input | 🟡 | | | ||
| jsx | 🟡 | | | ||
| metafile | 🟡 | | | ||
| minify | 🟡 | | | ||
| platform | 🟡 | | | ||
| redirect | 🟡 | | | ||
| resolve | 🟡 | | | ||
| shims | 🟡 | | | ||
| sideEffects | 🟡 | | | ||
| sourceDir | 🟡 | | | ||
| sourceMap | 🟡 | | | ||
| splitting | 🟡 | | | ||
| style | 🟡 | | | ||
| target | 🟡 | | | ||
| transformImport | 🟡 | | | ||
| transformLodash | 🟡 | | | ||
| tsconfig | 🟡 | | | ||
| tsconfigExtends | 🟡 | | | ||
| umdGlobals | 🟡 | | | ||
| umdModuleName | 🟡 | | |
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,96 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`alias in ts 1`] = ` | ||
"var __webpack_exports__ = {}; | ||
;// CONCATENATED MODULE: ./e2e/cases/alias/ts/src/a.ts | ||
const a = 'hello world'; | ||
;// CONCATENATED MODULE: ./e2e/cases/alias/ts/src/index.ts | ||
console.info(a); | ||
export { a }; | ||
" | ||
`; | ||
|
||
exports[`alias in ts 2`] = ` | ||
"(() => { // webpackBootstrap | ||
"use strict"; | ||
var __webpack_modules__ = ({ | ||
"522": (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) { | ||
__webpack_require__.d(__webpack_exports__, { | ||
a: function() { return a; } | ||
}); | ||
const a = 'hello world'; | ||
}), | ||
}); | ||
/************************************************************************/ | ||
// The module cache | ||
var __webpack_module_cache__ = {}; | ||
// The require function | ||
function __webpack_require__(moduleId) { | ||
// Check if module is in cache | ||
var cachedModule = __webpack_module_cache__[moduleId]; | ||
if (cachedModule !== undefined) { | ||
return cachedModule.exports; | ||
} | ||
// Create a new module (and put it into the cache) | ||
var module = (__webpack_module_cache__[moduleId] = { | ||
exports: {} | ||
}); | ||
// Execute the module function | ||
__webpack_modules__[moduleId](module, module.exports, __webpack_require__); | ||
// Return the exports of the module | ||
return module.exports; | ||
} | ||
/************************************************************************/ | ||
// webpack/runtime/define_property_getters | ||
(() => { | ||
__webpack_require__.d = function(exports, definition) { | ||
for(var key in definition) { | ||
if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | ||
Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | ||
} | ||
} | ||
}; | ||
})(); | ||
// webpack/runtime/has_own_property | ||
(() => { | ||
__webpack_require__.o = function (obj, prop) { | ||
return Object.prototype.hasOwnProperty.call(obj, prop); | ||
}; | ||
})(); | ||
// webpack/runtime/make_namespace_object | ||
(() => { | ||
// define __esModule on exports | ||
__webpack_require__.r = function(exports) { | ||
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | ||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
} | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
}; | ||
})(); | ||
/************************************************************************/ | ||
var __webpack_exports__ = {}; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony import */var _src_a__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(522); | ||
console.info(_src_a__WEBPACK_IMPORTED_MODULE_0__.a); | ||
var __webpack_export_target__ = exports; | ||
for(var i in __webpack_exports__) __webpack_export_target__[i] = __webpack_exports__[i]; | ||
if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', { value: true }); | ||
})() | ||
;" | ||
`; |
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,32 @@ | ||
import { execSync } from 'node:child_process'; | ||
import fs from 'node:fs'; | ||
import path from 'node:path'; | ||
import { expect, test } from 'vitest'; | ||
import { globContentJSON } from '#helper'; | ||
|
||
test.todo('build command', async () => {}); | ||
|
||
test('inspect command', async () => { | ||
fs.rmdirSync(path.join(__dirname, 'dist'), { recursive: true }); | ||
Check failure on line 10 in e2e/cases/cli/index.test.ts GitHub Actions / e2e-ubuntu (18.x)e2e/cases/cli/index.test.ts > inspect command
|
||
|
||
delete process.env.NODE_ENV; | ||
execSync('npx rslib inspect', { | ||
cwd: __dirname, | ||
}); | ||
|
||
const files = await globContentJSON(path.join(__dirname, 'dist')); | ||
const fileNames = Object.keys(files); | ||
|
||
const rsbuildConfig = fileNames.find((item) => | ||
item.includes('rsbuild.config.mjs'), | ||
); | ||
|
||
expect(rsbuildConfig).toBeTruthy(); | ||
expect(files[rsbuildConfig!]).toContain("type: 'modern-module'"); | ||
|
||
const rspackConfig = fileNames.find((item) => | ||
item.includes('rspack.config.esm.mjs'), | ||
); | ||
expect(rspackConfig).toBeTruthy(); | ||
expect(files[rspackConfig!]).toContain("type: 'modern-module'"); | ||
}); |
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,6 @@ | ||
import { defineConfig } from '@rslib/core'; | ||
import { generateBundleEsmConfig } from '#shared'; | ||
|
||
export default defineConfig({ | ||
lib: [generateBundleEsmConfig(__dirname)], | ||
}); |
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 |
---|---|---|
|
@@ -37,6 +37,7 @@ | |
"prettier": "^3.3.2", | ||
"prettier-plugin-packagejson": "^2.5.0", | ||
"simple-git-hooks": "^2.11.1", | ||
"typescript": "^5.4.5", | ||
"vitest": "^1.6.0" | ||
}, | ||
"packageManager": "[email protected]", | ||
|
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
Oops, something went wrong.