Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(vue-server-renderer): add TypeScript declarations of webpack plugins (fix #6301) #6325

Merged
merged 2 commits into from
Sep 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion build/release-weex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
cd -

# commit
git add src/entries/weex*
git add packages/weex*
git commit -m "[release] weex-vue-framework@$NEXT_VERSION"
fi
3 changes: 3 additions & 0 deletions packages/vue-server-renderer/client-plugin.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { WebpackPlugin } from './types/plugin';
declare const Plugin: WebpackPlugin;
export = Plugin;
7 changes: 4 additions & 3 deletions packages/vue-server-renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@
"lodash.template": "^4.4.0",
"lodash.uniq": "^4.5.0",
"resolve": "^1.2.0",
"source-map": "0.5.6",
"serialize-javascript": "^1.3.0"
"serialize-javascript": "^1.3.0",
"source-map": "0.5.6"
},
"devDependencies": {
"@types/node": "^7.0.22",
"typescript": "^2.3.3",
"@types/webpack": "^3.0.6",
"typescript": "^2.4.2",
"vue": "file:../.."
},
"homepage": "https://github.com/vuejs/vue/tree/dev/packages/vue-server-renderer#readme"
Expand Down
3 changes: 3 additions & 0 deletions packages/vue-server-renderer/server-plugin.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { WebpackPlugin } from './types/plugin';
declare const Plugin: WebpackPlugin;
export = Plugin;
9 changes: 9 additions & 0 deletions packages/vue-server-renderer/types/plugin.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Plugin } from 'webpack';

interface WebpackPluginOptions {
filename?: string;
}

export interface WebpackPlugin {
new (options?: WebpackPluginOptions): Plugin;
}
15 changes: 15 additions & 0 deletions packages/vue-server-renderer/types/test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import Vue = require('vue');
import VueSSRClientPlugin = require('../client-plugin');
import VueSSRServerPlugin = require('../server-plugin');
import webpack = require('webpack');
import { readFileSync } from 'fs';
import { createRenderer, createBundleRenderer } from '../';

Expand Down Expand Up @@ -82,3 +85,15 @@ bundleRenderer.renderToString(context, (err, html) => {
bundleRenderer.renderToStream(context).on('data', chunk => {
const html = chunk.toString();
});

// webpack plugins
webpack({
plugins: [
new VueSSRClientPlugin({
filename: 'client-manifest.json'
}),
new VueSSRServerPlugin({
filename: 'server-bundle.json'
})
]
});