@aiscene/shared 1.6.0 → 1.8.0

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.
Files changed (49) hide show
  1. package/dist/es/cli/cli-runner.mjs +13 -1
  2. package/dist/es/constants/example-code.mjs +25 -21
  3. package/dist/es/env/parse-model-config.mjs +11 -1
  4. package/dist/es/env/types.mjs +1 -0
  5. package/dist/es/extractor/dom-util.mjs +9 -5
  6. package/dist/es/index.mjs +1 -3
  7. package/dist/es/logger.mjs +1 -7
  8. package/dist/es/mcp/tool-generator.mjs +130 -56
  9. package/dist/es/node/fs.mjs +1 -1
  10. package/dist/es/utils.mjs +1 -6
  11. package/dist/lib/cli/cli-runner.js +13 -1
  12. package/dist/lib/constants/example-code.js +25 -21
  13. package/dist/lib/env/parse-model-config.js +11 -1
  14. package/dist/lib/env/types.js +1 -0
  15. package/dist/lib/extractor/dom-util.js +9 -5
  16. package/dist/lib/index.js +2 -13
  17. package/dist/lib/logger.js +0 -9
  18. package/dist/lib/mcp/tool-generator.js +129 -55
  19. package/dist/lib/node/fs.js +1 -1
  20. package/dist/lib/utils.js +0 -8
  21. package/dist/types/cli/cli-runner.d.ts +8 -0
  22. package/dist/types/cli/index.d.ts +1 -1
  23. package/dist/types/constants/example-code.d.ts +1 -1
  24. package/dist/types/env/types.d.ts +1 -1
  25. package/dist/types/extractor/dom-util.d.ts +5 -4
  26. package/dist/types/index.d.ts +0 -2
  27. package/dist/types/logger.d.ts +0 -1
  28. package/dist/types/mcp/types.d.ts +1 -0
  29. package/dist/types/utils.d.ts +0 -3
  30. package/package.json +2 -2
  31. package/src/cli/cli-runner.ts +26 -1
  32. package/src/cli/index.ts +1 -1
  33. package/src/constants/example-code.ts +25 -21
  34. package/src/env/parse-model-config.ts +21 -1
  35. package/src/env/types.ts +2 -0
  36. package/src/extractor/dom-util.ts +10 -5
  37. package/src/index.ts +0 -7
  38. package/src/logger.ts +0 -11
  39. package/src/mcp/tool-generator.ts +217 -66
  40. package/src/mcp/types.ts +4 -0
  41. package/src/utils.ts +0 -17
  42. package/dist/es/build/copy-static.mjs +0 -31
  43. package/dist/es/build/rspack-config.mjs +0 -4
  44. package/dist/lib/build/copy-static.js +0 -79
  45. package/dist/lib/build/rspack-config.js +0 -38
  46. package/dist/types/build/copy-static.d.ts +0 -31
  47. package/dist/types/build/rspack-config.d.ts +0 -8
  48. package/src/build/copy-static.ts +0 -68
  49. package/src/build/rspack-config.ts +0 -12
@@ -1,31 +0,0 @@
1
- import node_fs from "node:fs";
2
- import node_path from "node:path";
3
- const createCopyStaticPlugin = (options)=>({
4
- name: options.pluginName || 'copy-static',
5
- setup (api) {
6
- api.onAfterBuild(async ()=>{
7
- const { srcDir, destDir, faviconPath } = options;
8
- const stat = await node_fs.promises.lstat(destDir).catch(()=>null);
9
- if (stat?.isSymbolicLink()) await node_fs.promises.unlink(destDir);
10
- await node_fs.promises.mkdir(destDir, {
11
- recursive: true
12
- });
13
- await node_fs.promises.cp(srcDir, destDir, {
14
- recursive: true
15
- });
16
- console.log(`Copied build artifacts from ${srcDir} to ${destDir}`);
17
- if (faviconPath) {
18
- const faviconDest = node_path.join(destDir, 'favicon.ico');
19
- await node_fs.promises.copyFile(faviconPath, faviconDest);
20
- console.log(`Copied favicon from ${faviconPath} to ${faviconDest}`);
21
- }
22
- });
23
- }
24
- });
25
- const createPlaygroundCopyPlugin = (srcDir, destDir, pluginName, faviconSrc)=>createCopyStaticPlugin({
26
- srcDir,
27
- destDir,
28
- faviconPath: faviconSrc,
29
- pluginName
30
- });
31
- export { createCopyStaticPlugin, createPlaygroundCopyPlugin };
@@ -1,4 +0,0 @@
1
- const commonIgnoreWarnings = [
2
- /Critical dependency: the request of a dependency is an expression/
3
- ];
4
- export { commonIgnoreWarnings };
@@ -1,79 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.n = (module)=>{
5
- var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
- __webpack_require__.d(getter, {
7
- a: getter
8
- });
9
- return getter;
10
- };
11
- })();
12
- (()=>{
13
- __webpack_require__.d = (exports1, definition)=>{
14
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
- enumerable: true,
16
- get: definition[key]
17
- });
18
- };
19
- })();
20
- (()=>{
21
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
22
- })();
23
- (()=>{
24
- __webpack_require__.r = (exports1)=>{
25
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
- value: 'Module'
27
- });
28
- Object.defineProperty(exports1, '__esModule', {
29
- value: true
30
- });
31
- };
32
- })();
33
- var __webpack_exports__ = {};
34
- __webpack_require__.r(__webpack_exports__);
35
- __webpack_require__.d(__webpack_exports__, {
36
- createCopyStaticPlugin: ()=>createCopyStaticPlugin,
37
- createPlaygroundCopyPlugin: ()=>createPlaygroundCopyPlugin
38
- });
39
- const external_node_fs_namespaceObject = require("node:fs");
40
- var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
41
- const external_node_path_namespaceObject = require("node:path");
42
- var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
43
- const createCopyStaticPlugin = (options)=>({
44
- name: options.pluginName || 'copy-static',
45
- setup (api) {
46
- api.onAfterBuild(async ()=>{
47
- const { srcDir, destDir, faviconPath } = options;
48
- const stat = await external_node_fs_default().promises.lstat(destDir).catch(()=>null);
49
- if (stat?.isSymbolicLink()) await external_node_fs_default().promises.unlink(destDir);
50
- await external_node_fs_default().promises.mkdir(destDir, {
51
- recursive: true
52
- });
53
- await external_node_fs_default().promises.cp(srcDir, destDir, {
54
- recursive: true
55
- });
56
- console.log(`Copied build artifacts from ${srcDir} to ${destDir}`);
57
- if (faviconPath) {
58
- const faviconDest = external_node_path_default().join(destDir, 'favicon.ico');
59
- await external_node_fs_default().promises.copyFile(faviconPath, faviconDest);
60
- console.log(`Copied favicon from ${faviconPath} to ${faviconDest}`);
61
- }
62
- });
63
- }
64
- });
65
- const createPlaygroundCopyPlugin = (srcDir, destDir, pluginName, faviconSrc)=>createCopyStaticPlugin({
66
- srcDir,
67
- destDir,
68
- faviconPath: faviconSrc,
69
- pluginName
70
- });
71
- exports.createCopyStaticPlugin = __webpack_exports__.createCopyStaticPlugin;
72
- exports.createPlaygroundCopyPlugin = __webpack_exports__.createPlaygroundCopyPlugin;
73
- for(var __rspack_i in __webpack_exports__)if (-1 === [
74
- "createCopyStaticPlugin",
75
- "createPlaygroundCopyPlugin"
76
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
77
- Object.defineProperty(exports, '__esModule', {
78
- value: true
79
- });
@@ -1,38 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, definition)=>{
5
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
- enumerable: true,
7
- get: definition[key]
8
- });
9
- };
10
- })();
11
- (()=>{
12
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
- })();
14
- (()=>{
15
- __webpack_require__.r = (exports1)=>{
16
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
- value: 'Module'
18
- });
19
- Object.defineProperty(exports1, '__esModule', {
20
- value: true
21
- });
22
- };
23
- })();
24
- var __webpack_exports__ = {};
25
- __webpack_require__.r(__webpack_exports__);
26
- __webpack_require__.d(__webpack_exports__, {
27
- commonIgnoreWarnings: ()=>commonIgnoreWarnings
28
- });
29
- const commonIgnoreWarnings = [
30
- /Critical dependency: the request of a dependency is an expression/
31
- ];
32
- exports.commonIgnoreWarnings = __webpack_exports__.commonIgnoreWarnings;
33
- for(var __rspack_i in __webpack_exports__)if (-1 === [
34
- "commonIgnoreWarnings"
35
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
36
- Object.defineProperty(exports, '__esModule', {
37
- value: true
38
- });
@@ -1,31 +0,0 @@
1
- export interface CopyStaticOptions {
2
- /** Source directory to copy from */
3
- srcDir: string;
4
- /** Destination directory to copy to */
5
- destDir: string;
6
- /** Optional favicon source path (relative to directory containing srcDir) */
7
- faviconPath?: string;
8
- /** Name for the rsbuild plugin */
9
- pluginName?: string;
10
- }
11
- /**
12
- * Creates an rsbuild plugin that copies static files after build
13
- * @param options Configuration options for copying static files
14
- * @returns Rsbuild plugin object
15
- */
16
- export declare const createCopyStaticPlugin: (options: CopyStaticOptions) => {
17
- name: string;
18
- setup(api: any): void;
19
- };
20
- /**
21
- * Helper function to create a copy static plugin for playground builds
22
- * @param srcDir Source directory (usually dist directory)
23
- * @param destDir Destination directory
24
- * @param pluginName Optional plugin name
25
- * @param faviconSrc Optional favicon source path
26
- * @returns Rsbuild plugin
27
- */
28
- export declare const createPlaygroundCopyPlugin: (srcDir: string, destDir: string, pluginName?: string, faviconSrc?: string) => {
29
- name: string;
30
- setup(api: any): void;
31
- };
@@ -1,8 +0,0 @@
1
- /**
2
- * Common Rspack configuration helpers for rsbuild projects
3
- */
4
- /**
5
- * Common warning patterns to ignore in Rspack builds.
6
- * These warnings are typically from optional dependencies or known non-critical issues.
7
- */
8
- export declare const commonIgnoreWarnings: RegExp[];
@@ -1,68 +0,0 @@
1
- import fs from 'node:fs';
2
- import path from 'node:path';
3
-
4
- export interface CopyStaticOptions {
5
- /** Source directory to copy from */
6
- srcDir: string;
7
- /** Destination directory to copy to */
8
- destDir: string;
9
- /** Optional favicon source path (relative to directory containing srcDir) */
10
- faviconPath?: string;
11
- /** Name for the rsbuild plugin */
12
- pluginName?: string;
13
- }
14
-
15
- /**
16
- * Creates an rsbuild plugin that copies static files after build
17
- * @param options Configuration options for copying static files
18
- * @returns Rsbuild plugin object
19
- */
20
- export const createCopyStaticPlugin = (options: CopyStaticOptions) => ({
21
- name: options.pluginName || 'copy-static',
22
- setup(api: any) {
23
- api.onAfterBuild(async () => {
24
- const { srcDir, destDir, faviconPath } = options;
25
-
26
- // Remove symlink left by dev mode before copying
27
- const stat = await fs.promises.lstat(destDir).catch(() => null);
28
- if (stat?.isSymbolicLink()) {
29
- await fs.promises.unlink(destDir);
30
- }
31
-
32
- await fs.promises.mkdir(destDir, { recursive: true });
33
-
34
- // Copy directory contents recursively
35
- await fs.promises.cp(srcDir, destDir, { recursive: true });
36
- console.log(`Copied build artifacts from ${srcDir} to ${destDir}`);
37
-
38
- // Copy favicon if specified
39
- if (faviconPath) {
40
- const faviconDest = path.join(destDir, 'favicon.ico');
41
- await fs.promises.copyFile(faviconPath, faviconDest);
42
- console.log(`Copied favicon from ${faviconPath} to ${faviconDest}`);
43
- }
44
- });
45
- },
46
- });
47
-
48
- /**
49
- * Helper function to create a copy static plugin for playground builds
50
- * @param srcDir Source directory (usually dist directory)
51
- * @param destDir Destination directory
52
- * @param pluginName Optional plugin name
53
- * @param faviconSrc Optional favicon source path
54
- * @returns Rsbuild plugin
55
- */
56
- export const createPlaygroundCopyPlugin = (
57
- srcDir: string,
58
- destDir: string,
59
- pluginName?: string,
60
- faviconSrc?: string,
61
- ) => {
62
- return createCopyStaticPlugin({
63
- srcDir,
64
- destDir,
65
- faviconPath: faviconSrc,
66
- pluginName,
67
- });
68
- };
@@ -1,12 +0,0 @@
1
- /**
2
- * Common Rspack configuration helpers for rsbuild projects
3
- */
4
-
5
- /**
6
- * Common warning patterns to ignore in Rspack builds.
7
- * These warnings are typically from optional dependencies or known non-critical issues.
8
- */
9
- export const commonIgnoreWarnings = [
10
- // Ignore dynamic import warnings from langsmith/langfuse optional dependencies
11
- /Critical dependency: the request of a dependency is an expression/,
12
- ];