@elliemae/pui-cli 8.42.1 → 8.43.0

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/cjs/cli.js CHANGED
@@ -39,6 +39,7 @@ var import_storybook = require("./commands/storybook.js");
39
39
  var import_vitest = require("./commands/vitest.js");
40
40
  var import_version = require("./commands/version.js");
41
41
  var import_tscheck = require("./commands/tscheck.js");
42
+ var import_buildcdn = require("./commands/buildcdn.js");
42
43
  const import_meta = {};
43
44
  const __dirname = import_node_path.default.dirname((0, import_node_url.fileURLToPath)(import_meta.url));
44
45
  (0, import_dotenv.config)();
@@ -55,5 +56,6 @@ process.env.PATH += import_node_path.default.delimiter + import_node_path.defaul
55
56
  await (0, import_yargs.default)((0, import_helpers.hideBin)(process.argv)).command(import_vitest.vitestCmd).help().argv;
56
57
  await (0, import_yargs.default)((0, import_helpers.hideBin)(process.argv)).command(import_version.versionCmd).help().argv;
57
58
  await (0, import_yargs.default)((0, import_helpers.hideBin)(process.argv)).command(import_tscheck.tscheckCmd).help().argv;
59
+ await (0, import_yargs.default)((0, import_helpers.hideBin)(process.argv)).command(import_buildcdn.buildCDNCmd).help().argv;
58
60
  await (0, import_update_notifier.notifyUpdates)();
59
61
  })();
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var buildcdn_exports = {};
30
+ __export(buildcdn_exports, {
31
+ buildCDNCmd: () => buildCDNCmd
32
+ });
33
+ module.exports = __toCommonJS(buildcdn_exports);
34
+ var import_node_path = __toESM(require("node:path"), 1);
35
+ var import_node_url = require("node:url");
36
+ var import_fast_glob = __toESM(require("fast-glob"), 1);
37
+ var import_yargs = __toESM(require("yargs"), 1);
38
+ var import_utils = require("./utils.js");
39
+ const import_meta = {};
40
+ const __dirname = import_node_path.default.dirname((0, import_node_url.fileURLToPath)(import_meta.url));
41
+ const buildCDN = async () => {
42
+ const files = await (0, import_fast_glob.default)(["src/**/*.html"]);
43
+ await Promise.all(
44
+ files.map(async (file) => {
45
+ const srcDir = import_node_path.default.dirname(file);
46
+ const sitePath = srcDir.replace("src/", "");
47
+ const outDir = import_node_path.default.join(process.cwd(), "public", sitePath);
48
+ await (0, import_utils.exec)(
49
+ `vite build -c ${import_node_path.default.resolve(
50
+ __dirname,
51
+ "../build/vite.config.js"
52
+ )} ${srcDir} --outDir ${outDir} --base ${import_node_path.default.join(
53
+ process.env.BASE_PATH ?? "",
54
+ sitePath
55
+ )}`
56
+ );
57
+ })
58
+ );
59
+ };
60
+ const buildCDNCmd = {
61
+ handler: async () => {
62
+ try {
63
+ (0, import_utils.logInfo)("CDN Build in progress...");
64
+ await buildCDN();
65
+ (0, import_utils.logSuccess)("CDN Build completed");
66
+ } catch (err) {
67
+ (0, import_utils.logError)("Build failed", err);
68
+ (0, import_yargs.default)().exit(-1, err);
69
+ }
70
+ },
71
+ command: "buildCDN",
72
+ describe: "builds web application for CDN",
73
+ builder: (yargsRef) => yargsRef.options({}).help()
74
+ };
@@ -60,6 +60,11 @@ const sendFileWithCSPNonce = ({
60
60
  res.sendStatus(404);
61
61
  } else {
62
62
  res.set("Content-Type", "text/html");
63
+ res.set("Reporting-Endpoints", `csp-report-uri="${CSP_REPORT_URI}"`);
64
+ res.set(
65
+ "Permissions-Policy",
66
+ "geolocation=(), camera=(), microphone=(), interest-cohort=()"
67
+ );
63
68
  res.send(html.replace(nonceRegex, res.locals.cspNonce));
64
69
  }
65
70
  });
@@ -87,7 +92,8 @@ const csp = (app) => {
87
92
  objectSrc: ["'none'"],
88
93
  scriptSrc: getScriptSrc(),
89
94
  upgradeInsecureRequests: [],
90
- reportTo: CSP_REPORT_URI
95
+ reportUri: CSP_REPORT_URI,
96
+ reportTo: "csp-report-uri"
91
97
  },
92
98
  reportOnly: process.env.CSP_REPORT_ONLY !== "false"
93
99
  },
@@ -54,11 +54,6 @@ const setupDefaultMiddlewares = (app) => {
54
54
  app.use((0, import_cors.default)());
55
55
  app.options("*", (0, import_cors.default)());
56
56
  (0, import_csp.csp)(app);
57
- app.set("Cross-Origin-Opener-Policy", "same-origin-allow-popups");
58
- app.set(
59
- "Permissions-Policy",
60
- "geolocation=(), camera=(), microphone=(), interest-cohort=()"
61
- );
62
57
  app.use(import_express.default.urlencoded({ extended: false }));
63
58
  app.use(import_express.default.text({ type: "text/plain" }));
64
59
  app.use(import_express.default.json({ type: "application/json" }));
package/dist/esm/cli.js CHANGED
@@ -16,6 +16,7 @@ import { storybookCmd } from "./commands/storybook.js";
16
16
  import { vitestCmd } from "./commands/vitest.js";
17
17
  import { versionCmd } from "./commands/version.js";
18
18
  import { tscheckCmd } from "./commands/tscheck.js";
19
+ import { buildCDNCmd } from "./commands/buildcdn.js";
19
20
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
20
21
  envConfig();
21
22
  process.env.PATH += path.delimiter + path.join(__dirname, "..", "node_modules", ".bin");
@@ -31,5 +32,6 @@ process.env.PATH += path.delimiter + path.join(__dirname, "..", "node_modules",
31
32
  await yargs(hideBin(process.argv)).command(vitestCmd).help().argv;
32
33
  await yargs(hideBin(process.argv)).command(versionCmd).help().argv;
33
34
  await yargs(hideBin(process.argv)).command(tscheckCmd).help().argv;
35
+ await yargs(hideBin(process.argv)).command(buildCDNCmd).help().argv;
34
36
  await notifyUpdates();
35
37
  })();
@@ -0,0 +1,43 @@
1
+ import path from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+ import fg from "fast-glob";
4
+ import yargs from "yargs";
5
+ import { exec, logInfo, logError, logSuccess } from "./utils.js";
6
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
+ const buildCDN = async () => {
8
+ const files = await fg(["src/**/*.html"]);
9
+ await Promise.all(
10
+ files.map(async (file) => {
11
+ const srcDir = path.dirname(file);
12
+ const sitePath = srcDir.replace("src/", "");
13
+ const outDir = path.join(process.cwd(), "public", sitePath);
14
+ await exec(
15
+ `vite build -c ${path.resolve(
16
+ __dirname,
17
+ "../build/vite.config.js"
18
+ )} ${srcDir} --outDir ${outDir} --base ${path.join(
19
+ process.env.BASE_PATH ?? "",
20
+ sitePath
21
+ )}`
22
+ );
23
+ })
24
+ );
25
+ };
26
+ const buildCDNCmd = {
27
+ handler: async () => {
28
+ try {
29
+ logInfo("CDN Build in progress...");
30
+ await buildCDN();
31
+ logSuccess("CDN Build completed");
32
+ } catch (err) {
33
+ logError("Build failed", err);
34
+ yargs().exit(-1, err);
35
+ }
36
+ },
37
+ command: "buildCDN",
38
+ describe: "builds web application for CDN",
39
+ builder: (yargsRef) => yargsRef.options({}).help()
40
+ };
41
+ export {
42
+ buildCDNCmd
43
+ };
@@ -26,6 +26,11 @@ const sendFileWithCSPNonce = ({
26
26
  res.sendStatus(404);
27
27
  } else {
28
28
  res.set("Content-Type", "text/html");
29
+ res.set("Reporting-Endpoints", `csp-report-uri="${CSP_REPORT_URI}"`);
30
+ res.set(
31
+ "Permissions-Policy",
32
+ "geolocation=(), camera=(), microphone=(), interest-cohort=()"
33
+ );
29
34
  res.send(html.replace(nonceRegex, res.locals.cspNonce));
30
35
  }
31
36
  });
@@ -53,7 +58,8 @@ const csp = (app) => {
53
58
  objectSrc: ["'none'"],
54
59
  scriptSrc: getScriptSrc(),
55
60
  upgradeInsecureRequests: [],
56
- reportTo: CSP_REPORT_URI
61
+ reportUri: CSP_REPORT_URI,
62
+ reportTo: "csp-report-uri"
57
63
  },
58
64
  reportOnly: process.env.CSP_REPORT_ONLY !== "false"
59
65
  },
@@ -20,11 +20,6 @@ const setupDefaultMiddlewares = (app) => {
20
20
  app.use(cors());
21
21
  app.options("*", cors());
22
22
  csp(app);
23
- app.set("Cross-Origin-Opener-Policy", "same-origin-allow-popups");
24
- app.set(
25
- "Permissions-Policy",
26
- "geolocation=(), camera=(), microphone=(), interest-cohort=()"
27
- );
28
23
  app.use(express.urlencoded({ extended: false }));
29
24
  app.use(express.text({ type: "text/plain" }));
30
25
  app.use(express.json({ type: "application/json" }));
@@ -0,0 +1,2 @@
1
+ import { CommandModule } from 'yargs';
2
+ export declare const buildCDNCmd: CommandModule<Record<string, never>>;
@@ -1,5 +1,5 @@
1
1
  import { execaCommand } from 'execa';
2
- export declare const exec: (command: string, options?: Parameters<typeof execaCommand>[1]) => Promise<import("execa").ExecaReturnValue<Buffer>>;
2
+ export declare const exec: (command: string, options?: Parameters<typeof execaCommand>[1]) => Promise<import("execa").ExecaReturnValue<Buffer<ArrayBufferLike>>>;
3
3
  export declare const logInfo: {
4
4
  (...data: any[]): void;
5
5
  (message?: any, ...optionalParams: any[]): void;
@@ -1,4 +1,4 @@
1
1
  export declare const getCertOptions: () => {
2
- pfx: Buffer;
2
+ pfx: Buffer<ArrayBufferLike>;
3
3
  passphrase: string;
4
4
  };
@@ -31,7 +31,7 @@ export namespace jestConfig {
31
31
  };
32
32
  let transformIgnorePatterns: string[];
33
33
  namespace globals {
34
- let APP_CONFIG: string | Buffer;
34
+ let APP_CONFIG: string | Buffer<ArrayBufferLike>;
35
35
  let __webpack_public_path__: string;
36
36
  }
37
37
  namespace testEnvironmentOptions {
@@ -32,7 +32,7 @@ export const jestNodeConfig: {
32
32
  '^.+\\.[jt]sx?$': any[];
33
33
  };
34
34
  globals: {
35
- APP_CONFIG: string | Buffer;
35
+ APP_CONFIG: string | Buffer<ArrayBufferLike>;
36
36
  __webpack_public_path__: string;
37
37
  };
38
38
  testEnvironmentOptions: {
@@ -1,4 +1,4 @@
1
1
  export const basePath: string;
2
- export function getAppConfig(): Buffer | "{}";
2
+ export function getAppConfig(): "{}" | Buffer<ArrayBufferLike>;
3
3
  export function isTypeScriptEnabled(): boolean;
4
4
  export function isApp(): boolean;
@@ -1,4 +1,4 @@
1
1
  export declare const basePath: string;
2
2
  export declare const isApp: () => boolean;
3
3
  export declare const isHttps: () => boolean;
4
- export declare const getAppConfig: () => Buffer | "{}";
4
+ export declare const getAppConfig: () => "{}" | Buffer<ArrayBufferLike>;