@fluffjs/cli 0.4.1 → 0.4.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.
- package/CodeGenerator.d.ts +1 -1
- package/ComponentCompiler.js +4 -0
- package/babel-plugin-reactive.js +3 -1
- package/package.json +5 -3
package/CodeGenerator.d.ts
CHANGED
|
@@ -59,7 +59,7 @@ export declare class CodeGenerator {
|
|
|
59
59
|
private readonly collectedTemplates;
|
|
60
60
|
constructor(componentSelectors?: Set<string>, componentSelector?: string);
|
|
61
61
|
static resetGlobalState(): void;
|
|
62
|
-
|
|
62
|
+
static internString(str: string): number;
|
|
63
63
|
static getStringTable(): string[];
|
|
64
64
|
generateRenderMethod(template: ParsedTemplate, styles?: string): string;
|
|
65
65
|
generateHtml(template: ParsedTemplate): string;
|
package/ComponentCompiler.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as babel from '@babel/core';
|
|
2
2
|
import { parse } from '@babel/parser';
|
|
3
3
|
import * as t from '@babel/types';
|
|
4
|
+
import cssnano from 'cssnano';
|
|
4
5
|
import * as esbuild from 'esbuild';
|
|
5
6
|
import * as fs from 'fs';
|
|
6
7
|
import { minify as minifyHtml } from 'html-minifier-terser';
|
|
8
|
+
import postcss from 'postcss';
|
|
7
9
|
import * as parse5 from 'parse5';
|
|
8
10
|
import * as path from 'path';
|
|
9
11
|
import { SourceMapConsumer, SourceMapGenerator } from 'source-map';
|
|
@@ -116,6 +118,8 @@ export class ComponentCompiler {
|
|
|
116
118
|
styles = inlineStyles;
|
|
117
119
|
}
|
|
118
120
|
if (minify && styles) {
|
|
121
|
+
const nanoResult = await postcss([cssnano({ preset: 'default' })]).process(styles, { from: undefined });
|
|
122
|
+
styles = nanoResult.css;
|
|
119
123
|
const cssResult = await esbuild.transform(styles, {
|
|
120
124
|
loader: 'css', minify: true
|
|
121
125
|
});
|
package/babel-plugin-reactive.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { types as t } from '@babel/core';
|
|
2
2
|
import { buildHostBindingUpdateStatement, findDecoratorIndex, getDecoratorName } from './BabelHelpers.js';
|
|
3
|
+
import { CodeGenerator } from './CodeGenerator.js';
|
|
3
4
|
export const reactivePropertiesMap = new Map();
|
|
4
5
|
export default function reactivePlugin() {
|
|
5
6
|
// noinspection JSUnusedGlobalSymbols
|
|
@@ -349,7 +350,8 @@ export default function reactivePlugin() {
|
|
|
349
350
|
const propertyArgs = useOptionsObject
|
|
350
351
|
? [t.objectExpression(propertyOptions)]
|
|
351
352
|
: [initialValue];
|
|
352
|
-
const
|
|
353
|
+
const propNameIdx = CodeGenerator.internString(propName);
|
|
354
|
+
const createPropCall = t.callExpression(t.memberExpression(t.thisExpression(), t.identifier('__createProp')), [t.numericLiteral(propNameIdx), ...propertyArgs]);
|
|
353
355
|
const privateField = t.classProperty(t.identifier(privateName), createPropCall);
|
|
354
356
|
propsToRemove.push(memberPath);
|
|
355
357
|
privateFields.push(privateField);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluffjs/cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"he": "^1.2.0",
|
|
34
34
|
"html-minifier-terser": "^7.2.0",
|
|
35
35
|
"http-proxy": "^1.18.1",
|
|
36
|
-
"picomatch": "^4.0.2",
|
|
37
36
|
"parse5": "^8.0.0",
|
|
38
37
|
"parse5-sax-parser": "^8.0.0",
|
|
38
|
+
"picomatch": "^4.0.2",
|
|
39
39
|
"source-map": "^0.7.6",
|
|
40
40
|
"tslib": "^2.3.0"
|
|
41
41
|
},
|
|
@@ -43,7 +43,9 @@
|
|
|
43
43
|
"@types/he": "^1.2.3",
|
|
44
44
|
"@types/http-proxy": "^1.17.16",
|
|
45
45
|
"@types/jsesc": "^3.0.3",
|
|
46
|
-
"
|
|
46
|
+
"cssnano": "^7.1.2",
|
|
47
|
+
"jsesc": "^3.1.0",
|
|
48
|
+
"postcss": "^8.5.6"
|
|
47
49
|
},
|
|
48
50
|
"publishConfig": {
|
|
49
51
|
"access": "public"
|