@silexlabs/silex 3.0.0-alpha.32 → 3.0.1-alpha.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.
@@ -1,32 +1,16 @@
1
1
  /*!
2
- * Sizzle CSS Selector Engine v2.3.10
3
- * https://sizzlejs.com/
4
- *
5
- * Copyright JS Foundation and other contributors
6
- * Released under the MIT license
7
- * https://js.foundation/
8
- *
9
- * Date: 2023-02-14
10
- */
11
-
12
- /*!
13
- * jQuery JavaScript Library v3.6.4
2
+ * jQuery JavaScript Library v3.7.0
14
3
  * https://jquery.com/
15
4
  *
16
- * Includes Sizzle.js
17
- * https://sizzlejs.com/
18
- *
19
5
  * Copyright OpenJS Foundation and other contributors
20
6
  * Released under the MIT license
21
7
  * https://jquery.org/license
22
8
  *
23
- * Date: 2023-03-08T15:28Z
9
+ * Date: 2023-05-11T18:29Z
24
10
  */
25
11
 
26
12
  /*! @silexlabs/grapesjs-loading - 1.0.8 */
27
13
 
28
- /*! grapesjs-style-filter - 1.0.1 */
29
-
30
14
  /**
31
15
  * @license
32
16
  * Copyright 2017 Google LLC
package/dist/types.js CHANGED
@@ -31,4 +31,4 @@ exports.defaultSite = {
31
31
  var Unit;
32
32
  (function (Unit) {
33
33
  Unit["PX"] = "px";
34
- })(Unit = exports.Unit || (exports.Unit = {}));
34
+ })(Unit || (exports.Unit = Unit = {}));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@silexlabs/silex",
3
3
  "description": "Free and easy website builder for everyone.",
4
- "version": "3.0.0-alpha.32",
4
+ "version": "3.0.1-alpha.0",
5
5
  "version:backwardcompat": "3.0.0",
6
6
  "author": {
7
7
  "name": "Alex Hoyau",
@@ -52,9 +52,9 @@
52
52
  "release": "",
53
53
  "watch": "npm-watch",
54
54
  "start": "node dist/server/index.js",
55
- "start:debug": "cross-env SILEX_DEBUG=true nodemon --watch dist/server dist/server/index.js",
56
- "prepublishOnly": "npm run lint && npm test && npm run build",
57
- "preversion": "npm run prepublishOnly",
55
+ "start:debug": "cross-env FS_ROOT=`pwd`/.silex cross-env SILEX_DEBUG=true nodemon --watch dist/server dist/server/index.js",
56
+ "prepublishOnly": "$npm_execpath run lint && $npm_execpath test && $npm_execpath run build",
57
+ "preversion": "$npm_execpath run prepublishOnly",
58
58
  "build": "run-s build:css:release build:html build:client:release build:server:release",
59
59
  "webpack": "webpack --config webpack.config.js",
60
60
  "build:css:release": "sass --load-path ../../node_modules --load-path node_modules --no-source-map src/css/index.scss dist/client/css/admin.css",
@@ -66,67 +66,67 @@
66
66
  "build:server:release": "tsc -p tsconfig-server-release.json",
67
67
  "build:server:debug": "SILEX_DEBUG=true tsc -p tsconfig-server-debug.json",
68
68
  "lint": "eslint 'src/ts/**/*.ts'",
69
- "lint:fix": "npm run lint -- --fix",
69
+ "lint:fix": "$npm_execpath run lint -- --fix",
70
70
  "test": "node --experimental-vm-modules `node_modules jest`/jest/bin/jest.js",
71
- "test:watch": "npm test -- --watch"
71
+ "test:watch": "$npm_execpath test -- --watch"
72
72
  },
73
73
  "dependencies": {
74
- "@directus/sdk": "^10.3.3",
74
+ "@directus/sdk": "10.3.3",
75
75
  "@silexlabs/grapesjs-directus-storage": "1.0.15",
76
76
  "@silexlabs/grapesjs-fonts": "1.0.12",
77
77
  "@silexlabs/grapesjs-loading": "1.0.8",
78
- "@silexlabs/grapesjs-symbols": "1.0.18",
78
+ "@silexlabs/grapesjs-symbols": "1.0.20",
79
79
  "@silexlabs/grapesjs-ui-suggest-classes": "1.0.23",
80
- "@silexlabs/silex-plugins": "^1.0.10",
80
+ "@silexlabs/silex-plugins": "1.0.10",
81
81
  "adm-zip": "0.5.10",
82
82
  "body-parser": "1.20.2",
83
- "cli": "^1.0.1",
83
+ "cli": "1.0.1",
84
84
  "compression": "1.7.4",
85
85
  "cookie-parser": "1.4.6",
86
86
  "cookie-session": "2.0.0",
87
- "cors": "^2.8.5",
87
+ "cors": "2.8.5",
88
88
  "cross-env": "7.0.3",
89
89
  "express": "4.18.2",
90
90
  "express-force-ssl": "0.3.2",
91
91
  "formidable": "2.1.1",
92
92
  "grapesjs": "0.21.2",
93
- "grapesjs-blocks-basic": "1.0.1",
94
- "grapesjs-custom-code": "1.0.1",
95
- "grapesjs-plugin-forms": "2.0.5",
96
- "grapesjs-style-filter": "1.0.1",
97
- "html-minifier": "^4.0.0",
98
- "lit-html": "2.7.2",
93
+ "grapesjs-blocks-basic": "1.0.2",
94
+ "grapesjs-custom-code": "1.0.2",
95
+ "grapesjs-plugin-forms": "2.0.6",
96
+ "grapesjs-style-filter": "1.0.2",
97
+ "html-minifier": "4.0.0",
98
+ "lit-html": "2.7.4",
99
99
  "mkdirp": "3.0.1",
100
100
  "node_modules-path": "2.0.7",
101
- "node-fetch": "^2.6.9",
101
+ "node-fetch": "2.6.9",
102
102
  "normalize.css": "8.0.1",
103
103
  "object-path": "0.11.8",
104
104
  "promise-sequential": "1.1.1",
105
- "sass": "1.62.0",
105
+ "sass": "1.63.6",
106
106
  "serve-static": "1.15.0"
107
107
  },
108
108
  "devDependencies": {
109
109
  "@types/express": "4.17.17",
110
- "@types/jest": "29.5.1",
111
- "@types/node": "18.16.0",
112
- "@typescript-eslint/eslint-plugin": "^5.59.1",
113
- "@typescript-eslint/parser": "^5.59.1",
114
- "css-loader": "6.7.3",
115
- "eslint": "8.39.0",
110
+ "@types/jest": "29.5.2",
111
+ "@types/node": "20.3.1",
112
+ "@typescript-eslint/eslint-plugin": "5.60.0",
113
+ "@typescript-eslint/parser": "5.60.0",
114
+ "css-loader": "6.8.1",
115
+ "eslint": "8.43.0",
116
116
  "file-loader": "6.2.0",
117
117
  "jest": "29.5.0",
118
- "jest-environment-jsdom": "^29.5.0",
119
- "livereload": "^0.9.3",
118
+ "jest-environment-jsdom": "29.5.0",
119
+ "livereload": "0.9.3",
120
120
  "nodemon": "2.0.22",
121
121
  "npm-run-all": "4.1.5",
122
122
  "npm-watch": "0.11.0",
123
123
  "pug-cli": "1.0.0-alpha6",
124
- "style-loader": "3.3.2",
125
- "ts-jest": "^29.1.0",
126
- "ts-loader": "9.4.2",
127
- "typescript": "5.0.4",
128
- "webpack": "5.80.0",
129
- "webpack-cli": "5.0.2"
124
+ "style-loader": "3.3.3",
125
+ "ts-jest": "29.1.0",
126
+ "ts-loader": "9.4.3",
127
+ "typescript": "5.1.3",
128
+ "webpack": "5.88.0",
129
+ "webpack-cli": "5.1.4"
130
130
  },
131
131
  "repository": {
132
132
  "type": "git",
@@ -52,17 +52,38 @@ exports.del = async function (id) {
52
52
 
53
53
  // List projects
54
54
  exports.list = async function () {
55
- const ids = await readdir(FS_ROOT)
56
- return Promise.all(ids.map(async id => ({
57
- id,
58
- ...await exports.readData(id),
59
- stats: await stat(path(id) + DATA_FILE_NAME),
60
- })))
55
+ try {
56
+ const ids = await readdir(FS_ROOT)
57
+ return Promise.all(ids.map(async id => ({
58
+ id,
59
+ ...await exports.readData(id),
60
+ stats: await stat(path(id) + DATA_FILE_NAME),
61
+ })))
62
+ } catch (error) {
63
+ if (error.code === 'ENOENT') {
64
+ console.log(`\nError: Directory ${FS_ROOT} does not exist.\nIf your want to read from a different folder ues the FS_ROOT environment variable or --fs-root command line argument?\n`);
65
+ const betterError = new Error(`The directory ${FS_ROOT} does not exist`)
66
+ betterError.code = 'ENOENT'
67
+ throw betterError
68
+ }
69
+ throw error
70
+ }
61
71
  }
62
72
  // Read project data
63
73
  exports.readData = async function (id) {
64
- const data = await readFile(path(id) + DATA_FILE_NAME)
65
- return JSON.parse(data.toString())
74
+ const filePath = path(id) + DATA_FILE_NAME
75
+ try {
76
+ const data = await readFile(filePath)
77
+ return JSON.parse(data.toString())
78
+ } catch (error) {
79
+ if (error.code === 'ENOENT') {
80
+ console.log(`\nError: File ${filePath} or directory ${FS_ROOT} do not exist.\nIf your want to read from a different folder use the FS_ROOT environment variable or --fs-root command line argument?\n`);
81
+ const betterError = new Error(`The website ${id} does not exist`)
82
+ betterError.code = 'ENOENT'
83
+ throw betterError
84
+ }
85
+ throw error
86
+ }
66
87
  }
67
88
  // Write project data
68
89
  exports.writeData = async function (id, data) {
@@ -1,4 +1,4 @@
1
- import grapesjs, { EditorConfig } from 'grapesjs'
1
+ import grapesjs from 'grapesjs'
2
2
  import openImport from './openImport'
3
3
 
4
4
  /**
@@ -14,7 +14,7 @@ import styleFilterPlugin from 'grapesjs-style-filter'
14
14
  import formPlugin from 'grapesjs-plugin-forms'
15
15
  import codePlugin from 'grapesjs-custom-code'
16
16
  import uiSuggestClasses from '@silexlabs/grapesjs-ui-suggest-classes'
17
- import symbolsPlugin from '@silexlabs/grapesjs-symbols'
17
+ import * as symbolsPlugin from '@silexlabs/grapesjs-symbols' // Why is this not working without *?
18
18
  import loadingPlugin from '@silexlabs/grapesjs-loading'
19
19
  import fontsDialogPlugin, { cmdOpenFonts } from '@silexlabs/grapesjs-fonts'
20
20
  import symbolDialogsPlugin, { cmdPromptAddSymbol } from './symbolDialogs'
@@ -212,7 +212,7 @@ export function getEditorConfig(id: string, rootUrl: string) {
212
212
  // Keep a ref to the editor singleton
213
213
  let editor
214
214
 
215
- export function initEditor(config: EditorConfig, grapesJsPlugins) {
215
+ export function initEditor(config, grapesJsPlugins) {
216
216
  if(editor) throw new Error('Grapesjs editor already created')
217
217
 
218
218
  editor = grapesjs.init({
@@ -258,15 +258,19 @@ export function initEditor(config: EditorConfig, grapesJsPlugins) {
258
258
  editor.StyleManager.addProperty('extra',{ extend: 'filter' })
259
259
  })
260
260
 
261
- editor.StorageManager.onError = (type: string, err: Error) => {
262
- editor.Modal.open(type === 'load' ? {
261
+ // Handle errors
262
+ editor.on('storage:error:load', (err) => {
263
+ editor.Modal.open({
263
264
  title: 'Error loading website',
264
- content: `This website could not be loaded.<br><hr>Error: ${err.message}`,
265
- } : {
265
+ content: `This website could not be loaded.<br><hr>${err}`,
266
+ })
267
+ })
268
+ editor.on('storage:error:store', (err) => {
269
+ editor.Modal.open({
266
270
  title: 'Error saving website',
267
- content: `This website could not be saved.<br><hr>Error: ${err.message}`,
271
+ content: `This website could not be saved.<br><hr>${err}`,
268
272
  })
269
- }
273
+ })
270
274
  }
271
275
 
272
276
  export function getEditor() {
@@ -3,7 +3,6 @@
3
3
  "compilerOptions": {
4
4
  "outDir": "dist/",
5
5
  "target": "esnext",
6
- "watch": false,
7
6
  "inlineSourceMap": true,
8
7
  "module": "CommonJS",
9
8
  "removeComments": false,
@@ -3,7 +3,6 @@
3
3
  "compilerOptions": {
4
4
  "outDir": "dist/",
5
5
  "target": "esnext",
6
- "watch": false,
7
6
  "sourceMap": false,
8
7
  "module": "CommonJS",
9
8
  "removeComments": true,
package/tsconfig.json CHANGED
@@ -3,7 +3,6 @@
3
3
  "compilerOptions": {
4
4
  "outDir": "dist/client/",
5
5
  "target": "ESNext",
6
- "watch": true,
7
6
  "sourceMap": true,
8
7
  "module": "ESNext",
9
8
  "removeComments": false,