oak-domain 5.1.5 → 5.1.6

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.
@@ -588,9 +588,17 @@ function outputFeatureIndex(dependencies, briefNames, sourceFile, printer, filen
588
588
  importStatements.push(factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([factory.createImportSpecifier(false, factory.createIdentifier("FeatureDict"), factory.createIdentifier(fdName))])), factory.createStringLiteral(dep), undefined));
589
589
  fdNames.push(fdName);
590
590
  });
591
- const stmt4 = statements[4], stmt5 = statements[5];
592
- (0, assert_1.default)(ts.isImportDeclaration(stmt4) && ts.isFunctionDeclaration(stmt5));
593
- const { name, parameters } = stmt5;
591
+ let i = 0;
592
+ while (true) {
593
+ const stmt = statements[i];
594
+ if (ts.isFunctionDeclaration(stmt)) {
595
+ break;
596
+ }
597
+ i++;
598
+ }
599
+ const stmt3 = statements[i - 1], stmt4 = statements[i];
600
+ (0, assert_1.default)(ts.isImportDeclaration(stmt3) && ts.isFunctionDeclaration(stmt4));
601
+ const { name, parameters } = stmt4;
594
602
  (0, assert_1.default)(ts.isIdentifier(name) && name.text === 'create' && parameters.length === 1);
595
603
  const [param] = parameters;
596
604
  const { name: paramName, type } = param;
@@ -604,9 +612,9 @@ function outputFeatureIndex(dependencies, briefNames, sourceFile, printer, filen
604
612
  ])
605
613
  });
606
614
  statements2 = [
607
- ...statements.slice(0, 5),
615
+ ...statements.slice(0, i),
608
616
  ...importStatements,
609
- ...statements.slice(5)
617
+ ...statements.slice(i)
610
618
  ];
611
619
  if (isModule) {
612
620
  statements2.push(factory.createFunctionDeclaration([
@@ -756,7 +764,7 @@ function tryCopyModuleTemplateFiles(cwd, dependencies, briefNames, printer) {
756
764
  const moduleTemplateDir = join(moduleDir, 'template');
757
765
  if ((0, fs_1.existsSync)(moduleTemplateDir)) {
758
766
  // data.ts中规定的初始化数据,拷贝到data目录下,并注入到data/index.ts
759
- const dataFile = join(moduleTemplateDir, 'data', 'data.ts');
767
+ const dataFile = join(moduleTemplateDir, 'data.ts');
760
768
  if ((0, fs_1.existsSync)(dataFile)) {
761
769
  const prjDataFile = join(cwd, 'src', 'data', `${briefNames[idx]}Data.ts`);
762
770
  if (!(0, fs_1.existsSync)(prjDataFile)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oak-domain",
3
- "version": "5.1.5",
3
+ "version": "5.1.6",
4
4
  "author": {
5
5
  "name": "XuChang"
6
6
  },