Skip to content

Commit

Permalink
build: code
Browse files Browse the repository at this point in the history
  • Loading branch information
lzxb committed Jul 17, 2021
1 parent f111319 commit 73bd42e
Show file tree
Hide file tree
Showing 32 changed files with 517 additions and 98 deletions.
2 changes: 1 addition & 1 deletion deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ yarn
yarn build:ts
yarn build
yarn test
lerna publish --registry=https://registry.npmjs.org --force-publish --exact
# lerna publish --registry=https://registry.npmjs.org --force-publish --exact
6 changes: 2 additions & 4 deletions packages/genesis-app/dist/cjs/create-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.createServerApp = exports.createClientApp = void 0;
const vue_1 = __importDefault(require("vue"));
const createClientApp = async (options) => {
exports.createClientApp = async (options) => {
if (typeof options !== 'object') {
throw new Error('Option cannot be empty');
}
Expand Down Expand Up @@ -48,8 +48,7 @@ const createClientApp = async (options) => {
});
return app;
};
exports.createClientApp = createClientApp;
const createServerApp = async (options) => {
exports.createServerApp = async (options) => {
if (!options.App) {
throw new Error('options.App component cannot be empty');
}
Expand Down Expand Up @@ -79,4 +78,3 @@ const createServerApp = async (options) => {
});
return app;
};
exports.createServerApp = createServerApp;
3 changes: 1 addition & 2 deletions packages/genesis-app/dist/esm/back/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ export function catchError(err) {
return Promise.reject(err);
}
export class Sync {
list = [];
onPopstate;
constructor() {
this.list = [];
this.onPopstate = () => {
this.to();
};
Expand Down
9 changes: 4 additions & 5 deletions packages/genesis-app/dist/esm/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ function equalPath(path1, path2) {
return path1.replace(/\/$/, '') === path2.replace(/\/$/, '');
}
class GenesisAppRouter {
static key = '__genesisAppRouter';
list = [];
target;
syncing = false;
constructor() {
this.list = [];
this.syncing = false;
window.addEventListener('popstate', (e) => {
this.sync((router) => {
// Here is a Fang'f that vue-router does not disclose
Expand Down Expand Up @@ -65,6 +63,7 @@ class GenesisAppRouter {
});
}
}
GenesisAppRouter.key = '__genesisAppRouter';
const getRoute = () => {
if (typeof window === 'object') {
const win = window;
Expand All @@ -77,12 +76,12 @@ const getRoute = () => {
};
const route = getRoute();
export class Router extends VueRouter {
sourceMode = 'abstract';
constructor(options = {}) {
super({
...options,
mode: options.mode === 'history' ? 'abstract' : options.mode
});
this.sourceMode = 'abstract';
this.sourceMode = options.mode;
if (!this._isSync)
return;
Expand Down
2 changes: 1 addition & 1 deletion packages/genesis-app/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"baseUrl": "./",
"target": "ESNext",
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
Expand Down
3 changes: 1 addition & 2 deletions packages/genesis-compiler/dist/cjs/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class BaseGenesis {
}
}
exports.BaseGenesis = BaseGenesis;
const deleteFolder = (path) => {
exports.deleteFolder = (path) => {
if (!fs_1.default.existsSync(path))
return;
const files = fs_1.default.readdirSync(path);
Expand All @@ -26,4 +26,3 @@ const deleteFolder = (path) => {
});
fs_1.default.rmdirSync(path);
};
exports.deleteFolder = deleteFolder;
1 change: 0 additions & 1 deletion packages/genesis-compiler/dist/cjs/webpack/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ServerConfig = exports.ClientConfig = exports.BaseConfig = void 0;
var base_1 = require("./base");
Object.defineProperty(exports, "BaseConfig", { enumerable: true, get: function () { return base_1.BaseConfig; } });
var client_1 = require("./client");
Expand Down
1 change: 0 additions & 1 deletion packages/genesis-compiler/dist/esm/build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { deleteFolder } from '../utils/index';
const error = chalk.bold.red;
const warning = chalk.keyword('orange');
export class Build {
ssr;
constructor(ssr, options = {}) {
this.ssr = ssr;
ssr.plugin.unshift(InstallPlugin);
Expand Down
1 change: 0 additions & 1 deletion packages/genesis-compiler/dist/esm/utils/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import fs from 'fs';
export class BaseGenesis {
ssr;
constructor(ssr) {
this.ssr = ssr;
}
Expand Down
2 changes: 0 additions & 2 deletions packages/genesis-compiler/dist/esm/webpack/base.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import Config from 'webpack-chain';
import { BaseGenesis } from '../utils';
export class BaseConfig extends BaseGenesis {
config;
reday;
constructor(ssr, target) {
super(ssr);
this.config = new Config();
Expand Down
5 changes: 1 addition & 4 deletions packages/genesis-compiler/dist/esm/webpack/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@ const readFile = (fs, file) => {
}
};
export class Watch extends BaseGenesis {
devMiddleware;
hotMiddleware;
watchData = {};
_renderer;
constructor(ssr) {
super(ssr);
this.watchData = {};
ssr.plugin.unshift(InstallPlugin);
}
get renderer() {
Expand Down
2 changes: 1 addition & 1 deletion packages/genesis-compiler/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"baseUrl": "./",
"target": "ESNext",
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
Expand Down
13 changes: 4 additions & 9 deletions packages/genesis-core/dist/esm/plugin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export class Plugin {
ssr;
constructor(ssr) {
this.ssr = ssr;
}
Expand Down Expand Up @@ -33,15 +32,11 @@ export class Plugin {
renderCompleted(context) { }
}
export class PluginManage {
/**
* Current SSR instance
*/
ssr;
/**
* List of installed plug-ins
*/
plugins = [];
constructor(ssr) {
/**
* List of installed plug-ins
*/
this.plugins = [];
this.ssr = ssr;
}
/**
Expand Down
14 changes: 0 additions & 14 deletions packages/genesis-core/dist/esm/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,6 @@ const modes = [
'csr-json'
];
export class Renderer {
ssr;
clientManifest;
/**
* Client side renderer
*/
csrRenderer;
/**
* Render template functions
*/
compile;
/**
* Server side renderer
*/
ssrRenderer;
constructor(ssr, options) {
if ((!options?.client?.data || !options?.server?.data) &&
(!fs.existsSync(ssr.outputClientManifestFile) ||
Expand Down
16 changes: 4 additions & 12 deletions packages/genesis-core/dist/esm/ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,14 @@ import process from 'process';
import { PluginManage } from './plugin';
import { Renderer } from './renderer';
export class SSR {
/**
* Renderer
*/
Renderer = Renderer;
/**
* Constructor options
*/
options;
/**
* Plug in management
*/
plugin;
/**
* Constructor
*/
constructor(options = {}) {
/**
* Renderer
*/
this.Renderer = Renderer;
this.options = options;
this.plugin = new PluginManage(this);
if ('name' in options && typeof options.name !== 'string') {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.app[data-v-79c7bd38]{padding:100px;text-align:center}.text[data-v-79c7bd38]{color:#999;font-size:14px;cursor:pointer}
Loading

0 comments on commit 73bd42e

Please sign in to comment.