Skip to content

Commit a649587

Browse files
authored
fix(nuxt): fix the error when starting the nuxt project (#2668)
1 parent 5156191 commit a649587

File tree

11 files changed

+65
-89
lines changed

11 files changed

+65
-89
lines changed

examples/nuxt/playground/nuxt.config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import virtualTemplatePlugin from '@opentiny-internal/unplugin-virtual-template/
88

99
export default defineNuxtConfig({
1010
compatibilityDate: '2024-04-03',
11-
devtools: { enabled: false },
11+
devtools: { enabled: true },
1212
// modules: ['../src/module'],
1313
vite: {
1414
plugins: [
@@ -34,7 +34,6 @@ export default defineNuxtConfig({
3434
alias: {
3535
'vue': path.resolve('node_modules/vue/dist/vue.esm-bundler.js'),
3636
'vue-i18n': 'vue-i18n/dist/vue-i18n.cjs.js',
37-
'@': pathFromWorkspaceRoot('examples/docs/newsrc'),
3837
'@opentiny/vue-renderless/types': pathFromWorkspaceRoot('packages/renderless/types'),
3938
'@tiptap/vue': '@tiptap/vue-3',
4039
...getAlias(3, '')

examples/nuxt/playground/public/robots.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
},
3333
"scripts": {
3434
"preinstall": "npx only-allow pnpm",
35-
"postinstall": "pnpm build:internals",
35+
"postinstall": "pnpm build:internals && pnpm build:utils",
3636
"prepare": "husky install",
3737
"bootstrap": "pnpm --filter=\"!./packages/dist/**\" install",
3838
"dev": "pnpm build:entry && pnpm -C examples/vue3 dev",
@@ -266,4 +266,4 @@
266266
"> 1%",
267267
"last 2 versions"
268268
]
269-
}
269+
}

packages/mobile/utils/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
"version": "3.20.0",
55
"sideEffects": false,
66
"main": "index.ts",
7+
"dependencies": {
8+
"xss": "1.0.14"
9+
},
710
"scripts": {
811
"build": "pnpm -w build:ui",
912
"postversion": "pnpm build"
1013
}
11-
}
14+
}

packages/renderless/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,10 @@
3737
},
3838
"dependencies": {
3939
"color": "4.2.3",
40-
"xss": "1.0.11",
4140
"@opentiny/utils": "workspace:~"
4241
},
4342
"devDependencies": {
4443
"esno": "^4.7.0",
4544
"tsup": "7.2.0"
4645
}
47-
}
46+
}

packages/utils/package.json

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,46 +8,21 @@
88
"type": "git",
99
"url": "git@github.com:opentiny/tiny-vue.git"
1010
},
11-
"main": "dist/opentiny-utils.esm.js",
12-
"module": "./src/index.ts",
13-
"publishConfig": {
14-
"module": "dist/opentiny-utils.esm.js"
15-
},
11+
"main": "dist/opentiny-utils.es.js",
12+
"types": "dist/index.d.ts",
1613
"files": [
1714
"dist"
1815
],
1916
"scripts": {
20-
"dev": "rollup -w -c",
21-
"build:dev": "rollup -c rollup.config.js",
22-
"build:esm": "rollup -c rollup.config.js --environment TARGET:es",
23-
"build:cjs": "rollup -c rollup.config.js --environment TARGET:cjs",
24-
"build:umd": "rollup -c rollup.config.js --environment TARGET:umd",
25-
"build:prod": "rollup -c rollup.config.js --environment BABEL_ENV:production",
26-
"build": "rimraf dist && npm run build:dev && npm run build:esm && npm run build:cjs && npm run build:umd && npm run build:prod",
27-
"release": "node scripts/release.js",
28-
"lint": "eslint src/**/*{.js,.ts,.json} --fix",
17+
"build": "vite build",
2918
"pub": "pnpm publish --no-git-checks --access=public"
3019
},
3120
"dependencies": {
3221
"xss": "1.0.14"
3322
},
3423
"devDependencies": {
35-
"@babel/core": "^7.17.10",
36-
"@babel/preset-env": "^7.17.10",
37-
"@rollup/plugin-json": "^4.1.0",
38-
"@rollup/plugin-node-resolve": "^13.3.0",
39-
"@types/node": "^17.0.41",
40-
"@typescript-eslint/eslint-plugin": "^5.23.0",
41-
"@typescript-eslint/parser": "^5.23.0",
42-
"babel-plugin-transform-remove-console": "^6.9.4",
43-
"eslint": "^8.15.0",
44-
"gulp": "^4.0.2",
45-
"rollup": "^2.72.1",
46-
"rollup-plugin-babel": "^4.4.0",
47-
"rollup-plugin-cleandir": "^2.0.0",
48-
"rollup-plugin-typescript2": "^0.31.2",
49-
"rollup-plugin-uglify": "^6.0.4",
50-
"tslib": "2.1.0",
51-
"typescript": "^4.6.4"
24+
"typescript": "^5.2.2",
25+
"vite-plugin-dts": "~4.3.0",
26+
"vite": "^6.0.0"
5227
}
53-
}
28+
}

packages/utils/rollup.config.js

Lines changed: 0 additions & 30 deletions
This file was deleted.

packages/utils/src/crypt/core.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,14 @@ if (crypto) {
4646
}
4747

4848
export class Base {
49+
// @ts-ignore
4950
static create(...args) {
51+
// @ts-ignore
5052
return new this(...args)
5153
}
5254

5355
clone() {
56+
// @ts-ignore
5457
const clone = new this.constructor()
5558
Object.assign(clone, this)
5659
return clone
@@ -277,6 +280,7 @@ export class BufferedBlockAlgorithm extends Base {
277280

278281
if (mWordsReady) {
279282
for (let offset = 0; offset < mWordsReady; offset += blockSize) {
283+
// @ts-ignore
280284
this._doProcessBlock(dataWords, offset)
281285
}
282286

@@ -321,7 +325,7 @@ export class Hasher extends BufferedBlockAlgorithm {
321325

322326
reset() {
323327
super.reset.call(this)
324-
328+
// @ts-ignore
325329
this._doReset()
326330
}
327331

@@ -330,6 +334,7 @@ export class Hasher extends BufferedBlockAlgorithm {
330334
this._append(messageUpdate)
331335
}
332336

337+
// @ts-ignore
333338
const hash = this._doFinalize()
334339

335340
return hash

packages/utils/tsconfig.json

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
{
22
"compilerOptions": {
3-
"target": "ES5",
4-
"module": "ES6",
5-
"declaration": true,
6-
"outDir": "./dist",
7-
"strict": true,
8-
"alwaysStrict": true,
9-
"strictNullChecks": true,
10-
"esModuleInterop": true,
11-
"pretty": true,
12-
"allowJs": true,
13-
"checkJs": true,
14-
"removeComments": true,
3+
"target": "ES2020",
4+
"useDefineForClassFields": true,
5+
"module": "ESNext",
6+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
7+
"skipLibCheck": true,
8+
9+
/* Bundler mode */
10+
"moduleResolution": "bundler",
11+
"allowImportingTsExtensions": true,
12+
"resolveJsonModule": true,
13+
"isolatedModules": true,
1514
"noEmit": true,
16-
"noEmitOnError": true,
17-
"noImplicitAny": true,
18-
"lib": ["ESNext", "DOM"],
19-
"moduleResolution": "node"
15+
"jsx": "preserve",
16+
17+
/* Linting */
18+
"strict": true,
19+
"noUnusedLocals": true,
20+
"noUnusedParameters": true,
21+
"noFallthroughCasesInSwitch": true
2022
},
21-
"include": ["src/**/*"],
22-
"exclude": ["node_modules"]
23+
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"],
24+
"references": [{ "path": "./tsconfig.node.json" }]
2325
}

packages/utils/tsconfig.node.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"compilerOptions": {
3+
"composite": true,
4+
"skipLibCheck": true,
5+
"module": "ESNext",
6+
"moduleResolution": "bundler",
7+
"allowSyntheticDefaultImports": true
8+
},
9+
"include": ["vite.config.ts"]
10+
}

packages/utils/vite.config.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { defineConfig } from 'vite'
2+
import dts from 'vite-plugin-dts'
3+
4+
// https://vitejs.dev/config/
5+
export default defineConfig({
6+
plugins: [dts()],
7+
build: {
8+
lib: {
9+
entry: ['src/index.ts'],
10+
formats: ['es'],
11+
fileName: (format) => `opentiny-utils.${format}.js`
12+
}
13+
}
14+
})

0 commit comments

Comments
 (0)