@shuvi/service 1.0.11 → 1.0.13

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.
@@ -68,7 +68,7 @@ function writeDefaultConfigurations(ts, tsConfigPath, tsConfig, paths, isFirstTi
68
68
  },
69
69
  noImplicitThis: {
70
70
  value: true,
71
- reason: 'requirement for redox'
71
+ reason: 'requirement for doura'
72
72
  },
73
73
  module: {
74
74
  parsedValue: ts.ModuleKind.ESNext,
@@ -1,5 +1,6 @@
1
1
  export declare const getAllFiles: (dependencies: string | string[]) => string[];
2
- export declare const getModuleExport: (module: string, defaultExport?: boolean) => string;
2
+ export declare const getModuleExport: (module: string, defaultExport?: boolean, removeExtension?: boolean) => string;
3
+ /** get first existed module and remove the extension */
3
4
  export declare const getFirstModuleExport: (allFiles: string[], candidates: string[], defaultExport?: boolean) => string;
4
5
  export declare const getUserCustomFileCandidates: (rootPath: string, fileName: string, fallbackType: 'nullish' | 'noop' | 'noopFn') => string[];
5
6
  export declare const getContentProxyObj: (Obj: {
@@ -46,22 +46,28 @@ const getAllFiles = (dependencies) => {
46
46
  return allFiles;
47
47
  };
48
48
  exports.getAllFiles = getAllFiles;
49
- const getModuleExport = (module, defaultExport) => {
49
+ const getModuleExport = (module, defaultExport, removeExtension) => {
50
50
  if (module) {
51
+ let modulePath = module;
52
+ if (removeExtension) {
53
+ const parsed = path.parse(module);
54
+ modulePath = `${parsed.dir}${path.sep}${parsed.name}`;
55
+ }
51
56
  return defaultExport
52
- ? `export { default } from "${module}"`
53
- : `export * from "${module}"`;
57
+ ? `export { default } from "${modulePath}"`
58
+ : `export * from "${modulePath}"`;
54
59
  }
55
60
  return defaultExport ? `export default null` : `export default {}`;
56
61
  };
57
62
  exports.getModuleExport = getModuleExport;
63
+ /** get first existed module and remove the extension */
58
64
  const getFirstModuleExport = (allFiles, candidates, defaultExport) => {
59
65
  if (allFiles.length) {
60
66
  for (let i = 0; i < candidates.length; i++) {
61
67
  const currentCandidate = candidates[i];
62
68
  const currentLookup = allFiles.find(x => x === currentCandidate);
63
69
  if (currentLookup) {
64
- return (0, exports.getModuleExport)(currentLookup, defaultExport);
70
+ return (0, exports.getModuleExport)(currentLookup, defaultExport, true);
65
71
  }
66
72
  }
67
73
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shuvi/service",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/shuvijs/shuvi.git",
@@ -29,14 +29,14 @@
29
29
  "@babel/generator": "7.14.5",
30
30
  "@babel/parser": "7.14.7",
31
31
  "@babel/traverse": "7.14.7",
32
- "@shuvi/hook": "1.0.11",
33
- "@shuvi/router": "1.0.11",
34
- "@shuvi/runtime": "1.0.11",
35
- "@shuvi/shared": "1.0.11",
36
- "@shuvi/toolpack": "1.0.11",
37
- "@shuvi/utils": "1.0.11",
38
- "@shuvi/error-overlay": "1.0.11",
39
- "@shuvi/telemetry": "1.0.11",
32
+ "@shuvi/hook": "1.0.13",
33
+ "@shuvi/router": "1.0.13",
34
+ "@shuvi/runtime": "1.0.13",
35
+ "@shuvi/shared": "1.0.13",
36
+ "@shuvi/toolpack": "1.0.13",
37
+ "@shuvi/utils": "1.0.13",
38
+ "@shuvi/error-overlay": "1.0.13",
39
+ "@shuvi/telemetry": "1.0.13",
40
40
  "commander": "5.1.0",
41
41
  "comment-json": "4.2.2",
42
42
  "cross-spawn": "7.0.3",