@signageos/front-applet 7.0.0 → 7.1.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/es6/fpath.d.ts ADDED
@@ -0,0 +1,89 @@
1
+ import * as path from 'path-browserify';
2
+ import { IFilePath } from './FrontApplet/FileSystem/types';
3
+ /**
4
+ * fpath utility mirrors node path module, but accepts IFilePath type instead of strings.
5
+ *
6
+ * Not implemented functions:
7
+ * - format
8
+ * - matchesGlob
9
+ * - parse
10
+ * - relative
11
+ */
12
+ export declare const fpath: {
13
+ /**
14
+ * Return the last portion of path, since it is not a valid path, a string is returned.
15
+ *
16
+ * @example
17
+ * const path = { filePath: "images/picture.png", storageUnit: ... };
18
+ * fpath.basename(path); // "picture.png"
19
+ */
20
+ basename(filePath: IFilePath, suffix?: string | undefined): string;
21
+ /**
22
+ * Removes the last portion of path, returning the parent directory of the path. Ignores trailing slashes
23
+ *
24
+ * @example
25
+ * const path = { filePath: "images/picture.png", storageUnit: ... };
26
+ * fpath.dirname(path); // { filePath: "images", storageUnit: ... }
27
+ */
28
+ dirname(filePath: IFilePath): IFilePath;
29
+ /**
30
+ * Returns extension of the path, from the last period, including the period.
31
+ *
32
+ * @example
33
+ * const path = { filePath: "images/picture.png", storageUnit: ... };
34
+ * fpath.dirname(path); // .png
35
+ */
36
+ extname(filePath: IFilePath): string;
37
+ /**
38
+ * Always returns true, because all file paths are absolute
39
+ */
40
+ isAbsolute(_: IFilePath): boolean;
41
+ /**
42
+ * Returns new filePath with paths appended to it and normalized (resolved . and ..)
43
+ *
44
+ * @example
45
+ * const path = { filePath: "images", storageUnit: ... };
46
+ * fpath.join(path, "racoons", ".", "picture.png"); // { filePath: "images/racoons/picture.png", storageUnit: ... }
47
+ */
48
+ join(filePath: IFilePath, ...paths: string[]): IFilePath;
49
+ /**
50
+ * Similar to fpath.join, but resulting path will always be subdirectory of base
51
+ *
52
+ * @example
53
+ * const path = { filePath: "uploads/userA", storageUnit: ... };
54
+ * fpath.safeJoin(path, "..", "userB", "picture.png"); // { filePath: "uploads/userA/userB/picture.png", storageUnit: ... }
55
+ */
56
+ safeJoin(base: IFilePath, ...paths: string[]): IFilePath;
57
+ /**
58
+ * Resolves . and .. in the path and removes multiple slashes
59
+ *
60
+ * @example
61
+ * const path = { filePath: "images//test/../test2/./", storageUnit: ... };
62
+ * fpath.normalize(path); // { filePath: "images/test2/", storageUnit: ... }
63
+ */
64
+ normalize(filePath: IFilePath): IFilePath;
65
+ /**
66
+ * Same as fpath.join()
67
+ */
68
+ resolve(filePath: IFilePath, ...paths: string[]): IFilePath;
69
+ /**
70
+ * Separator used for joining path segments
71
+ */
72
+ sep: string;
73
+ /**
74
+ * Concatenate fp with paths without adding separator
75
+ *
76
+ * @example
77
+ * const path = { filePath: "uploads/archive.tar", storageUnit: ... };
78
+ * fpath.concat(path, "_extracted"); // { filePath: "uploads/archive.tar_extracted", storageUnit: ... }
79
+ */
80
+ concat(filePath: IFilePath, ...paths: string[]): IFilePath;
81
+ /**
82
+ * Convert filePath to string, this string is not guaranteed to be unique and should be only used for debugging/logging
83
+ */
84
+ stringify(filePath: IFilePath): string;
85
+ /**
86
+ * Underlying path polyfill
87
+ */
88
+ path: path.Path;
89
+ };
package/es6/fpath.js ADDED
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fpath = void 0;
4
+ const path = require("path-browserify");
5
+ /**
6
+ * fpath utility mirrors node path module, but accepts IFilePath type instead of strings.
7
+ *
8
+ * Not implemented functions:
9
+ * - format
10
+ * - matchesGlob
11
+ * - parse
12
+ * - relative
13
+ */
14
+ exports.fpath = {
15
+ /**
16
+ * Return the last portion of path, since it is not a valid path, a string is returned.
17
+ *
18
+ * @example
19
+ * const path = { filePath: "images/picture.png", storageUnit: ... };
20
+ * fpath.basename(path); // "picture.png"
21
+ */
22
+ basename(filePath, suffix) {
23
+ return path.basename(filePath.filePath, suffix);
24
+ },
25
+ /**
26
+ * Removes the last portion of path, returning the parent directory of the path. Ignores trailing slashes
27
+ *
28
+ * @example
29
+ * const path = { filePath: "images/picture.png", storageUnit: ... };
30
+ * fpath.dirname(path); // { filePath: "images", storageUnit: ... }
31
+ */
32
+ dirname(filePath) {
33
+ let parentPath = path.dirname(filePath.filePath);
34
+ if (parentPath === '.') {
35
+ // The top level file dirname is ".", but sos accepts empty string "" for root
36
+ parentPath = '';
37
+ }
38
+ return {
39
+ filePath: parentPath,
40
+ storageUnit: filePath.storageUnit,
41
+ };
42
+ },
43
+ /**
44
+ * Returns extension of the path, from the last period, including the period.
45
+ *
46
+ * @example
47
+ * const path = { filePath: "images/picture.png", storageUnit: ... };
48
+ * fpath.dirname(path); // .png
49
+ */
50
+ extname(filePath) {
51
+ return path.extname(filePath.filePath);
52
+ },
53
+ /**
54
+ * Always returns true, because all file paths are absolute
55
+ */
56
+ isAbsolute(_) {
57
+ return true;
58
+ },
59
+ /**
60
+ * Returns new filePath with paths appended to it and normalized (resolved . and ..)
61
+ *
62
+ * @example
63
+ * const path = { filePath: "images", storageUnit: ... };
64
+ * fpath.join(path, "racoons", ".", "picture.png"); // { filePath: "images/racoons/picture.png", storageUnit: ... }
65
+ */
66
+ join(filePath, ...paths) {
67
+ return {
68
+ filePath: path.join(filePath.filePath, ...paths),
69
+ storageUnit: filePath.storageUnit,
70
+ };
71
+ },
72
+ /**
73
+ * Similar to fpath.join, but resulting path will always be subdirectory of base
74
+ *
75
+ * @example
76
+ * const path = { filePath: "uploads/userA", storageUnit: ... };
77
+ * fpath.safeJoin(path, "..", "userB", "picture.png"); // { filePath: "uploads/userA/userB/picture.png", storageUnit: ... }
78
+ */
79
+ safeJoin(base, ...paths) {
80
+ return {
81
+ filePath: base.filePath + path.resolve('/', ...paths),
82
+ storageUnit: base.storageUnit,
83
+ };
84
+ },
85
+ /**
86
+ * Resolves . and .. in the path and removes multiple slashes
87
+ *
88
+ * @example
89
+ * const path = { filePath: "images//test/../test2/./", storageUnit: ... };
90
+ * fpath.normalize(path); // { filePath: "images/test2/", storageUnit: ... }
91
+ */
92
+ normalize(filePath) {
93
+ return {
94
+ filePath: path.normalize(filePath.filePath),
95
+ storageUnit: filePath.storageUnit,
96
+ };
97
+ },
98
+ /**
99
+ * Same as fpath.join()
100
+ */
101
+ resolve(filePath, ...paths) {
102
+ return exports.fpath.join(filePath, ...paths);
103
+ },
104
+ /**
105
+ * Separator used for joining path segments
106
+ */
107
+ sep: path.sep,
108
+ /**
109
+ * Concatenate fp with paths without adding separator
110
+ *
111
+ * @example
112
+ * const path = { filePath: "uploads/archive.tar", storageUnit: ... };
113
+ * fpath.concat(path, "_extracted"); // { filePath: "uploads/archive.tar_extracted", storageUnit: ... }
114
+ */
115
+ concat(filePath, ...paths) {
116
+ return {
117
+ filePath: filePath.filePath.concat(...paths),
118
+ storageUnit: filePath.storageUnit,
119
+ };
120
+ },
121
+ /**
122
+ * Convert filePath to string, this string is not guaranteed to be unique and should be only used for debugging/logging
123
+ */
124
+ stringify(filePath) {
125
+ return path.join(`[${filePath.storageUnit.type}]`, filePath.filePath);
126
+ },
127
+ /**
128
+ * Underlying path polyfill
129
+ */
130
+ path,
131
+ };
132
+ //# sourceMappingURL=fpath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fpath.js","sourceRoot":"","sources":["../src/fpath.ts"],"names":[],"mappings":";;;AAAA,wCAAwC;AAGxC;;;;;;;;GAQG;AACU,QAAA,KAAK,GAAG;IACpB;;;;;;OAMG;IACH,QAAQ,CAAC,QAAmB,EAAE,MAAe;QAC5C,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;OAMG;IACH,OAAO,CAAC,QAAmB;QAC1B,IAAI,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACjD,IAAI,UAAU,KAAK,GAAG,EAAE;YACvB,8EAA8E;YA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E,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;YAC5C,WAAW,EAAE,QAAQ,CAAC,WAAW;SACjC,CAAC;IACH,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,QAAmB;QAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,WAAW,CAAC,IAAI,GAAG,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACvE,CAAC;IAED;;OAEG;IACH,IAAI;CACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signageos/front-applet",
3
- "version": "7.0.0",
3
+ "version": "7.1.1",
4
4
  "main": "dist/bundle.js",
5
5
  "types": "es6/bundle.d.ts",
6
6
  "files": [
@@ -20,13 +20,13 @@
20
20
  "lint:prettier:fix": "prettier \"**/*.+(ts|tsx|json|js)\" --write",
21
21
  "lint:staged": "npx lint-staged",
22
22
  "prebuild": "rm -rf dist/*",
23
- "prepare": "npm run build && npm run generate-declarations && npx husky install",
23
+ "clean-build": "npm run build && npm run generate-declarations && npx husky install",
24
24
  "test": "env NODE_ENV=test ./node_modules/mocha/bin/mocha --config .mocha/default.js",
25
25
  "test:coverage": "npm run test:coverage:runtime && npm run test:coverage:types",
26
26
  "test:coverage:runtime": "env NODE_ENV=test c8 ./node_modules/mocha/bin/mocha --config .mocha/transpile-only.js",
27
27
  "test:coverage:types": "tsc --noEmit -p tsconfig.json",
28
28
  "escheck": "es-check --module es5 dist/*.js",
29
- "check": "npm run depcheck && npx --userconfig ./.npmrc @signageos/lib check-deps '.+' 'weinre'",
29
+ "check": "npm run depcheck && npx --userconfig ./.npmrc @signageos/lib check-deps",
30
30
  "depcheck": "depcheck --specials=tslint,webpack,mocha --parsers='*.ts:typescript,*.js:es6' --detectors='requireCallExpression,importDeclaration' --ignore-dirs='dist,packages' --ignores='@types/*,@signageos/codestyle,ts-node,source-map-support,mocha,depcheck,webpack-cli,@babel/polyfill,@babel/preset-env,es-check,debug,husky,lint-staged,c8,should-sinon,faker,should,sinon'"
31
31
  },
32
32
  "repository": {
@@ -44,6 +44,7 @@
44
44
  "@types/lodash": "4.14.137",
45
45
  "@types/mocha": "5.2.7",
46
46
  "@types/node": "12.7.2",
47
+ "@types/path-browserify": "1.0.3",
47
48
  "@types/should": "13.0.0",
48
49
  "@types/sinon": "7.0.13",
49
50
  "babel-loader": "8.0.6",
@@ -56,6 +57,7 @@
56
57
  "lint-staged": "12.5.0",
57
58
  "lodash": "4.17.21",
58
59
  "mocha": "6.2.3",
60
+ "path-browserify": "1.0.1",
59
61
  "should": "13.2.3",
60
62
  "should-sinon": "0.0.6",
61
63
  "sinon": "7.4.1",
@@ -64,8 +66,7 @@
64
66
  "tslint": "5.4.3",
65
67
  "typescript": "4.3.5",
66
68
  "webpack": "4.39.2",
67
- "webpack-cli": "3.3.7",
68
- "weinre": "2.0.0-pre-I0Z7U9OV"
69
+ "webpack-cli": "3.3.7"
69
70
  },
70
71
  "engines": {
71
72
  "node": ">=12.0.0",