-
Notifications
You must be signed in to change notification settings - Fork 0
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
19 changed files
with
856 additions
and
0 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,41 @@ | ||
# Logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
|
||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
dist/ | ||
deploy_versions/ | ||
.temp/ | ||
.rn_temp/ | ||
.DS_Store | ||
.swc | ||
.yalc | ||
yalc.lock |
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 @@ | ||
registry=https://registry.npmjs.org/ |
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 @@ | ||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
}; |
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,63 @@ | ||
{ | ||
"name": "tarojs-plugin-solid", | ||
"version": "0.0.1", | ||
"description": "taro插件,支持使用 Solid 开发小程序", | ||
"main": "lib/index.js", | ||
"files": [ | ||
"lib" | ||
], | ||
"scripts": { | ||
"build": "rollup -c --bundleConfigAsCjs", | ||
"test": "jest" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/phy-lei/tarojs-plugin-solid" | ||
}, | ||
"keywords": [ | ||
"taro", | ||
"taro3", | ||
"tarojs", | ||
"solid", | ||
"solidjs" | ||
], | ||
"author": "phy-lei", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/phy-lei/tarojs-plugin-solid/issues" | ||
}, | ||
"homepage": "https://github.com/phy-lei/tarojs-plugin-solid#readme", | ||
"peerDependencies": { | ||
"@tarojs/runtime": ">=3.0.0", | ||
"@tarojs/service": ">=3.0.0", | ||
"@tarojs/shared": ">=3.0.0", | ||
"@tarojs/webpack5-runner": ">=3.0.0", | ||
"solid-js": ">=1" | ||
}, | ||
"publishConfig": { | ||
"registry": "https://registry.npmjs.org/", | ||
"access": "public" | ||
}, | ||
"volta": { | ||
"node": "18.17.1", | ||
"npm": "9.6.7" | ||
}, | ||
"dependencies": { | ||
"solid-js": "^1.8.11" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^25.0.7", | ||
"@rollup/plugin-node-resolve": "^15.2.3", | ||
"@tarojs/runtime": "^3.6.22", | ||
"@tarojs/service": "^3.6.22", | ||
"@tarojs/shared": "^3.6.22", | ||
"@tarojs/webpack5-runner": "^3.6.22", | ||
"@types/jest": "^29.5.11", | ||
"jest": "^29.7.0", | ||
"rollup": "^4.9.5", | ||
"rollup-plugin-node-externals": "^6.1.2", | ||
"rollup-plugin-ts": "^3.4.5", | ||
"ts-jest": "^29.1.1", | ||
"typescript": "^5.3.3" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import * as path from 'path'; | ||
import { nodeResolve } from '@rollup/plugin-node-resolve'; | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import { externals } from 'rollup-plugin-node-externals'; | ||
import ts from 'rollup-plugin-ts'; | ||
|
||
const base = { | ||
plugins: [ | ||
commonjs(), | ||
nodeResolve(), | ||
externals({ | ||
include: [ | ||
'@tarojs/runtime', | ||
'@tarojs/service', | ||
'@tarojs/shared', | ||
'@tarojs/webpack5-runner', | ||
], | ||
}), | ||
ts(), | ||
], | ||
}; | ||
|
||
// 供 CLI 编译时使用的 Taro 插件入口 | ||
const compileConfig = { | ||
input: path.join(__dirname, 'src/index.ts'), | ||
output: { | ||
file: path.join(__dirname, 'dist/index.js'), | ||
format: 'cjs', | ||
sourcemap: true, | ||
exports: 'named', | ||
}, | ||
...base, | ||
}; | ||
|
||
// 供 Loader 使用的运行时入口 | ||
const runtimeConfig = { | ||
input: path.join(__dirname, 'src/runtime/index.ts'), | ||
output: { | ||
file: path.join(__dirname, 'dist/runtime.js'), | ||
format: 'es', | ||
sourcemap: true, | ||
}, | ||
...base, | ||
}; | ||
|
||
// Solid Loader | ||
const loaderConfig = { | ||
input: path.join(__dirname, 'src/api-loader.ts'), | ||
output: { | ||
file: path.join(__dirname, 'dist/api-loader.js'), | ||
format: 'cjs', | ||
sourcemap: true, | ||
exports: 'auto', | ||
}, | ||
...base, | ||
}; | ||
|
||
export default [compileConfig, runtimeConfig, loaderConfig]; |
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,76 @@ | ||
export default function (str: string) { | ||
return `import { | ||
useAddToFavorites, | ||
useDidHide, | ||
useDidShow, | ||
useError, | ||
useLaunch, | ||
useLoad, | ||
useOptionMenuClick, | ||
usePageNotFound, | ||
usePageScroll, | ||
usePullDownRefresh, | ||
usePullIntercept, | ||
useReachBottom, | ||
useReady, | ||
useResize, | ||
useRouter, | ||
useSaveExitState, | ||
useShareAppMessage, | ||
useShareTimeline, | ||
useTabItemTap, | ||
useTitleClick, | ||
useScope, | ||
useUnload | ||
} from 'tarojs-plugin-solid/dist/runtime' | ||
${str} | ||
taro.useAddToFavorites = useAddToFavorites | ||
taro.useDidHide = useDidHide | ||
taro.useDidShow = useDidShow | ||
taro.useError = useError | ||
taro.useLaunch = useLaunch | ||
taro.useLoad = useLoad | ||
taro.useOptionMenuClick = useOptionMenuClick | ||
taro.usePageNotFound = usePageNotFound | ||
taro.usePageScroll = usePageScroll | ||
taro.usePullDownRefresh = usePullDownRefresh | ||
taro.usePullIntercept = usePullIntercept | ||
taro.useReachBottom = useReachBottom | ||
taro.useReady = useReady | ||
taro.useResize = useResize | ||
taro.useRouter = useRouter | ||
taro.useSaveExitState = useSaveExitState | ||
taro.useShareAppMessage = useShareAppMessage | ||
taro.useShareTimeline = useShareTimeline | ||
taro.useTabItemTap = useTabItemTap | ||
taro.useTitleClick = useTitleClick | ||
taro.useScope = useScope | ||
taro.useUnload = useUnload | ||
export { | ||
useAddToFavorites, | ||
useDidHide, | ||
useDidShow, | ||
useError, | ||
useLaunch, | ||
useLoad, | ||
useOptionMenuClick, | ||
usePageNotFound, | ||
usePageScroll, | ||
usePullDownRefresh, | ||
usePullIntercept, | ||
useReachBottom, | ||
useReady, | ||
useResize, | ||
useRouter, | ||
useSaveExitState, | ||
useShareAppMessage, | ||
useShareTimeline, | ||
useTabItemTap, | ||
useTitleClick, | ||
useScope, | ||
useUnload | ||
} | ||
` | ||
} |
Oops, something went wrong.