remult 3.0.0 → 3.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.
@@ -36,7 +36,7 @@ export async function generateMigrations(options) {
36
36
  const code = {
37
37
  //https://marketplace.visualstudio.com/items?itemName=qufiwefefwoyn.inline-sql-syntax
38
38
  addSql: (sql) => {
39
- steps.push('await sql(`--sql\n' + sql + '`)');
39
+ steps.push('await sql(`--sql\n' + escapeForTpl(sql) + '`)');
40
40
  hasSql = true;
41
41
  },
42
42
  addTypescriptCode: (code) => steps.push(code),
@@ -66,3 +66,7 @@ export async function generateMigrations(options) {
66
66
  }
67
67
  return steps.length > 0;
68
68
  }
69
+ function escapeForTpl(str) {
70
+ // escape backticks, dollar-signs and backslashes
71
+ return str.replace(/[`\\$]/g, (m) => "\\" + m);
72
+ }
@@ -58,7 +58,7 @@ function generateMigrations(options) {
58
58
  code = {
59
59
  //https://marketplace.visualstudio.com/items?itemName=qufiwefefwoyn.inline-sql-syntax
60
60
  addSql: function (sql) {
61
- steps.push('await sql(`--sql\n' + sql + '`)');
61
+ steps.push('await sql(`--sql\n' + escapeForTpl(sql) + '`)');
62
62
  hasSql = true;
63
63
  },
64
64
  addTypescriptCode: function (code) { return steps.push(code); },
@@ -101,3 +101,7 @@ function generateMigrations(options) {
101
101
  });
102
102
  });
103
103
  }
104
+ function escapeForTpl(str) {
105
+ // escape backticks, dollar-signs and backslashes
106
+ return str.replace(/[`\\$]/g, function (m) { return "\\" + m; });
107
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remult",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "A CRUD framework for full-stack TypeScript",
5
5
  "homepage": "https://remult.dev",
6
6
  "repository": {