@canopy-iiif/app 1.8.5 → 1.8.7

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/lib/build/dev.js CHANGED
@@ -23,11 +23,6 @@ const APP_COMPONENTS_DIR = path.join(process.cwd(), "app", "components");
23
23
 
24
24
  function resolveTailwindCli() {
25
25
  const root = process.cwd();
26
- const binName = process.platform === "win32" ? "tailwindcss.cmd" : "tailwindcss";
27
- const bin = path.join(root, "node_modules", ".bin", binName);
28
- if (fs.existsSync(bin)) {
29
- return { cmd: bin, args: [] };
30
- }
31
26
  let cliEntry = null;
32
27
  try {
33
28
  cliEntry = require.resolve("@tailwindcss/cli/dist/index.mjs", { paths: [root] });
@@ -37,6 +32,9 @@ function resolveTailwindCli() {
37
32
  if (cliEntry) {
38
33
  return { cmd: process.execPath || "node", args: [cliEntry] };
39
34
  }
35
+ const binName = process.platform === "win32" ? "tailwindcss.cmd" : "tailwindcss";
36
+ const bin = path.join(root, "node_modules", ".bin", binName);
37
+ if (fs.existsSync(bin)) return { cmd: bin, args: [] };
40
38
  return null;
41
39
  }
42
40
  const PORT = Number(process.env.PORT || 5001);
@@ -976,13 +974,16 @@ async function dev() {
976
974
  }
977
975
  };
978
976
 
979
- const tailwindCmd = (args = []) => {
980
- const parts = [cli.cmd];
981
- if (Array.isArray(cli.args) && cli.args.length) parts.push(...cli.args);
982
- if (Array.isArray(args) && args.length) parts.push(...args);
983
- return parts.filter(Boolean).join(" ");
977
+ const tailwindArgVector = (args = []) => {
978
+ const vector = [];
979
+ if (cli.cmd) vector.push(cli.cmd);
980
+ if (Array.isArray(cli.args) && cli.args.length) vector.push(...cli.args);
981
+ if (Array.isArray(args) && args.length) vector.push(...args);
982
+ return vector;
984
983
  };
985
984
 
985
+ const tailwindCmd = (args = []) => tailwindArgVector(args).join(" ");
986
+
986
987
  const formatSpawnOutput = (result) => {
987
988
  if (!result) return "";
988
989
  const messages = [];
@@ -1004,6 +1005,28 @@ async function dev() {
1004
1005
  ` config: ${configPath ? prettyPath(configPath) : "<unknown>"}`,
1005
1006
  ` cli: ${tailwindCmd(args)}`,
1006
1007
  ];
1008
+ if (result && typeof result.status === "number") {
1009
+ details.push(` exitCode: ${result.status}`);
1010
+ }
1011
+ if (result && result.error) {
1012
+ const err = result.error;
1013
+ details.push(
1014
+ ` spawnError: ${err && err.message ? err.message : String(err)}`
1015
+ );
1016
+ }
1017
+ if (result && result.signal) {
1018
+ details.push(` signal: ${result.signal}`);
1019
+ }
1020
+ const extraArgs = tailwindArgVector(args)
1021
+ .map((part) => {
1022
+ if (!part || typeof part !== "string") return part;
1023
+ if (part.includes("\n")) return part.replace(/\n/g, "\\n");
1024
+ return part;
1025
+ })
1026
+ .join(" ");
1027
+ if (extraArgs && extraArgs !== tailwindCmd(args)) {
1028
+ details.push(` cliRaw: ${extraArgs}`);
1029
+ }
1007
1030
  const extra = formatSpawnOutput(result);
1008
1031
  if (extra) {
1009
1032
  details.push(
@@ -1026,10 +1049,12 @@ async function dev() {
1026
1049
  "--minify",
1027
1050
  ];
1028
1051
 
1029
- const initial = spawnSync(cli.cmd, [...cli.args, ...baseArgs], {
1052
+ const spawnOptions = {
1030
1053
  stdio: ["ignore", "pipe", "pipe"],
1031
1054
  env: { ...process.env, BROWSERSLIST_IGNORE_OLD_DATA: "1" },
1032
- });
1055
+ };
1056
+
1057
+ const initial = spawnSync(cli.cmd, [...cli.args, ...baseArgs], spawnOptions);
1033
1058
  if (!initial || initial.status !== 0) {
1034
1059
  throw new Error(
1035
1060
  tailwindFailureMessage(
@@ -1083,10 +1108,7 @@ async function dev() {
1083
1108
  }
1084
1109
 
1085
1110
  function compileTailwindOnce() {
1086
- const res = spawnSync(cli.cmd, [...cli.args, ...baseArgs], {
1087
- stdio: ["ignore", "pipe", "pipe"],
1088
- env: { ...process.env, BROWSERSLIST_IGNORE_OLD_DATA: "1" },
1089
- });
1111
+ const res = spawnSync(cli.cmd, [...cli.args, ...baseArgs], spawnOptions);
1090
1112
  if (!res || res.status !== 0) {
1091
1113
  throw new Error(
1092
1114
  tailwindFailureMessage(
@@ -9,11 +9,6 @@ const {
9
9
 
10
10
  function resolveTailwindCli() {
11
11
  const root = process.cwd();
12
- const binName = process.platform === "win32" ? "tailwindcss.cmd" : "tailwindcss";
13
- const localBin = path.join(root, "node_modules", ".bin", binName);
14
- if (fs.existsSync(localBin)) {
15
- return {cmd: localBin, args: []};
16
- }
17
12
  let cliEntry = null;
18
13
  try {
19
14
  cliEntry = require.resolve("@tailwindcss/cli/dist/index.mjs", { paths: [root] });
@@ -23,6 +18,9 @@ function resolveTailwindCli() {
23
18
  if (cliEntry) {
24
19
  return {cmd: process.execPath || "node", args: [cliEntry]};
25
20
  }
21
+ const binName = process.platform === "win32" ? "tailwindcss.cmd" : "tailwindcss";
22
+ const localBin = path.join(root, "node_modules", ".bin", binName);
23
+ if (fs.existsSync(localBin)) return {cmd: localBin, args: []};
26
24
  return null;
27
25
  }
28
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canopy-iiif/app",
3
- "version": "1.8.5",
3
+ "version": "1.8.7",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "Mat Jordan <mat@northwestern.edu>",