revojs 0.1.0 → 0.1.2

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/dist/index.d.ts CHANGED
@@ -57,6 +57,7 @@ interface Config {
57
57
  modules: Array<Module>;
58
58
  client?: string;
59
59
  server?: string;
60
+ externals: Array<string>;
60
61
  sources: Record<string, Source>;
61
62
  }
62
63
  interface Module {
package/dist/index.js CHANGED
@@ -319,6 +319,7 @@ function mergeObjects(base, input) {
319
319
  function createApp(inputConfig) {
320
320
  let config = mergeObjects(inputConfig, {
321
321
  modules: [],
322
+ externals: [],
322
323
  sources: {
323
324
  assets: {
324
325
  match: "**/*",
@@ -19,6 +19,7 @@ interface Config {
19
19
  modules: Array<Module>;
20
20
  client?: string;
21
21
  server?: string;
22
+ externals: Array<string>;
22
23
  sources: Record<string, Source>;
23
24
  }
24
25
  interface Module {
@@ -8,7 +8,7 @@ import { existsSync, readFileSync } from "fs";
8
8
 
9
9
  //#region package.json
10
10
  var name = "revojs";
11
- var version = "0.1.0";
11
+ var version = "0.1.2";
12
12
 
13
13
  //#endregion
14
14
  //#region src/server/index.ts
@@ -71,6 +71,7 @@ function mergeObjects(base, input) {
71
71
  function createApp(inputConfig) {
72
72
  let config = mergeObjects(inputConfig, {
73
73
  modules: [],
74
+ externals: [],
74
75
  sources: {
75
76
  assets: {
76
77
  match: "**/*",
@@ -250,15 +251,23 @@ async function toNodeRequest(res, nodeRes) {
250
251
  const SUFFIX = "?client";
251
252
  function client() {
252
253
  let server;
254
+ let bundle;
253
255
  return {
254
256
  name: "client",
255
257
  sharedDuringBuild: true,
256
258
  configureServer(devServer) {
257
259
  server = devServer;
258
260
  },
261
+ writeBundle(_, clientBundle) {
262
+ if (this.environment.name === CLIENT) bundle = clientBundle;
263
+ },
259
264
  load(key) {
260
265
  if (key.endsWith(SUFFIX)) {
261
266
  const path = key.substring(0, key.length - 7);
267
+ if (bundle) for (const name$1 in bundle) {
268
+ const file = bundle[name$1];
269
+ if (file && file.type === "asset" && file.originalFileNames.includes(basename(path))) return file.source.toString();
270
+ }
262
271
  return readFileSync(path, "utf-8");
263
272
  }
264
273
  return null;
@@ -390,6 +399,7 @@ function revojs(config) {
390
399
  return {
391
400
  appType: "custom",
392
401
  resolve: { alias: app.alias },
402
+ build: { rollupOptions: { external: app.config.externals } },
393
403
  environments: {
394
404
  ...app.config.client && { [CLIENT]: {
395
405
  consumer: "client",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "revojs",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "repository": "coverbase/revojs",
6
6
  "license": "MIT",