@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.
@@ -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
- private static internString;
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;
@@ -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: 'npx @fluffjs/cli build',
106
- serve: 'npx @fluffjs/cli serve'
105
+ build: 'fluff build',
106
+ serve: 'fluff serve'
107
107
  },
108
108
  dependencies: {
109
109
  '@fluffjs/fluff': `^${cliVersion}`
@@ -0,0 +1,6 @@
1
+ export interface PeerDependency {
2
+ name: string;
3
+ version: string;
4
+ }
5
+ export declare function getCliPeerDependencies(): PeerDependency[];
6
+ //# sourceMappingURL=PeerDependencies.d.ts.map
@@ -0,0 +1,7 @@
1
+ export function getCliPeerDependencies() {
2
+ return [
3
+ { name: 'cssnano', version: '^7.1.2' },
4
+ { name: 'postcss', version: '^8.5.6' },
5
+ { name: 'jsesc', version: '^3.1.0' }
6
+ ];
7
+ }
@@ -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 createPropCall = t.callExpression(t.memberExpression(t.thisExpression(), t.identifier('__createProp')), [t.stringLiteral(propName), ...propertyArgs]);
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);
@@ -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.push(exprTableImport);
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.1",
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
- "picomatch": "^4.0.2",
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"