refactor(plugin-cli): use @plugxjs/vite-plugin (#4501)
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
"tsconfig.json"
|
"tsconfig.json"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@endo/static-module-record": "^0.8.2",
|
"@plugxjs/vite-plugin": "0.0.2",
|
||||||
"@swc/core": "^1.3.81",
|
"@swc/core": "^1.3.81",
|
||||||
"@toeverything/infra": "workspace:^",
|
"@toeverything/infra": "workspace:^",
|
||||||
"@vanilla-extract/rollup-plugin": "^1.3.0",
|
"@vanilla-extract/rollup-plugin": "^1.3.0",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import path from 'node:path';
|
|||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { parseArgs } from 'node:util';
|
import { parseArgs } from 'node:util';
|
||||||
|
|
||||||
import { StaticModuleRecord } from '@endo/static-module-record';
|
import plugx from '@plugxjs/vite-plugin';
|
||||||
import {
|
import {
|
||||||
packageJsonInputSchema,
|
packageJsonInputSchema,
|
||||||
packageJsonOutputSchema,
|
packageJsonOutputSchema,
|
||||||
@@ -185,38 +185,9 @@ await build({
|
|||||||
vanillaExtractPlugin(),
|
vanillaExtractPlugin(),
|
||||||
vue(),
|
vue(),
|
||||||
react(),
|
react(),
|
||||||
{
|
plugx({
|
||||||
name: 'parse-bundle',
|
staticJsonSuffix: '.json',
|
||||||
renderChunk(code, chunk) {
|
}),
|
||||||
if (chunk.fileName.endsWith('js')) {
|
|
||||||
const record = new StaticModuleRecord(code, chunk.fileName);
|
|
||||||
const reexports = record.__reexportMap__ as Record<
|
|
||||||
string,
|
|
||||||
[localName: string, exportedName: string][]
|
|
||||||
>;
|
|
||||||
const exports = Object.assign(
|
|
||||||
{},
|
|
||||||
record.__fixedExportMap__,
|
|
||||||
record.__liveExportMap__
|
|
||||||
);
|
|
||||||
this.emitFile({
|
|
||||||
type: 'asset',
|
|
||||||
fileName: `${chunk.fileName}.json`,
|
|
||||||
source: JSON.stringify(
|
|
||||||
{
|
|
||||||
exports: exports,
|
|
||||||
imports: record.imports,
|
|
||||||
reexports: reexports,
|
|
||||||
},
|
|
||||||
null,
|
|
||||||
2
|
|
||||||
),
|
|
||||||
});
|
|
||||||
return record.__syncModuleProgram__;
|
|
||||||
}
|
|
||||||
return code;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
generatePackageJson,
|
generatePackageJson,
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"composite": true,
|
"composite": true,
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"moduleResolution": "Node",
|
"moduleResolution": "bundler",
|
||||||
"outDir": "lib"
|
"outDir": "lib"
|
||||||
},
|
},
|
||||||
"include": ["src"],
|
"include": ["src"],
|
||||||
|
|||||||
11
yarn.lock
11
yarn.lock
@@ -623,7 +623,7 @@ __metadata:
|
|||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "@affine/plugin-cli@workspace:packages/plugin-cli"
|
resolution: "@affine/plugin-cli@workspace:packages/plugin-cli"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@endo/static-module-record": ^0.8.2
|
"@plugxjs/vite-plugin": 0.0.2
|
||||||
"@swc/core": ^1.3.81
|
"@swc/core": ^1.3.81
|
||||||
"@toeverything/infra": "workspace:^"
|
"@toeverything/infra": "workspace:^"
|
||||||
"@vanilla-extract/rollup-plugin": ^1.3.0
|
"@vanilla-extract/rollup-plugin": ^1.3.0
|
||||||
@@ -8757,6 +8757,15 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"@plugxjs/vite-plugin@npm:0.0.2":
|
||||||
|
version: 0.0.2
|
||||||
|
resolution: "@plugxjs/vite-plugin@npm:0.0.2"
|
||||||
|
dependencies:
|
||||||
|
"@endo/static-module-record": ^0.8.2
|
||||||
|
checksum: 12add55abfca3b29d0a709dd852ec69f335013b78bf06d4b27e9851d9c8ade097ac875f8d509ac5915abe74f9b457c89fa17587dc1bd534e11d76846ba643717
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"@pmmmwh/react-refresh-webpack-plugin@npm:^0.5.11":
|
"@pmmmwh/react-refresh-webpack-plugin@npm:^0.5.11":
|
||||||
version: 0.5.11
|
version: 0.5.11
|
||||||
resolution: "@pmmmwh/react-refresh-webpack-plugin@npm:0.5.11"
|
resolution: "@pmmmwh/react-refresh-webpack-plugin@npm:0.5.11"
|
||||||
|
|||||||
Reference in New Issue
Block a user