@daisy/ace-axe-runner-electron 1.2.6-alpha.4 → 1.2.7-alpha.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.
Files changed (3) hide show
  1. package/lib/init.js +30 -26
  2. package/package.json +5 -5
  3. package/src/init.js +12 -8
package/lib/init.js CHANGED
@@ -156,6 +156,7 @@ const streamProtocolHandler = async (req, callback) => {
156
156
 
157
157
  const buff = Buffer.from("<html><body><p>Internal Server Error</p><p>!_streamProtocolHandler</p></body></html>");
158
158
  headers["Content-Length"] = buff.length.toString();
159
+ headers["Content-Type"] = "text/html";
159
160
  callback({
160
161
  data: bufferToStream(buff),
161
162
  headers,
@@ -837,20 +838,21 @@ function startAxeServer(basedir, scripts, scriptContents) {
837
838
  let fileSystemPath = path.join(basedir, pn);
838
839
  if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} filepath to read: ${fileSystemPath}`);
839
840
  if (!fs.existsSync(fileSystemPath)) {
840
- fileSystemPath = pn;
841
- if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} filepath to read (corrected): ${fileSystemPath}`);
842
- if (!fs.existsSync(fileSystemPath)) {
843
- if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} FILE DOES NOT EXIST!! ${fileSystemPath}`);
841
+ // fileSystemPath = pn;
842
+ // if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} filepath to read (corrected): ${fileSystemPath}`);
843
+ // if (!fs.existsSync(fileSystemPath)) {
844
+ if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} FILE DOES NOT EXIST!! ${fileSystemPath}`);
844
845
 
845
- const buff = Buffer.from(`<html><body><p>Internal Server Error</p><p>404?! ${fileSystemPath}</p></body></html>`);
846
- headers["Content-Length"] = buff.length.toString();
847
- callback({
848
- data: bufferToStream(buff),
849
- headers,
850
- statusCode: 404
851
- });
852
- return;
853
- }
846
+ const buff = Buffer.from(`<html><body><p>Internal Server Error</p><p>404?! ${fileSystemPath}</p></body></html>`);
847
+ headers["Content-Length"] = buff.length.toString();
848
+ headers["Content-Type"] = "text/html";
849
+ callback({
850
+ data: bufferToStream(buff),
851
+ headers,
852
+ statusCode: 404
853
+ });
854
+ return;
855
+ // }
854
856
  }
855
857
 
856
858
  // let html = fs.readFileSync(fileSystemPath, { encoding: "utf8" });
@@ -911,20 +913,21 @@ function startAxeServer(basedir, scripts, scriptContents) {
911
913
  let fileSystemPath = path.join(basedir, pn);
912
914
  if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} --filepath to read: ${fileSystemPath}`);
913
915
  if (!fs.existsSync(fileSystemPath)) {
914
- fileSystemPath = pn;
915
- if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} --filepath to read (corrected): ${fileSystemPath}`);
916
- if (!fs.existsSync(fileSystemPath)) {
917
- if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} --FILE DOES NOT EXIST!! ${fileSystemPath}`);
916
+ // fileSystemPath = pn;
917
+ // if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} --filepath to read (corrected): ${fileSystemPath}`);
918
+ // if (!fs.existsSync(fileSystemPath)) {
919
+ if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} --FILE DOES NOT EXIST!! ${fileSystemPath}`);
918
920
 
919
- const buff = Buffer.from(`<html><body><p>Internal Server Error</p><p>404?! ${fileSystemPath}</p></body></html>`);
920
- headers["Content-Length"] = buff.length.toString();
921
- callback({
922
- data: bufferToStream(buff),
923
- headers,
924
- statusCode: 404
925
- });
926
- return;
927
- }
921
+ const buff = Buffer.from(`<html><body><p>Internal Server Error</p><p>404?! ${fileSystemPath}</p></body></html>`);
922
+ headers["Content-Length"] = buff.length.toString();
923
+ headers["Content-Type"] = "text/html";
924
+ callback({
925
+ data: bufferToStream(buff),
926
+ headers,
927
+ statusCode: 404
928
+ });
929
+ return;
930
+ // }
928
931
  }
929
932
  try {
930
933
  let mediaType = mime.lookup(fileSystemPath) || "stream/octet";
@@ -944,6 +947,7 @@ function startAxeServer(basedir, scripts, scriptContents) {
944
947
 
945
948
  const buff = Buffer.from(`<html><body><p>Internal Server Error</p><p>fsErr: ${fsErr}</p></body></html>`);
946
949
  headers["Content-Length"] = buff.length.toString();
950
+ headers["Content-Type"] = "text/html";
947
951
  callback({
948
952
  data: bufferToStream(buff),
949
953
  headers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daisy/ace-axe-runner-electron",
3
- "version": "1.2.6-alpha.4",
3
+ "version": "1.2.7-alpha.1",
4
4
  "engines": {
5
5
  "node": ">=12.0.0",
6
6
  "yarn": "^1.22.0",
@@ -23,14 +23,14 @@
23
23
  "license": "MIT",
24
24
  "main": "lib/index.js",
25
25
  "dependencies": {
26
- "@daisy/ace-cli-shared": "^1.2.6-alpha.4",
27
- "mime-types": "^2.1.34",
26
+ "@daisy/ace-cli-shared": "^1.2.7-alpha.1",
27
+ "mime-types": "^2.1.35",
28
28
  "uuid": "^8.3.2"
29
29
  },
30
30
  "devDependencies": {
31
- "electron": "^17.0.0",
31
+ "electron": "^18.0.1",
32
32
  "json": "^11.0.0",
33
- "json-diff": "^0.7.1"
33
+ "json-diff": "^0.7.3"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"
package/src/init.js CHANGED
@@ -160,6 +160,7 @@ const streamProtocolHandler = async (
160
160
 
161
161
  const buff = Buffer.from("<html><body><p>Internal Server Error</p><p>!_streamProtocolHandler</p></body></html>");
162
162
  headers["Content-Length"] = buff.length.toString();
163
+ headers["Content-Type"] = "text/html";
163
164
  callback({
164
165
  data: bufferToStream(buff),
165
166
  headers,
@@ -864,20 +865,21 @@ function startAxeServer(basedir, scripts, scriptContents) {
864
865
  let fileSystemPath = path.join(basedir, pn);
865
866
  if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} filepath to read: ${fileSystemPath}`);
866
867
  if (!fs.existsSync(fileSystemPath)) {
867
- fileSystemPath = pn;
868
- if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} filepath to read (corrected): ${fileSystemPath}`);
869
- if (!fs.existsSync(fileSystemPath)) {
868
+ // fileSystemPath = pn;
869
+ // if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} filepath to read (corrected): ${fileSystemPath}`);
870
+ // if (!fs.existsSync(fileSystemPath)) {
870
871
  if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} FILE DOES NOT EXIST!! ${fileSystemPath}`);
871
872
 
872
873
  const buff = Buffer.from(`<html><body><p>Internal Server Error</p><p>404?! ${fileSystemPath}</p></body></html>`);
873
874
  headers["Content-Length"] = buff.length.toString();
875
+ headers["Content-Type"] = "text/html";
874
876
  callback({
875
877
  data: bufferToStream(buff),
876
878
  headers,
877
879
  statusCode: 404,
878
880
  });
879
881
  return;
880
- }
882
+ // }
881
883
  }
882
884
 
883
885
  // let html = fs.readFileSync(fileSystemPath, { encoding: "utf8" });
@@ -938,20 +940,21 @@ function startAxeServer(basedir, scripts, scriptContents) {
938
940
  let fileSystemPath = path.join(basedir, pn);
939
941
  if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} --filepath to read: ${fileSystemPath}`);
940
942
  if (!fs.existsSync(fileSystemPath)) {
941
- fileSystemPath = pn;
942
- if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} --filepath to read (corrected): ${fileSystemPath}`);
943
- if (!fs.existsSync(fileSystemPath)) {
943
+ // fileSystemPath = pn;
944
+ // if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} --filepath to read (corrected): ${fileSystemPath}`);
945
+ // if (!fs.existsSync(fileSystemPath)) {
944
946
  if (LOG_DEBUG) console.log(`${ACE_LOG_PREFIX} --FILE DOES NOT EXIST!! ${fileSystemPath}`);
945
947
 
946
948
  const buff = Buffer.from(`<html><body><p>Internal Server Error</p><p>404?! ${fileSystemPath}</p></body></html>`);
947
949
  headers["Content-Length"] = buff.length.toString();
950
+ headers["Content-Type"] = "text/html";
948
951
  callback({
949
952
  data: bufferToStream(buff),
950
953
  headers,
951
954
  statusCode: 404,
952
955
  });
953
956
  return;
954
- }
957
+ // }
955
958
  }
956
959
  try {
957
960
  let mediaType = mime.lookup(fileSystemPath) || "stream/octet";
@@ -971,6 +974,7 @@ function startAxeServer(basedir, scripts, scriptContents) {
971
974
 
972
975
  const buff = Buffer.from(`<html><body><p>Internal Server Error</p><p>fsErr: ${fsErr}</p></body></html>`);
973
976
  headers["Content-Length"] = buff.length.toString();
977
+ headers["Content-Type"] = "text/html";
974
978
  callback({
975
979
  data: bufferToStream(buff),
976
980
  headers,