@fluffjs/cli 0.4.1 → 0.4.3
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/Generator.js +2 -2
- package/PeerDependencies.d.ts +6 -0
- package/PeerDependencies.js +7 -0
- package/babel-plugin-reactive.js +3 -1
- package/fluff-esbuild-plugin.js +1 -1
- package/package.json +6 -4
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/Generator.js
CHANGED
|
@@ -102,8 +102,8 @@ export class Generator {
|
|
|
102
102
|
private: true,
|
|
103
103
|
type: 'module',
|
|
104
104
|
scripts: {
|
|
105
|
-
build: '
|
|
106
|
-
serve: '
|
|
105
|
+
build: 'fluff build',
|
|
106
|
+
serve: 'fluff serve'
|
|
107
107
|
},
|
|
108
108
|
dependencies: {
|
|
109
109
|
'@fluffjs/fluff': `^${cliVersion}`
|
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/fluff-esbuild-plugin.js
CHANGED
|
@@ -137,7 +137,7 @@ export function fluffPlugin(options) {
|
|
|
137
137
|
plugins: ['typescript', 'decorators']
|
|
138
138
|
});
|
|
139
139
|
const exprTableImport = t.importDeclaration([], t.stringLiteral(VIRTUAL_EXPR_TABLE_ID));
|
|
140
|
-
ast.program.body.
|
|
140
|
+
ast.program.body.unshift(exprTableImport);
|
|
141
141
|
const output = generate(ast, { compact: false });
|
|
142
142
|
return {
|
|
143
143
|
contents: output.code,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluffjs/cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -29,21 +29,23 @@
|
|
|
29
29
|
"@babel/preset-typescript": "^7.28.5",
|
|
30
30
|
"@babel/traverse": "^7.28.6",
|
|
31
31
|
"@babel/types": "^7.28.6",
|
|
32
|
+
"cssnano": "^7.1.2",
|
|
32
33
|
"esbuild": "^0.27.2",
|
|
33
34
|
"he": "^1.2.0",
|
|
34
35
|
"html-minifier-terser": "^7.2.0",
|
|
35
36
|
"http-proxy": "^1.18.1",
|
|
36
|
-
"
|
|
37
|
+
"jsesc": "^3.1.0",
|
|
37
38
|
"parse5": "^8.0.0",
|
|
38
39
|
"parse5-sax-parser": "^8.0.0",
|
|
40
|
+
"picomatch": "^4.0.2",
|
|
41
|
+
"postcss": "^8.5.6",
|
|
39
42
|
"source-map": "^0.7.6",
|
|
40
43
|
"tslib": "^2.3.0"
|
|
41
44
|
},
|
|
42
45
|
"devDependencies": {
|
|
43
46
|
"@types/he": "^1.2.3",
|
|
44
47
|
"@types/http-proxy": "^1.17.16",
|
|
45
|
-
"@types/jsesc": "^3.0.3"
|
|
46
|
-
"jsesc": "^3.1.0"
|
|
48
|
+
"@types/jsesc": "^3.0.3"
|
|
47
49
|
},
|
|
48
50
|
"publishConfig": {
|
|
49
51
|
"access": "public"
|