@fluffjs/cli 0.1.9 → 0.1.10
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/Cli.d.ts +1 -0
- package/Cli.js +29 -9
- package/babel-plugin-reactive.js +2 -2
- package/interfaces/FluffTarget.d.ts +1 -1
- package/package.json +1 -1
- package/types/FluffConfig.js +0 -1
package/Cli.d.ts
CHANGED
package/Cli.js
CHANGED
|
@@ -196,7 +196,6 @@ Examples:
|
|
|
196
196
|
name: targetName,
|
|
197
197
|
srcDir: `src/${targetName}`,
|
|
198
198
|
outDir: `dist/${targetName}`,
|
|
199
|
-
components: ['**/*.component.ts'],
|
|
200
199
|
assets: ['**/*.html', '**/*.css']
|
|
201
200
|
};
|
|
202
201
|
console.log(`Added target '${targetName}' to fluff.json`);
|
|
@@ -214,7 +213,6 @@ Examples:
|
|
|
214
213
|
name: targetName,
|
|
215
214
|
srcDir: 'src',
|
|
216
215
|
outDir: 'dist',
|
|
217
|
-
components: ['**/*.component.ts'],
|
|
218
216
|
assets: ['**/*.html', '**/*.css']
|
|
219
217
|
}
|
|
220
218
|
};
|
|
@@ -306,7 +304,7 @@ Examples:
|
|
|
306
304
|
}
|
|
307
305
|
const entryPoint = target.entryPoint
|
|
308
306
|
? path.join(srcDir, target.entryPoint)
|
|
309
|
-
: this.generateEntryPoint(srcDir, target.
|
|
307
|
+
: this.generateEntryPoint(srcDir, target.exclude);
|
|
310
308
|
let inlineStyles = '';
|
|
311
309
|
if (target.styles && target.styles.length > 0) {
|
|
312
310
|
const styleContents = [];
|
|
@@ -507,7 +505,7 @@ Examples:
|
|
|
507
505
|
}
|
|
508
506
|
const entryPoint = target.entryPoint
|
|
509
507
|
? path.join(srcDir, target.entryPoint)
|
|
510
|
-
: this.generateEntryPoint(srcDir, target.
|
|
508
|
+
: this.generateEntryPoint(srcDir, target.exclude);
|
|
511
509
|
let inlineStyles = '';
|
|
512
510
|
if (target.styles && target.styles.length > 0) {
|
|
513
511
|
const styleContents = [];
|
|
@@ -607,12 +605,12 @@ Examples:
|
|
|
607
605
|
console.log(' Press Ctrl+C to stop\n');
|
|
608
606
|
}
|
|
609
607
|
}
|
|
610
|
-
generateEntryPoint(srcDir,
|
|
611
|
-
const
|
|
612
|
-
for (const f of
|
|
613
|
-
console.log(` ✓
|
|
608
|
+
generateEntryPoint(srcDir, exclude = []) {
|
|
609
|
+
const tsFiles = this.findAllTsFiles(srcDir, exclude);
|
|
610
|
+
for (const f of tsFiles) {
|
|
611
|
+
console.log(` ✓ ${path.relative(srcDir, f)}`);
|
|
614
612
|
}
|
|
615
|
-
const importDecls =
|
|
613
|
+
const importDecls = tsFiles.map(f => {
|
|
616
614
|
const relativePath = './' + path.relative(srcDir, f)
|
|
617
615
|
.replace(/\\/g, '/');
|
|
618
616
|
return t.importDeclaration([], t.stringLiteral(relativePath));
|
|
@@ -623,6 +621,28 @@ Examples:
|
|
|
623
621
|
fs.writeFileSync(entryPath, entryContent);
|
|
624
622
|
return entryPath;
|
|
625
623
|
}
|
|
624
|
+
findAllTsFiles(dir, userExclude = []) {
|
|
625
|
+
const files = [];
|
|
626
|
+
const excludePatterns = ['*.spec.ts', '*.test.ts', '__generated_entry.ts', ...userExclude];
|
|
627
|
+
const walk = (currentDir) => {
|
|
628
|
+
const entries = fs.readdirSync(currentDir, { withFileTypes: true });
|
|
629
|
+
for (const entry of entries) {
|
|
630
|
+
const fullPath = path.join(currentDir, entry.name);
|
|
631
|
+
if (entry.isDirectory()) {
|
|
632
|
+
walk(fullPath);
|
|
633
|
+
}
|
|
634
|
+
else if (entry.isFile() && entry.name.endsWith('.ts')) {
|
|
635
|
+
const relativePath = path.relative(dir, fullPath).replace(/\\/g, '/');
|
|
636
|
+
const isExcluded = excludePatterns.some(pattern => this.matchGlob(entry.name, pattern) || this.matchGlob(relativePath, pattern));
|
|
637
|
+
if (!isExcluded) {
|
|
638
|
+
files.push(fullPath);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
};
|
|
643
|
+
walk(dir);
|
|
644
|
+
return files;
|
|
645
|
+
}
|
|
626
646
|
findFiles(dir, patterns) {
|
|
627
647
|
const files = [];
|
|
628
648
|
const walk = (currentDir) => {
|
package/babel-plugin-reactive.js
CHANGED
|
@@ -287,7 +287,7 @@ export default function reactivePlugin() {
|
|
|
287
287
|
constructorStatements.push(t.expressionStatement(t.unaryExpression('void', t.memberExpression(t.thisExpression(), t.identifier(methodName)))));
|
|
288
288
|
for (const prop of mProps) {
|
|
289
289
|
if (reactiveProps.has(prop)) {
|
|
290
|
-
constructorStatements.push(t.expressionStatement(t.callExpression(t.memberExpression(t.memberExpression(t.memberExpression(t.thisExpression(), t.identifier(`__${prop}`)), t.identifier('onChange')), t.identifier('subscribe')), [t.arrowFunctionExpression([], t.callExpression(t.memberExpression(t.thisExpression(), t.identifier(methodName)), []))])));
|
|
290
|
+
constructorStatements.push(t.expressionStatement(t.callExpression(t.memberExpression(t.memberExpression(t.thisExpression(), t.identifier('__baseSubscriptions')), t.identifier('push')), [t.callExpression(t.memberExpression(t.memberExpression(t.memberExpression(t.thisExpression(), t.identifier(`__${prop}`)), t.identifier('onChange')), t.identifier('subscribe')), [t.arrowFunctionExpression([], t.callExpression(t.memberExpression(t.thisExpression(), t.identifier(methodName)), [t.stringLiteral(prop)]))])])));
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
293
|
}
|
|
@@ -299,7 +299,7 @@ export default function reactivePlugin() {
|
|
|
299
299
|
for (const prop of wProps) {
|
|
300
300
|
if (reactiveProps.has(prop)) {
|
|
301
301
|
iife.push(t.expressionStatement(t.callExpression(t.memberExpression(t.identifier('__subs'), t.identifier('push')), [
|
|
302
|
-
t.callExpression(t.memberExpression(t.memberExpression(t.memberExpression(t.thisExpression(), t.identifier(`__${prop}`)), t.identifier('onChange')), t.identifier('subscribe')), [t.identifier('__cb')])
|
|
302
|
+
t.callExpression(t.memberExpression(t.memberExpression(t.memberExpression(t.thisExpression(), t.identifier(`__${prop}`)), t.identifier('onChange')), t.identifier('subscribe')), [t.arrowFunctionExpression([], t.callExpression(t.identifier('__cb'), [t.stringLiteral(prop)]))])
|
|
303
303
|
])));
|
|
304
304
|
}
|
|
305
305
|
}
|
package/package.json
CHANGED