@akanjs/devkit 0.9.13 → 0.9.14

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.
@@ -862,17 +862,28 @@ class AppExecutor extends SysExecutor {
862
862
  }
863
863
  async syncAssets(libDeps) {
864
864
  const projectPublicLibPath = `${this.cwdPath}/public/libs`;
865
- if (import_fs.default.existsSync(projectPublicLibPath))
866
- await import_promises.default.rm(projectPublicLibPath, { recursive: true });
865
+ const projectAssetsLibPath = `${this.cwdPath}/assets/libs`;
866
+ await Promise.all([
867
+ import_fs.default.existsSync(projectPublicLibPath) && import_promises.default.rm(projectPublicLibPath, { recursive: true }),
868
+ import_fs.default.existsSync(projectAssetsLibPath) && import_promises.default.rm(projectAssetsLibPath, { recursive: true })
869
+ ]);
867
870
  const targetDeps = libDeps.filter((dep) => import_fs.default.existsSync(`${this.workspace.workspaceRoot}/libs/${dep}/public`));
868
- await Promise.all(targetDeps.map((dep) => import_promises.default.mkdir(`${projectPublicLibPath}/${dep}`, { recursive: true })));
869
- await Promise.all(
870
- targetDeps.map(
871
- (dep) => import_promises.default.cp(`${this.workspace.workspaceRoot}/libs/${dep}/public`, `${projectPublicLibPath}/${dep}`, {
871
+ await Promise.all([
872
+ ...targetDeps.map((dep) => import_promises.default.mkdir(`${projectPublicLibPath}/${dep}`, { recursive: true })),
873
+ ...targetDeps.map((dep) => import_promises.default.mkdir(`${projectAssetsLibPath}/${dep}`, { recursive: true }))
874
+ ]);
875
+ await Promise.all([
876
+ ...targetDeps.map(
877
+ (dep) => import_fs.default.existsSync(`${this.workspace.workspaceRoot}/libs/${dep}/public`) && import_promises.default.cp(`${this.workspace.workspaceRoot}/libs/${dep}/public`, `${projectPublicLibPath}/${dep}`, {
878
+ recursive: true
879
+ })
880
+ ),
881
+ ...targetDeps.map(
882
+ (dep) => import_fs.default.existsSync(`${this.workspace.workspaceRoot}/libs/${dep}/assets`) && import_promises.default.cp(`${this.workspace.workspaceRoot}/libs/${dep}/assets`, `${projectAssetsLibPath}/${dep}`, {
872
883
  recursive: true
873
884
  })
874
885
  )
875
- );
886
+ ]);
876
887
  }
877
888
  }
878
889
  class LibExecutor extends SysExecutor {
@@ -74,7 +74,7 @@ const extractDependencies = (filepaths, pacakgeJson, defaultDependencies = []) =
74
74
  ...pacakgeJson.dependencies ?? {},
75
75
  ...pacakgeJson.devDependencies ?? {}
76
76
  };
77
- const requireRegex = /require\s*\(\s*['"`]([^'"`]+)['"`]\s*\)/g;
77
+ const requireRegex = /(?:require\s*\(|import\s*(?:[\w\s{},*]*\s+from\s*)?|import\s*\()\s*['"`]([^'"`]+)['"`]/g;
78
78
  for (const { text } of filepaths.filter(({ path }) => path.endsWith(".js"))) {
79
79
  let requireMatch;
80
80
  while ((requireMatch = requireRegex.exec(text)) !== null) {
@@ -826,17 +826,28 @@ class AppExecutor extends SysExecutor {
826
826
  }
827
827
  async syncAssets(libDeps) {
828
828
  const projectPublicLibPath = `${this.cwdPath}/public/libs`;
829
- if (fs.existsSync(projectPublicLibPath))
830
- await fsPromise.rm(projectPublicLibPath, { recursive: true });
829
+ const projectAssetsLibPath = `${this.cwdPath}/assets/libs`;
830
+ await Promise.all([
831
+ fs.existsSync(projectPublicLibPath) && fsPromise.rm(projectPublicLibPath, { recursive: true }),
832
+ fs.existsSync(projectAssetsLibPath) && fsPromise.rm(projectAssetsLibPath, { recursive: true })
833
+ ]);
831
834
  const targetDeps = libDeps.filter((dep) => fs.existsSync(`${this.workspace.workspaceRoot}/libs/${dep}/public`));
832
- await Promise.all(targetDeps.map((dep) => fsPromise.mkdir(`${projectPublicLibPath}/${dep}`, { recursive: true })));
833
- await Promise.all(
834
- targetDeps.map(
835
- (dep) => fsPromise.cp(`${this.workspace.workspaceRoot}/libs/${dep}/public`, `${projectPublicLibPath}/${dep}`, {
835
+ await Promise.all([
836
+ ...targetDeps.map((dep) => fsPromise.mkdir(`${projectPublicLibPath}/${dep}`, { recursive: true })),
837
+ ...targetDeps.map((dep) => fsPromise.mkdir(`${projectAssetsLibPath}/${dep}`, { recursive: true }))
838
+ ]);
839
+ await Promise.all([
840
+ ...targetDeps.map(
841
+ (dep) => fs.existsSync(`${this.workspace.workspaceRoot}/libs/${dep}/public`) && fsPromise.cp(`${this.workspace.workspaceRoot}/libs/${dep}/public`, `${projectPublicLibPath}/${dep}`, {
842
+ recursive: true
843
+ })
844
+ ),
845
+ ...targetDeps.map(
846
+ (dep) => fs.existsSync(`${this.workspace.workspaceRoot}/libs/${dep}/assets`) && fsPromise.cp(`${this.workspace.workspaceRoot}/libs/${dep}/assets`, `${projectAssetsLibPath}/${dep}`, {
836
847
  recursive: true
837
848
  })
838
849
  )
839
- );
850
+ ]);
840
851
  }
841
852
  }
842
853
  class LibExecutor extends SysExecutor {
@@ -52,7 +52,7 @@ const extractDependencies = (filepaths, pacakgeJson, defaultDependencies = []) =
52
52
  ...pacakgeJson.dependencies ?? {},
53
53
  ...pacakgeJson.devDependencies ?? {}
54
54
  };
55
- const requireRegex = /require\s*\(\s*['"`]([^'"`]+)['"`]\s*\)/g;
55
+ const requireRegex = /(?:require\s*\(|import\s*(?:[\w\s{},*]*\s+from\s*)?|import\s*\()\s*['"`]([^'"`]+)['"`]/g;
56
56
  for (const { text } of filepaths.filter(({ path }) => path.endsWith(".js"))) {
57
57
  let requireMatch;
58
58
  while ((requireMatch = requireRegex.exec(text)) !== null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/devkit",
3
- "version": "0.9.13",
3
+ "version": "0.9.14",
4
4
  "sourceType": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"