amxxpack 1.4.3 → 1.4.5

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/README.md CHANGED
@@ -106,6 +106,19 @@ You can use multiple directories as builder inputs, just specify an array of dir
106
106
  }
107
107
  ```
108
108
 
109
+ ### Disabling output
110
+ Use `null` value for outputs to disable copying of specific output.
111
+
112
+ For example, in this case, include files will not be copied to the output folder:
113
+
114
+ ```json
115
+ {
116
+ "output": {
117
+ "include": null
118
+ }
119
+ }
120
+ ```
121
+
109
122
  ### Assets filtering and subdirectories
110
123
  Using glob filters you can specify which assets should be copied.
111
124
 
@@ -157,7 +157,7 @@ var PluginsCache = /** @class */ (function () {
157
157
  case 0: return [4 /*yield*/, (0, create_dir_hash_1.default)(includeDirs, function (p) { return !p.info.isFile() || path_1.default.parse(p.info.name).ext === '.inc'; })];
158
158
  case 1:
159
159
  includeHash = _a.sent();
160
- return [2 /*return*/, includeHash];
160
+ return [2 /*return*/, includeHash.digest('hex')];
161
161
  }
162
162
  });
163
163
  });
@@ -175,7 +175,9 @@ var Controller = /** @class */ (function () {
175
175
  return [4 /*yield*/, (0, thirdparty_1.default)({
176
176
  name: dependency.name,
177
177
  url: dependency.url,
178
- dir: projectConfig.thirdparty.dir
178
+ dir: projectConfig.thirdparty.dir,
179
+ strip: dependency.strip,
180
+ filter: dependency.filter
179
181
  })];
180
182
  case 4:
181
183
  _b.sent();
@@ -42,6 +42,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
42
42
  var path_1 = __importDefault(require("path"));
43
43
  var mkdirp_1 = __importDefault(require("mkdirp"));
44
44
  var decompress_1 = __importDefault(require("decompress"));
45
+ var globule_1 = __importDefault(require("globule"));
45
46
  var download_1 = __importDefault(require("../../utils/download"));
46
47
  var config_1 = __importDefault(require("../../config"));
47
48
  function downloadThirdparty(options) {
@@ -58,7 +59,14 @@ function downloadThirdparty(options) {
58
59
  return [4 /*yield*/, (0, mkdirp_1.default)(outDir)];
59
60
  case 2:
60
61
  _a.sent();
61
- return [4 /*yield*/, (0, decompress_1.default)(filePath, outDir)];
62
+ return [4 /*yield*/, (0, decompress_1.default)(filePath, outDir, {
63
+ strip: options.strip,
64
+ filter: options.filter && (function (file) { return globule_1.default.isMatch(options.filter, file.path, {
65
+ dot: true,
66
+ nocase: true,
67
+ matchBase: true
68
+ }); })
69
+ })];
62
70
  case 3:
63
71
  _a.sent();
64
72
  return [2 /*return*/];
@@ -2,4 +2,6 @@ export interface IDownloadThirdpartyOptions {
2
2
  name: string;
3
3
  url: string;
4
4
  dir: string;
5
+ strip: number;
6
+ filter?: string | string[];
5
7
  }
@@ -42,7 +42,8 @@ function resolve(overrides, projectDir) {
42
42
  dir: resolvePath(config.compiler.dir),
43
43
  },
44
44
  thirdparty: {
45
- dir: resolvePath(config.thirdparty.dir)
45
+ dir: resolvePath(config.thirdparty.dir),
46
+ dependencies: (0, lodash_1.map)(config.thirdparty.dependencies, function (dependency) { return (__assign(__assign({}, dependency), { strip: dependency.strip || 0 })); })
46
47
  }
47
48
  });
48
49
  return resolvedConfig;
@@ -3,6 +3,12 @@ export interface IAssetInput {
3
3
  dest?: string;
4
4
  filter?: string | string[];
5
5
  }
6
+ export interface IDependency {
7
+ name: string;
8
+ url: string;
9
+ strip?: number;
10
+ filter?: string | string[];
11
+ }
6
12
  export interface IProjectConfig {
7
13
  input: {
8
14
  scripts: null | string | string[];
@@ -25,10 +31,7 @@ export interface IProjectConfig {
25
31
  };
26
32
  thirdparty: {
27
33
  dir: string | null;
28
- dependencies: {
29
- name: string;
30
- url: string;
31
- }[];
34
+ dependencies: IDependency[];
32
35
  };
33
36
  include: null | string[];
34
37
  rules: {
@@ -67,5 +70,8 @@ export interface IResolvedProjectConfig extends IProjectConfig {
67
70
  };
68
71
  thirdparty: IProjectConfig['thirdparty'] & {
69
72
  dir: string;
73
+ dependencies: (IDependency & {
74
+ strip: number;
75
+ })[];
70
76
  };
71
77
  }
@@ -5,5 +5,5 @@ import crypto from 'crypto';
5
5
  declare function createDirHash(dirs: string[], filterFn?: (p: {
6
6
  dir: string;
7
7
  info: fs.Dirent;
8
- }) => boolean, initialHash?: crypto.Hash): Promise<string>;
8
+ }) => boolean, initialHash?: crypto.Hash): Promise<crypto.Hash>;
9
9
  export default createDirHash;
@@ -54,10 +54,10 @@ function createDirHash(dirs, filterFn, initialHash) {
54
54
  _i = 0, dirs_1 = dirs;
55
55
  _b.label = 1;
56
56
  case 1:
57
- if (!(_i < dirs_1.length)) return [3 /*break*/, 8];
57
+ if (!(_i < dirs_1.length)) return [3 /*break*/, 9];
58
58
  dir = dirs_1[_i];
59
59
  if (!fs_1.default.existsSync(dir)) {
60
- return [3 /*break*/, 7];
60
+ return [3 /*break*/, 8];
61
61
  }
62
62
  return [4 /*yield*/, fs_1.default.promises.readdir(dir, { withFileTypes: true })];
63
63
  case 2:
@@ -65,11 +65,11 @@ function createDirHash(dirs, filterFn, initialHash) {
65
65
  _a = 0, items_1 = items;
66
66
  _b.label = 3;
67
67
  case 3:
68
- if (!(_a < items_1.length)) return [3 /*break*/, 7];
68
+ if (!(_a < items_1.length)) return [3 /*break*/, 8];
69
69
  item = items_1[_a];
70
70
  fullPath = path_1.default.join(dir, item.name);
71
71
  if (filterFn && !filterFn({ dir: dir, info: item })) {
72
- return [3 /*break*/, 6];
72
+ return [3 /*break*/, 7];
73
73
  }
74
74
  if (!item.isFile()) return [3 /*break*/, 5];
75
75
  return [4 /*yield*/, fs_1.default.promises.stat(fullPath)];
@@ -77,19 +77,20 @@ function createDirHash(dirs, filterFn, initialHash) {
77
77
  fileStat = _b.sent();
78
78
  data = "".concat(fullPath, ":").concat(fileStat.size, ":").concat(fileStat.mtimeMs);
79
79
  hashSum.update(data);
80
- return [3 /*break*/, 6];
80
+ return [3 /*break*/, 7];
81
81
  case 5:
82
- if (item.isDirectory()) {
83
- createDirHash([fullPath], filterFn, hashSum);
84
- }
85
- _b.label = 6;
82
+ if (!item.isDirectory()) return [3 /*break*/, 7];
83
+ return [4 /*yield*/, createDirHash([fullPath], filterFn, hashSum)];
86
84
  case 6:
85
+ _b.sent();
86
+ _b.label = 7;
87
+ case 7:
87
88
  _a++;
88
89
  return [3 /*break*/, 3];
89
- case 7:
90
+ case 8:
90
91
  _i++;
91
92
  return [3 /*break*/, 1];
92
- case 8: return [2 /*return*/, hashSum.digest('hex')];
93
+ case 9: return [2 /*return*/, hashSum];
93
94
  }
94
95
  });
95
96
  });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "amxxpack",
3
3
  "description": "AMXXPack",
4
4
  "author": "Hedgehog Fog",
5
- "version": "1.4.3",
5
+ "version": "1.4.5",
6
6
  "license": "MIT",
7
7
  "main": "lib/builder/index.js",
8
8
  "types": "lib/builder/index.d.ts",