purgetss 6.2.0 → 6.2.2

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.
@@ -412,7 +412,9 @@ function combineDefaultThemeWithConfigFile() {
412
412
  ? _.merge({ apply: configFile.theme.View.apply }, configFile.theme.View)
413
413
  : _.merge({ default: { width: 'Ti.UI.SIZE', height: 'Ti.UI.SIZE' } }, configFile.theme.View);
414
414
 
415
- _.each(configFile.plugins, value => {
415
+ // !Delete plugins specified in the config file
416
+ let deletePlugins = Array.isArray(configFile.plugins) ? configFile.plugins : Object.keys(configFile.plugins).map(key => key);
417
+ _.each(deletePlugins, value => {
416
418
  delete base[value];
417
419
  delete configFile.theme[value];
418
420
  delete configFile.theme.extend[value];
package/index.js CHANGED
@@ -396,13 +396,14 @@ function shades(args, options) {
396
396
  exports.shades = shades;
397
397
 
398
398
  function cleanDoubleQuotes(configFile, options) {
399
- let json = JSON.stringify(configFile, null, 2);
399
+ const regexUnicode = /[^\u0000-\u00FF]/g;
400
400
 
401
- if (options.quotes) return json;
401
+ if (options.quotes) return JSON.stringify(configFile, null, 2).replace(regexUnicode, match => `\\u${match.charCodeAt(0).toString(16)}`);
402
402
 
403
- json = json.replace(/"([^"]+)":/g, (match, p1) => (p1.match(/[#._-]/)) ? `'${p1}':` : `${p1}:`);
403
+ let util = require('util');
404
+ let inspected = util.inspect(configFile, false, 10);
404
405
 
405
- return json.replaceAll("\"", "'");
406
+ return inspected.replace(regexUnicode, match => `\\u${match.charCodeAt(0).toString(16)}`);
406
407
  }
407
408
 
408
409
  function createColorObject(family, hexcode, options) {
@@ -1594,10 +1595,11 @@ function combineAllValues(base, defaultTheme) {
1594
1595
  }
1595
1596
 
1596
1597
  // !Delete plugins specified in the config file
1597
- let plugins = Array.isArray(configFile.plugins) ? configFile.plugins : Object.keys(configFile.plugins).map(key => key);
1598
- _.each(plugins, value => {
1598
+ let deletePlugins = Array.isArray(configFile.plugins) ? configFile.plugins : Object.keys(configFile.plugins).map(key => key);
1599
+ _.each(deletePlugins, value => {
1599
1600
  delete allValues[value];
1600
1601
  delete configFile.theme[value];
1602
+ delete configFile.theme.extend[value];
1601
1603
  });
1602
1604
 
1603
1605
  _.each(allValues, (_value, key) => {
@@ -2132,7 +2134,7 @@ function extractClassesOnly(currentText, currentFile) {
2132
2134
  let jsontext = convert.xml2json(encodeHTML(currentText), { compact: true });
2133
2135
 
2134
2136
  return traverse(JSON.parse(jsontext)).reduce(function(acc, value) {
2135
- if (this.key === 'class') acc.push(value.split(' '));
2137
+ if (this.key === 'class' || this.key === 'classes' || this.key === 'icon') acc.push(value.split(' '));
2136
2138
  return acc;
2137
2139
  }, []);
2138
2140
  } catch (error) {
package/lib/helpers.js CHANGED
@@ -2,6 +2,7 @@ let _applyClasses = {};
2
2
  const fs = require('fs');
3
3
  const cwd = process.cwd();
4
4
  const _ = require('lodash');
5
+ const regexUnicode = /[^\u0000-\u00FF]/;
5
6
  const readCSS = require('read-css');
6
7
  const HEX_3_REGEX = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; // i.e. #0F3
7
8
  const HEX_4_REGEX = /^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])$/i; // i.e. #80F3
@@ -6797,10 +6798,10 @@ function findIndexOfClassName(_substring, _array) {
6797
6798
  function parseValue(value, sign = '') {
6798
6799
  if (value === '') return `''`;
6799
6800
 
6800
- // Hack for unicode values
6801
- // if (/[^\u0000-\u00ff]/.test(value)) {
6802
- // return `'\\u${value.charCodeAt(0).toString(16)}'`;
6803
- // }
6801
+ // Match on everything outside this range: [^\u0000-\u00FF].
6802
+ if (regexUnicode.test(value)) {
6803
+ return `'\\u${value.charCodeAt(0).toString(16)}'`;
6804
+ }
6804
6805
 
6805
6806
  if (value === '0px') {
6806
6807
  value = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "purgetss",
3
- "version": "6.2.0",
3
+ "version": "6.2.2",
4
4
  "description": "An extension for Titanium SDK that contains a set of Tailwind-like classes to easily and quickly create beautifully designed mobile apps.",
5
5
  "main": "index.js",
6
6
  "bin": {