wirejs-scripts 1.0.3 → 2.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/bin.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  const process = require('process');
4
4
  const child_process = require('child_process');
@@ -6,7 +6,6 @@ const rimraf = require('rimraf');
6
6
  const fs = require('fs');
7
7
  const path = require('path');
8
8
 
9
- const exgratia = require('ex-gratia');
10
9
  const webpack = require('webpack');
11
10
  const webpackConfigure = require('./configs/webpack.config');
12
11
  const WebpackDevServer = require('webpack-dev-server');
@@ -45,7 +44,6 @@ async function compile(watch = false) {
45
44
  directory: path.join(CWD, 'dist')
46
45
  },
47
46
  open: true,
48
- port: 9999,
49
47
  }, compiler);
50
48
 
51
49
  console.log('Starting server...');
@@ -5,7 +5,6 @@ const { exec } = require('child_process');
5
5
  const process = require('process');
6
6
  const CopyWebpackPlugin = require('copy-webpack-plugin');
7
7
  const marked = require('marked');
8
- const { JSDOM } = require('jsdom');
9
8
 
10
9
  const CWD = process.cwd();
11
10
 
@@ -55,43 +54,6 @@ const CollectLayouts = {
55
54
  }
56
55
  };
57
56
 
58
- async function mermaid(text) {
59
- const tempbase = path.join(
60
- __dirname,
61
- `__mermaid_temp_${new Date().getTime()}`
62
- );
63
- const tempInput = `${tempbase}.txt`;
64
- const tempOutput = `${tempbase}.svg`;
65
- const pConfigPath = path.join(
66
- __dirname,
67
- 'puppeteer-config.json'
68
- );
69
-
70
- console.log(`writing ${tempInput} ...`);
71
- fs.writeFileSync(tempInput, text);
72
-
73
- await new Promise((resolve, reject) => {
74
- const cmd = `npm exec mmdc -- -i "${tempInput}" -o "${tempOutput}" -b transparent -p "${pConfigPath}"`;
75
- console.log(`executing ${cmd} ...`);
76
- exec(cmd, {cwd: __dirname}, (err, stdout, stderr) => {
77
- if (err || stderr) {
78
- console.log('failed', {err, stdout, stderr});
79
- reject(err);
80
- } else {
81
- console.log('succeeded', stdout);
82
- resolve();
83
- }
84
- });
85
- });
86
- console.log(`mermaid CLI done generating ${tempOutput}`);
87
-
88
- const svg = fs.readFileSync(tempOutput);
89
- fs.unlinkSync(tempInput)
90
- fs.unlinkSync(tempOutput);
91
-
92
- return svg;
93
- };
94
-
95
57
  const SSG = {
96
58
  transformer: async (content, _path) => {
97
59
  let _meta = {};
@@ -120,23 +82,7 @@ const SSG = {
120
82
  .replace(/(``+)/g, m => Array(m.length).fill('\\`').join(''))
121
83
  ;
122
84
  const bodyMarkdown = eval('`' + escapedMarkdown + '`');
123
- const prebody = marked(bodyMarkdown);
124
- const { window } = new JSDOM(prebody, { querySelectorAll: true });
125
-
126
- if (window && window.document && window.document.body) {
127
- await Promise.all(
128
- [...window.document.body
129
- .querySelectorAll('.language-mermaid')
130
- ].map(async mdNode => {
131
- const svg = await mermaid(mdNode.textContent);
132
- mdNode.parentNode.innerHTML = svg;
133
- })
134
- );
135
- body = window.document.body.innerHTML;
136
- } else {
137
- body = prebody;
138
- }
139
-
85
+ body = marked(bodyMarkdown);
140
86
  } else {
141
87
  body = eval('`' + content + '`');
142
88
  }
@@ -338,6 +284,11 @@ module.exports = (env, argv) => {
338
284
  fullySpecified: false
339
285
  }
340
286
  },
287
+ {
288
+ test: /\.md$/,
289
+ use: "raw-loader",
290
+ // use: path.resolve(__dirname, '../node_modules/raw-loader')
291
+ },
341
292
  {
342
293
  test: /\.tpl$/,
343
294
  use: "raw-loader",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wirejs-scripts",
3
- "version": "1.0.3",
3
+ "version": "2.0.1",
4
4
  "description": "Basic build and start commands for wirejs apps",
5
5
  "bin": {
6
6
  "wirejs-scripts": "./bin.js"
@@ -16,12 +16,10 @@
16
16
  },
17
17
  "homepage": "https://github.com/svidgen/wirejs-scripts#readme",
18
18
  "dependencies": {
19
- "@mermaid-js/mermaid-cli": "^9.0.0",
20
19
  "copy-webpack-plugin": "^10.2.4",
21
20
  "css-loader": "^5.2.0",
22
21
  "file-loader": "^6.2.0",
23
22
  "glob": "^7.2.0",
24
- "jsdom": "^16.5.2",
25
23
  "marked": "^2.0.1",
26
24
  "raw-loader": "^4.0.2",
27
25
  "rimraf": "^3.0.2",
@@ -29,7 +27,6 @@
29
27
  "webpack": "^5.28.0",
30
28
  "webpack-cli": "^4.6.0",
31
29
  "webpack-dev-server": "^4.8.1",
32
- "ex-gratia": "^1.0.3",
33
30
  "highlight.js": "^11.1.0",
34
31
  "wirejs-dom": "^1.0.4"
35
32
  }
@@ -1,3 +0,0 @@
1
- {
2
- "args": ["--no-sandbox"]
3
- }