@metricinsights/pp-dev 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -0
- package/bin/pp-dev.js +71 -0
- package/dist/banner/header.d.ts +2 -0
- package/dist/banner/header.js +10 -0
- package/dist/banner/header.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +275 -0
- package/dist/cli.js.map +1 -0
- package/dist/client/client.css +36 -0
- package/dist/client/client.js +19 -0
- package/dist/client/client.js.map +1 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.html +40 -0
- package/dist/client/rollup.config.d.ts +2 -0
- package/dist/constants.d.ts +6 -0
- package/dist/constants.js +18 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +147 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/client.service.d.ts +10 -0
- package/dist/lib/client.service.js +33 -0
- package/dist/lib/client.service.js.map +1 -0
- package/dist/lib/helpers/url.helper.d.ts +3 -0
- package/dist/lib/helpers/url.helper.js +27 -0
- package/dist/lib/helpers/url.helper.js.map +1 -0
- package/dist/lib/pp.middleware.d.ts +15 -0
- package/dist/lib/pp.middleware.js +133 -0
- package/dist/lib/pp.middleware.js.map +1 -0
- package/dist/lib/proxy-pass.middleware.d.ts +9 -0
- package/dist/lib/proxy-pass.middleware.js +88 -0
- package/dist/lib/proxy-pass.middleware.js.map +1 -0
- package/dist/plugin.d.ts +10 -0
- package/dist/plugin.js +103 -0
- package/dist/plugin.js.map +1 -0
- package/dist/plugins/client-injection-plugin.d.ts +12 -0
- package/dist/plugins/client-injection-plugin.js +57 -0
- package/dist/plugins/client-injection-plugin.js.map +1 -0
- package/dist/shortcuts.d.ts +12 -0
- package/dist/shortcuts.js +83 -0
- package/dist/shortcuts.js.map +1 -0
- package/package.json +68 -0
- package/pp-dev.d.ts +60 -0
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# pp-dev
|
|
2
|
+
|
|
3
|
+
Portal Page development framework
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Package installation
|
|
8
|
+
|
|
9
|
+
```shell
|
|
10
|
+
$ npm i @metricinsights/pp-dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Migration guide from old portal page helper to new
|
|
14
|
+
|
|
15
|
+
1. You need to initialize npm in your portal page repository (if you have `package.json` file in PP folder, you can skip this step):
|
|
16
|
+
|
|
17
|
+
Go to portal page folder and run command. This command will create `package.json` file in your folder
|
|
18
|
+
|
|
19
|
+
```shell
|
|
20
|
+
$ npm init
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
2. You need to install this package by this command:
|
|
24
|
+
```shell
|
|
25
|
+
$ npm i @metricinsights/pp-dev
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
3. You need to create two scripts in `package.json` script section.
|
|
29
|
+
- `start` script: `"start": "pp-dev"`
|
|
30
|
+
- `build` script: `"build": "pp-dev build"`
|
|
31
|
+
|
|
32
|
+
4. You need to change all paths to the file in index.html to the absolute path.
|
|
33
|
+
If you have a path like `/pt/main.js` this must be changed to `/main.js`.
|
|
34
|
+
Also, you may need to add `type="module"` to every script that is added by the `script` tag with the `src` property.
|
|
35
|
+
Actually would be good to have only one `script` tag with the `src` tag.
|
|
36
|
+
Every other JS file will be imported with construction like this `import helper from './helpers';`
|
package/bin/pp-dev.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { performance } from 'node:perf_hooks';
|
|
3
|
+
|
|
4
|
+
if (!import.meta.url.includes('node_modules')) {
|
|
5
|
+
try {
|
|
6
|
+
// only available as dev dependency
|
|
7
|
+
await import('source-map-support').then((r) => r.default.install());
|
|
8
|
+
} catch (e) {
|
|
9
|
+
/* empty */
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
global.__pp_dev_start_time = performance.now();
|
|
14
|
+
|
|
15
|
+
// check debug mode first before requiring the CLI.
|
|
16
|
+
const debugIndex = process.argv.findIndex((arg) =>
|
|
17
|
+
/^(?:-d|--debug)$/.test(arg),
|
|
18
|
+
);
|
|
19
|
+
const filterIndex = process.argv.findIndex((arg) =>
|
|
20
|
+
/^(?:-f|--filter)$/.test(arg),
|
|
21
|
+
);
|
|
22
|
+
const profileIndex = process.argv.indexOf('--profile');
|
|
23
|
+
|
|
24
|
+
if (debugIndex > 0) {
|
|
25
|
+
let value = process.argv[debugIndex + 1];
|
|
26
|
+
|
|
27
|
+
if (!value || value.startsWith('-')) {
|
|
28
|
+
value = 'pp-dev:*,vite:*';
|
|
29
|
+
} else {
|
|
30
|
+
// support debugging multiple flags with comma-separated list
|
|
31
|
+
value = value
|
|
32
|
+
.split(',')
|
|
33
|
+
.map((v) => `pp-dev:${v},vite:${v}`)
|
|
34
|
+
.join(',');
|
|
35
|
+
}
|
|
36
|
+
process.env.DEBUG = `${
|
|
37
|
+
process.env.DEBUG ? process.env.DEBUG + ',' : ''
|
|
38
|
+
}${value}`;
|
|
39
|
+
|
|
40
|
+
if (filterIndex > 0) {
|
|
41
|
+
const filter = process.argv[filterIndex + 1];
|
|
42
|
+
|
|
43
|
+
if (filter && !filter.startsWith('-')) {
|
|
44
|
+
process.env.PP_DEV_DEBUG_FILTER = filter;
|
|
45
|
+
process.env.VITE_DEBUG_FILTER = filter;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function start() {
|
|
51
|
+
return import('../dist/cli.js');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (profileIndex > 0) {
|
|
55
|
+
process.argv.splice(profileIndex, 1);
|
|
56
|
+
const next = process.argv[profileIndex];
|
|
57
|
+
|
|
58
|
+
if (next && !next.startsWith('-')) {
|
|
59
|
+
process.argv.splice(profileIndex, 1);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const inspector = await import('node:inspector').then((r) => r.default);
|
|
63
|
+
const session = (global.__pp_dev_profile_session = new inspector.Session());
|
|
64
|
+
|
|
65
|
+
session.connect();
|
|
66
|
+
session.post('Profiler.enable', () => {
|
|
67
|
+
session.post('Profiler.start', start);
|
|
68
|
+
});
|
|
69
|
+
} else {
|
|
70
|
+
start();
|
|
71
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const START = '/*!\n';
|
|
2
|
+
const PREFIX = ' * ';
|
|
3
|
+
const END = '\n */';
|
|
4
|
+
const replacer = (substring, $1) => `${PREFIX}${$1}`;
|
|
5
|
+
export default function (chunk) {
|
|
6
|
+
const content = `***** DO NOT EDIT THIS CODE! *****
|
|
7
|
+
***** ------- *****`;
|
|
8
|
+
return `${START}${content.replace(/^(.*)$/gm, replacer)}${END}`;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header.js","sourceRoot":"","sources":["../../src/banner/header.ts"],"names":[],"mappings":"AAEA,MAAM,KAAK,GAAG,OAAO,CAAC;AACtB,MAAM,MAAM,GAAG,KAAK,CAAC;AACrB,MAAM,GAAG,GAAG,OAAO,CAAC;AAEpB,MAAM,QAAQ,GAAG,CAAC,SAAiB,EAAE,EAAU,EAAE,EAAE,CAAC,GAAG,MAAM,GAAG,EAAE,EAAE,CAAC;AAErE,MAAM,CAAC,OAAO,WAAW,KAAoB;IAC3C,MAAM,OAAO,GAAG;oBACE,CAAC;IAEnB,OAAO,GAAG,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,GAAG,GAAG,EAAE,CAAC;AAClE,CAAC"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const stopProfiler: (log: (message: string) => void) => void | Promise<void>;
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import * as fs from 'fs';
|
|
3
|
+
import { performance } from 'node:perf_hooks';
|
|
4
|
+
import { cac } from 'cac';
|
|
5
|
+
import { createColors } from 'picocolors';
|
|
6
|
+
import { VERSION } from './constants.js';
|
|
7
|
+
import { bindShortcuts } from './shortcuts.js';
|
|
8
|
+
import { getViteConfig } from './index.js';
|
|
9
|
+
import { mergeConfig, build, optimizeDeps, resolveConfig, preview, createLogger, loadConfigFromFile, } from 'vite';
|
|
10
|
+
const cli = cac('pp-dev');
|
|
11
|
+
const colors = createColors();
|
|
12
|
+
let profileSession = global.__pp_dev_profile_session;
|
|
13
|
+
let profileCount = 0;
|
|
14
|
+
export const stopProfiler = (log) => {
|
|
15
|
+
if (!profileSession) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
return new Promise((res, rej) => {
|
|
19
|
+
profileSession.post('Profiler.stop', (err, { profile }) => {
|
|
20
|
+
if (!err) {
|
|
21
|
+
const outPath = path.resolve(`./pp-dev-profile-${profileCount++}.cpuprofile`);
|
|
22
|
+
fs.writeFileSync(outPath, JSON.stringify(profile));
|
|
23
|
+
log(colors.yellow(`CPU profile written to ${colors.white(colors.dim(outPath))}`));
|
|
24
|
+
profileSession = undefined;
|
|
25
|
+
res();
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
rej(err);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
const filterDuplicateOptions = (options) => {
|
|
34
|
+
for (const [key, value] of Object.entries(options)) {
|
|
35
|
+
if (Array.isArray(value)) {
|
|
36
|
+
options[key] = value[value.length - 1];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
function cleanOptions(options) {
|
|
41
|
+
const ret = { ...options };
|
|
42
|
+
delete ret['--'];
|
|
43
|
+
delete ret.c;
|
|
44
|
+
delete ret.config;
|
|
45
|
+
delete ret.base;
|
|
46
|
+
delete ret.l;
|
|
47
|
+
delete ret.logLevel;
|
|
48
|
+
delete ret.clearScreen;
|
|
49
|
+
delete ret.d;
|
|
50
|
+
delete ret.debug;
|
|
51
|
+
delete ret.f;
|
|
52
|
+
delete ret.filter;
|
|
53
|
+
delete ret.m;
|
|
54
|
+
delete ret.mode;
|
|
55
|
+
return ret;
|
|
56
|
+
}
|
|
57
|
+
cli
|
|
58
|
+
.option('-c, --config <file>', `[string] use specified config file`)
|
|
59
|
+
.option('--base <path>', `[string] public base path (default: /)`)
|
|
60
|
+
.option('-l, --logLevel <level>', `[string] info | warn | error | silent`)
|
|
61
|
+
.option('--clearScreen', `[boolean] allow/disable clear screen when logging`)
|
|
62
|
+
.option('-d, --debug [feat]', `[string | boolean] show debug logs`)
|
|
63
|
+
.option('-f, --filter <filter>', `[string] filter debug logs`)
|
|
64
|
+
.option('-m, --mode <mode>', `[string] set env mode`);
|
|
65
|
+
cli
|
|
66
|
+
.command('[root]', 'start dev server')
|
|
67
|
+
.alias('serve')
|
|
68
|
+
.alias('dev')
|
|
69
|
+
.option('--host [host]', `[string] specify hostname`)
|
|
70
|
+
.option('--port <port>', `[number] specify port`)
|
|
71
|
+
.option('--https', `[boolean] use TLS + HTTP/2`)
|
|
72
|
+
.option('--open [path]', `[boolean | string] open browser on startup`)
|
|
73
|
+
.option('--cors', `[boolean] enable CORS`)
|
|
74
|
+
.option('--strictPort', `[boolean] exit if specified port is already in use`)
|
|
75
|
+
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
76
|
+
.action(async (root, options) => {
|
|
77
|
+
filterDuplicateOptions(options);
|
|
78
|
+
const { createServer } = await import('vite');
|
|
79
|
+
try {
|
|
80
|
+
const configFromFile = await loadConfigFromFile({ mode: options.mode || 'development', command: 'serve' }, options.config, root, options.logLevel);
|
|
81
|
+
let config = await getViteConfig();
|
|
82
|
+
if (configFromFile) {
|
|
83
|
+
const { plugins, ...fileConfig } = configFromFile.config;
|
|
84
|
+
config = mergeConfig(config, fileConfig);
|
|
85
|
+
}
|
|
86
|
+
const server = await createServer(mergeConfig(config, {
|
|
87
|
+
root,
|
|
88
|
+
base: options.base,
|
|
89
|
+
mode: options.mode,
|
|
90
|
+
configFile: options.config,
|
|
91
|
+
logLevel: options.logLevel,
|
|
92
|
+
clearScreen: options.clearScreen,
|
|
93
|
+
optimizeDeps: { force: options.force },
|
|
94
|
+
server: cleanOptions(options),
|
|
95
|
+
}, true));
|
|
96
|
+
if (!server.httpServer) {
|
|
97
|
+
throw new Error('HTTP server not available');
|
|
98
|
+
}
|
|
99
|
+
await server.listen();
|
|
100
|
+
const info = server.config.logger.info;
|
|
101
|
+
const ppDevStartTime = global.__pp_dev_start_time ?? false;
|
|
102
|
+
const startupDurationString = ppDevStartTime
|
|
103
|
+
? colors.dim(`ready in ${colors.reset(colors.bold(Math.ceil(performance.now() - ppDevStartTime)))} ms`)
|
|
104
|
+
: '';
|
|
105
|
+
info(`\n ${colors.green(`${colors.bold('PP-DEV')} v${VERSION}`)} ${startupDurationString}\n`, {
|
|
106
|
+
clear: !server.config.logger.hasWarned,
|
|
107
|
+
});
|
|
108
|
+
server.printUrls();
|
|
109
|
+
bindShortcuts(server, {
|
|
110
|
+
print: true,
|
|
111
|
+
customShortcuts: [
|
|
112
|
+
profileSession && {
|
|
113
|
+
key: 'p',
|
|
114
|
+
description: 'start/stop the profiler',
|
|
115
|
+
async action(server) {
|
|
116
|
+
if (profileSession) {
|
|
117
|
+
await stopProfiler(server.config.logger.info);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
const inspector = await import('node:inspector').then((r) => r.default);
|
|
121
|
+
await new Promise((res) => {
|
|
122
|
+
profileSession = new inspector.Session();
|
|
123
|
+
profileSession.connect();
|
|
124
|
+
profileSession.post('Profiler.enable', () => {
|
|
125
|
+
profileSession?.post('Profiler.start', () => {
|
|
126
|
+
server.config.logger.info('Profiler started');
|
|
127
|
+
res();
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
key: 'l',
|
|
136
|
+
description: 'proxy re-login',
|
|
137
|
+
action(server) {
|
|
138
|
+
server.ws.send({
|
|
139
|
+
type: 'custom',
|
|
140
|
+
event: 'redirect',
|
|
141
|
+
data: { url: `/auth/index/logout?proxyRedirect=${encodeURIComponent('/')}` },
|
|
142
|
+
});
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
catch (e) {
|
|
149
|
+
const logger = createLogger(options.logLevel);
|
|
150
|
+
logger.error(colors.red(`error when starting dev server:\n${e.stack}`), {
|
|
151
|
+
error: e,
|
|
152
|
+
});
|
|
153
|
+
stopProfiler(logger.info);
|
|
154
|
+
process.exit(1);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
cli
|
|
158
|
+
.command('build [root]', 'build for production')
|
|
159
|
+
.option('--target <target>', `[string] transpile target (default: 'modules')`)
|
|
160
|
+
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
|
161
|
+
.option('--assetsDir <dir>', `[string] directory under outDir to place assets in (default: assets)`)
|
|
162
|
+
.option('--assetsInlineLimit <number>', `[number] static asset base64 inline threshold in bytes (default: 4096)`)
|
|
163
|
+
.option('--ssr [entry]', `[string] build specified entry for server-side rendering`)
|
|
164
|
+
.option('--sourcemap [output]', `[boolean | "inline" | "hidden"] output source maps for build (default: false)`)
|
|
165
|
+
.option('--minify [minifier]', `[boolean | "terser" | "esbuild"] enable/disable minification, ` + `or specify minifier to use (default: esbuild)`)
|
|
166
|
+
.option('--manifest [name]', `[boolean | string] emit build manifest json`)
|
|
167
|
+
.option('--ssrManifest [name]', `[boolean | string] emit ssr manifest json`)
|
|
168
|
+
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle (experimental)`)
|
|
169
|
+
.option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
|
|
170
|
+
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
171
|
+
.action(async (root, options) => {
|
|
172
|
+
filterDuplicateOptions(options);
|
|
173
|
+
const buildOptions = cleanOptions(options);
|
|
174
|
+
try {
|
|
175
|
+
const configFromFile = await loadConfigFromFile({ mode: options.mode || 'production', command: 'build' }, options.config, root, options.logLevel);
|
|
176
|
+
let config = await getViteConfig();
|
|
177
|
+
if (configFromFile) {
|
|
178
|
+
const { plugins, ...fileConfig } = configFromFile.config;
|
|
179
|
+
config = mergeConfig(config, fileConfig);
|
|
180
|
+
}
|
|
181
|
+
await build(mergeConfig(config, {
|
|
182
|
+
root,
|
|
183
|
+
base: options.base,
|
|
184
|
+
mode: options.mode,
|
|
185
|
+
configFile: options.config,
|
|
186
|
+
logLevel: options.logLevel,
|
|
187
|
+
clearScreen: options.clearScreen,
|
|
188
|
+
optimizeDeps: { force: options.force },
|
|
189
|
+
build: buildOptions,
|
|
190
|
+
}, true));
|
|
191
|
+
}
|
|
192
|
+
catch (e) {
|
|
193
|
+
createLogger(options.logLevel).error(colors.red(`error during build:\n${e.stack}`), { error: e });
|
|
194
|
+
process.exit(1);
|
|
195
|
+
}
|
|
196
|
+
finally {
|
|
197
|
+
stopProfiler((message) => createLogger(options.logLevel).info(message));
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
cli
|
|
201
|
+
.command('optimize [root]', 'pre-bundle dependencies')
|
|
202
|
+
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
203
|
+
.action(async (root, options) => {
|
|
204
|
+
filterDuplicateOptions(options);
|
|
205
|
+
try {
|
|
206
|
+
const configFromFile = await loadConfigFromFile({ mode: options.mode || 'production', command: 'build' }, options.config, root, options.logLevel);
|
|
207
|
+
let config = await getViteConfig();
|
|
208
|
+
if (configFromFile) {
|
|
209
|
+
const { plugins, ...fileConfig } = configFromFile.config;
|
|
210
|
+
config = mergeConfig(config, fileConfig);
|
|
211
|
+
}
|
|
212
|
+
const optimizeConfig = await resolveConfig(mergeConfig(config, {
|
|
213
|
+
root,
|
|
214
|
+
base: options.base,
|
|
215
|
+
configFile: options.config,
|
|
216
|
+
logLevel: options.logLevel,
|
|
217
|
+
mode: options.mode,
|
|
218
|
+
}), 'serve');
|
|
219
|
+
await optimizeDeps(optimizeConfig, options.force, true);
|
|
220
|
+
}
|
|
221
|
+
catch (e) {
|
|
222
|
+
createLogger(options.logLevel).error(colors.red(`error when optimizing deps:\n${e.stack}`), { error: e });
|
|
223
|
+
process.exit(1);
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
cli
|
|
227
|
+
.command('preview [root]', 'locally preview production build')
|
|
228
|
+
.option('--host [host]', `[string] specify hostname`)
|
|
229
|
+
.option('--port <port>', `[number] specify port`)
|
|
230
|
+
.option('--strictPort', `[boolean] exit if specified port is already in use`)
|
|
231
|
+
.option('--https', `[boolean] use TLS + HTTP/2`)
|
|
232
|
+
.option('--open [path]', `[boolean | string] open browser on startup`)
|
|
233
|
+
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
|
234
|
+
.action(async (root, options) => {
|
|
235
|
+
filterDuplicateOptions(options);
|
|
236
|
+
try {
|
|
237
|
+
const configFromFile = await loadConfigFromFile({ mode: options.mode || 'production', command: 'build' }, options.config, root, options.logLevel);
|
|
238
|
+
let config = await getViteConfig();
|
|
239
|
+
if (configFromFile) {
|
|
240
|
+
const { plugins, ...fileConfig } = configFromFile.config;
|
|
241
|
+
config = mergeConfig(config, fileConfig);
|
|
242
|
+
}
|
|
243
|
+
const server = await preview(mergeConfig(config, {
|
|
244
|
+
root,
|
|
245
|
+
base: options.base,
|
|
246
|
+
configFile: options.config,
|
|
247
|
+
logLevel: options.logLevel,
|
|
248
|
+
mode: options.mode,
|
|
249
|
+
build: {
|
|
250
|
+
outDir: options.outDir,
|
|
251
|
+
},
|
|
252
|
+
preview: {
|
|
253
|
+
port: options.port,
|
|
254
|
+
strictPort: options.strictPort,
|
|
255
|
+
host: options.host,
|
|
256
|
+
https: options.https,
|
|
257
|
+
open: options.open,
|
|
258
|
+
},
|
|
259
|
+
}));
|
|
260
|
+
server.printUrls();
|
|
261
|
+
}
|
|
262
|
+
catch (e) {
|
|
263
|
+
createLogger(options.logLevel).error(colors.red(`error when starting preview server:\n${e.stack}`), {
|
|
264
|
+
error: e,
|
|
265
|
+
});
|
|
266
|
+
process.exit(1);
|
|
267
|
+
}
|
|
268
|
+
finally {
|
|
269
|
+
stopProfiler((message) => createLogger(options.logLevel).info(message));
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
cli.help();
|
|
273
|
+
cli.version(VERSION);
|
|
274
|
+
cli.parse();
|
|
275
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EACL,WAAW,EACX,KAAK,EACL,YAAY,EACZ,aAAa,EACb,OAAO,EACP,YAAY,EAEZ,kBAAkB,GACnB,MAAM,MAAM,CAAC;AAEd,MAAM,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;AAoB9B,IAAI,cAAc,GAAI,MAAc,CAAC,wBAAwB,CAAC;AAC9D,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB,MAAM,C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;
|
|
3
|
+
z-index: 10000;
|
|
4
|
+
min-width: 800px;
|
|
5
|
+
width: fit-content;
|
|
6
|
+
height: 30px;
|
|
7
|
+
top: calc(100% - 30px);
|
|
8
|
+
right: 0;
|
|
9
|
+
text-align: center;
|
|
10
|
+
padding: 5px 20px;
|
|
11
|
+
background-color: #f0f0f0;
|
|
12
|
+
border-radius: 3px 0 0 0;
|
|
13
|
+
color: #333;
|
|
14
|
+
box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
|
|
15
|
+
display: flex;
|
|
16
|
+
}
|
|
17
|
+
.pp-dev-info .sync-button {
|
|
18
|
+
background-color: transparent;
|
|
19
|
+
border: none;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
}
|
|
22
|
+
.pp-dev-info .sync-button.syncing {
|
|
23
|
+
cursor: not-allowed;
|
|
24
|
+
pointer-events: none;
|
|
25
|
+
}
|
|
26
|
+
.pp-dev-info .sync-button.syncing svg {
|
|
27
|
+
animation: rotation 2s linear infinite;
|
|
28
|
+
}
|
|
29
|
+
@keyframes rotation {
|
|
30
|
+
0% {
|
|
31
|
+
transform: rotate(0deg) matrix(1, 0, 0, -1, 0, 0);
|
|
32
|
+
}
|
|
33
|
+
100% {
|
|
34
|
+
transform: rotate(360deg) matrix(1, 0, 0, -1, 0, 0);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
if (import.meta.hot) {
|
|
2
|
+
const { hot } = import.meta;
|
|
3
|
+
hot.on('redirect', (data) => {
|
|
4
|
+
window.location.href = data.url;
|
|
5
|
+
});
|
|
6
|
+
const syncButton = document.getElementById('sync-template');
|
|
7
|
+
if (syncButton) {
|
|
8
|
+
hot.on('template:sync:response', (payload) => {
|
|
9
|
+
syncButton.classList.remove('syncing');
|
|
10
|
+
console.log(payload);
|
|
11
|
+
});
|
|
12
|
+
syncButton.addEventListener('click', (ev) => {
|
|
13
|
+
ev.preventDefault();
|
|
14
|
+
syncButton.classList.add('syncing');
|
|
15
|
+
hot.send('template:sync', {});
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sources":["index.ts"],"sourcesContent":[null],"names":[],"mappings":"AAIA,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;AACnB,IAAA,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC;IAE5B,GAAG,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,IAAqB,KAAI;QAC3C,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC;AAClC,KAAC,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,QAAQ,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;AAE5D,IAAA,IAAI,UAAU,EAAE;QACd,GAAG,CAAC,EAAE,CAAC,wBAAwB,EAAE,CAAC,OAAO,KAAI;AAC3C,YAAA,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AAEvC,YAAA,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACvB,SAAC,CAAC,CAAC;QAEH,UAAU,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,EAAE,KAAI;YAC1C,EAAE,CAAC,cAAc,EAAE,CAAC;AAEpB,YAAA,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AAEpC,YAAA,GAAG,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;AAChC,SAAC,CAAC,CAAC;AACJ,KAAA;AACF","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{%# This is EJS template. Parameters: openDelimiter: "{", closeDelimiter="}" %}
|
|
2
|
+
<div class="pp-dev-info">
|
|
3
|
+
<span>
|
|
4
|
+
<span
|
|
5
|
+
><a href="https://www.npmjs.com/package/{%= PACKAGE_NAME %}/v/{%= VERSION %}" target="_blank">
|
|
6
|
+
<b>{%= PACKAGE_NAME %}</b>: <b style="color: orange">{%= VERSION %}</b></a
|
|
7
|
+
>;
|
|
8
|
+
</span>
|
|
9
|
+
{% if (backendBaseURL) { %}
|
|
10
|
+
<span> Backend URL: <a href="!!{%= backendBaseURL %}" target="_blank">!!{%= backendBaseURL %}</a>; </span>
|
|
11
|
+
{% } %}
|
|
12
|
+
<span>
|
|
13
|
+
<span>Template mode: </span>
|
|
14
|
+
{% if (templateLess || !backendBaseURL || Number.isNaN(+portalPageId)) { %}
|
|
15
|
+
<b style="color: red">Disabled</b>; {% } else { %} <b style="color: green">Enabled</b>; {% } %}
|
|
16
|
+
</span>
|
|
17
|
+
{% if (backendBaseURL && !Number.isNaN(+portalPageId)) { %}
|
|
18
|
+
<span
|
|
19
|
+
>Portal page ID:
|
|
20
|
+
<a href="!!{%= backendBaseURL %}/admin/page/edit/id/{%= portalPageId %}" target="_blank">{%= portalPageId %}</a>;
|
|
21
|
+
</span>
|
|
22
|
+
{% } %}
|
|
23
|
+
</span>
|
|
24
|
+
{% if (!templateLess && backendBaseURL && Number.isNaN(+portalPageId)) { %}
|
|
25
|
+
<button id="sync-template" class="sync-button" title="Sync template (Not implemented yet)">
|
|
26
|
+
<svg
|
|
27
|
+
fill="#007BFF"
|
|
28
|
+
width="16px"
|
|
29
|
+
height="16px"
|
|
30
|
+
viewBox="0 0 24 24"
|
|
31
|
+
transform="rotate(0)matrix(1, 0, 0, -1, 0, 0)"
|
|
32
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
33
|
+
>
|
|
34
|
+
<path
|
|
35
|
+
d="M19.91,15.51H15.38a1,1,0,0,0,0,2h2.4A8,8,0,0,1,4,12a1,1,0,0,0-2,0,10,10,0,0,0,16.88,7.23V21a1,1,0,0,0,2,0V16.5A1,1,0,0,0,19.91,15.51ZM12,2A10,10,0,0,0,5.12,4.77V3a1,1,0,0,0-2,0V7.5a1,1,0,0,0,1,1h4.5a1,1,0,0,0,0-2H6.22A8,8,0,0,1,20,12a1,1,0,0,0,2,0A10,10,0,0,0,12,2Z"
|
|
36
|
+
/>
|
|
37
|
+
</svg>
|
|
38
|
+
</button>
|
|
39
|
+
{% } %}
|
|
40
|
+
</div>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const PP_DEV_PACKAGE_DIR: string;
|
|
2
|
+
export declare const PP_DEV_CLIENT_ENTRY: string;
|
|
3
|
+
export declare const VERSION: string;
|
|
4
|
+
export declare const PACKAGE_NAME: string;
|
|
5
|
+
export declare const PP_WATCH_CONFIG_NAMES: readonly [".pp-watch.config.js", ".pp-watch.config.ts", ".pp-watch.config.json"];
|
|
6
|
+
export declare const PP_DEV_CONFIG_NAMES: readonly [".pp-dev.config.js", ".pp-dev.config.ts", ".pp-dev.config.json", "pp-dev.config.js", "pp-dev.config.ts", "pp-dev.config.json"];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { readFileSync } from 'fs';
|
|
2
|
+
import { resolve } from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
export const PP_DEV_PACKAGE_DIR = resolve(fileURLToPath(import.meta.url), '../..');
|
|
5
|
+
export const PP_DEV_CLIENT_ENTRY = resolve(PP_DEV_PACKAGE_DIR, 'dist/client/client.js');
|
|
6
|
+
const { version, name } = JSON.parse(readFileSync(resolve(PP_DEV_PACKAGE_DIR, 'package.json')).toString());
|
|
7
|
+
export const VERSION = version;
|
|
8
|
+
export const PACKAGE_NAME = name;
|
|
9
|
+
export const PP_WATCH_CONFIG_NAMES = ['.pp-watch.config.js', '.pp-watch.config.ts', '.pp-watch.config.json'];
|
|
10
|
+
export const PP_DEV_CONFIG_NAMES = [
|
|
11
|
+
'.pp-dev.config.js',
|
|
12
|
+
'.pp-dev.config.ts',
|
|
13
|
+
'.pp-dev.config.json',
|
|
14
|
+
'pp-dev.config.js',
|
|
15
|
+
'pp-dev.config.ts',
|
|
16
|
+
'pp-dev.config.json',
|
|
17
|
+
];
|
|
18
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,CAEvC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAC9B,OAAO,CACR,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,EAAE,uBAAuB,CAAC,CAAC;AAExF,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,kBAAkB,EAAE,cAAc,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;AAE3G,MAAM,CAAC,MAAM,OAAO,GAAG,OAAiB,CAAC;AACzC,MAAM,CAAC,MAAM,YAAY,GAAG,IAAc,CAAC;AAE3C,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,qBAAqB,EAAE,qBAAqB,EAAE,uBAAuB,CAAU,CAAC;AAEtH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,mBAAmB;IACnB,mBAAmB;IACnB,qBAAqB;IACrB,kBAAkB;IAClB,kBAAkB;IAClB,oBAAoB;CACZ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InlineConfig } from 'vite';
|
|
2
|
+
import { VitePPDevOptions } from './plugin.js';
|
|
3
|
+
export type PPDevConfig = Omit<VitePPDevOptions, 'templateName'>;
|
|
4
|
+
export type PPWatchConfig = {
|
|
5
|
+
baseURL: string;
|
|
6
|
+
portalPageId: number;
|
|
7
|
+
};
|
|
8
|
+
export declare function getConfig(): Promise<PPDevConfig>;
|
|
9
|
+
export declare function getViteConfig(): Promise<InlineConfig>;
|