alert-message-plugin-flow-requests 1.1.0 → 1.2.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.
package/package.json CHANGED
@@ -1,14 +1,13 @@
1
1
  {
2
2
  "name": "alert-message-plugin-flow-requests",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Alert message plugin to Flow requests",
5
- "main": "dist/bundle.js",
5
+ "main": "./dist/node-bundle.js",
6
+ "browser": "./dist/browser-bundle.js",
6
7
  "types": "dist/index.d.ts",
7
8
  "type": "module",
8
9
  "scripts": {
9
10
  "build": "webpack",
10
- "prepublish": "pnpm run build",
11
- "preinstall": "pnpm run build",
12
11
  "start": "tsx src/index.ts",
13
12
  "test": "jest ./tests/*.spec.ts"
14
13
  },
package/src/index.ts CHANGED
@@ -39,4 +39,14 @@ class AlertMessageNode extends NodeBase {
39
39
  }
40
40
  }
41
41
 
42
+ // import AlertMessageT from "../dist/node-bundle";
43
+
44
+ // console.log(
45
+ // new AlertMessageT.default().execute({
46
+ // settings: {
47
+ // message: "abc",
48
+ // },
49
+ // })
50
+ // );
51
+
42
52
  export default AlertMessageNode;
package/test.html ADDED
@@ -0,0 +1,21 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Document</title>
7
+ </head>
8
+ <body>
9
+ <script src="./dist/browser-bundle.js"></script>
10
+ <script>
11
+ const instance = eval(`AlertMessage`);
12
+ console.log(
13
+ new instance.default({}).execute({
14
+ settings: {
15
+ message: "Abc abc abc",
16
+ },
17
+ })
18
+ );
19
+ </script>
20
+ </body>
21
+ </html>
@@ -1,8 +1,25 @@
1
1
  const path = require("path");
2
2
 
3
- module.exports = {
4
- entry: "./src/index.ts", // Your main entry file
5
- mode: "production", // Use 'development' for dev, 'production' for final output
3
+ // Helper to get __dirname equivalent in ESM
4
+ // const __filename = fileURLToPath(import.meta.url);
5
+ // const __dirname = path.dirname(__filename);
6
+
7
+ const commonConfig = {
8
+ entry: "./src/index.ts",
9
+ mode: "production",
10
+ // Shared output settings
11
+ output: {
12
+ path: path.resolve(__dirname, "dist"),
13
+ clean: true, // Clean the output directory before build
14
+ library: {
15
+ name: "AlertMessage",
16
+ type: "var",
17
+ },
18
+ },
19
+ // Ensure we can resolve ESM modules strictly
20
+ resolve: {
21
+ extensions: ["ts", ".js", ".mjs"],
22
+ },
6
23
  module: {
7
24
  rules: [
8
25
  {
@@ -12,16 +29,73 @@ module.exports = {
12
29
  },
13
30
  ],
14
31
  },
15
- resolve: {
16
- extensions: [".ts", ".js"],
32
+
33
+ // Add other loaders (e.g., Babel) if needed
34
+ };
35
+
36
+ // Configuration for Node.js bundle
37
+ const nodeConfig = {
38
+ ...commonConfig,
39
+ target: "node", // Target Node.js environment
40
+ output: {
41
+ ...commonConfig.output,
42
+ filename: "node-bundle.js",
43
+ library: {
44
+ type: "module", // Output as an ES module
45
+ },
17
46
  },
47
+ // Tells webpack to externalize node_modules
48
+ // (typically you don't bundle them for Node)
49
+ externalsPresets: { node: true },
50
+ experiments: {
51
+ outputModule: true, // Enable experimental output module support
52
+ },
53
+ };
54
+
55
+ // Configuration for Browser bundle
56
+ const browserConfig = {
57
+ ...commonConfig,
58
+ target: "web", // Target web environment
18
59
  output: {
19
- filename: "bundle.js",
20
- path: path.resolve(__dirname, "dist"),
60
+ ...commonConfig.output,
61
+ filename: "browser-bundle.js",
62
+ // You can use 'module' here as well, but 'umd' or 'assign'
63
+ // are more flexible for general browser usage (e.g., script tag or module import)
64
+ // 'module' requires <script type="module">
21
65
  library: {
22
- name: "AlertMessage",
23
- type: "var",
66
+ ...commonConfig.output.library,
67
+ type: "umd",
24
68
  },
25
- libraryTarget: "umd",
69
+ },
70
+ experiments: {
71
+ outputModule: true, // Enable experimental output module support
26
72
  },
27
73
  };
74
+
75
+ module.exports = [nodeConfig, browserConfig];
76
+
77
+ // module.exports = {
78
+ // entry: "./src/index.ts", // Your main entry file
79
+ // mode: "production", // Use 'development' for dev, 'production' for final output
80
+ // module: {
81
+ // rules: [
82
+ // {
83
+ // test: /\.ts$/,
84
+ // use: "ts-loader",
85
+ // exclude: /node_modules/,
86
+ // },
87
+ // ],
88
+ // },
89
+ // resolve: {
90
+ // extensions: [".ts", ".js"],
91
+ // },
92
+ // output: {
93
+ // filename: "bundle.js",
94
+ // path: path.resolve(__dirname, "dist"),
95
+ // library: {
96
+ // name: "AlertMessage",
97
+ // type: "var",
98
+ // },
99
+ // libraryTarget: "umd",
100
+ // },
101
+ // };
package/dist/bundle.js DELETED
@@ -1 +0,0 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AlertMessage=t():e.AlertMessage=t()}(self,()=>(()=>{"use strict";var __webpack_modules__={191(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.LinkedList=t.Node=void 0;class s{value;next;constructor(e,t){this.value=e,this.next=t}}t.Node=s;class o{head;tail;constructor(){this.head=null,this.tail=null}add(e){if(!this.head)return this.head=new s(e,null),void(this.tail=null);if(!this.head.next){const t=new s(e,null);return this.head.next=t,void(this.tail=t)}const t=this.tail,o=new s(e,null);t&&(t.next=o),this.tail=o}show(){if(!this.head)return null;let e=this.head;for(;null!=e;)e=e.value instanceof o?e.value.head:e.next}}t.LinkedList=o},638(__unused_webpack_module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.NodeBase=void 0;class NodeBase{state;constructor(e){this.state=e}parseExpression(expression){const regex=/{{(.*?)}}/g,matches=expression.match(regex);return matches&&matches.forEach(match=>{const key=match.replace("{{","").replace("}}","");let value=eval(key);"object"==typeof value&&(value=JSON.stringify(value)),expression=expression.replace(match,value)}),expression}getConfig(){throw new Error("Method not implemented")}execute(e){throw new Error("Method not implemented")}}exports.NodeBase=NodeBase},882(e,t,s){Object.defineProperty(t,"__esModule",{value:!0}),t.Node=t.LinkedList=t.NodeBase=void 0;const o=s(638);Object.defineProperty(t,"NodeBase",{enumerable:!0,get:function(){return o.NodeBase}});const r=s(191);Object.defineProperty(t,"LinkedList",{enumerable:!0,get:function(){return r.LinkedList}}),Object.defineProperty(t,"Node",{enumerable:!0,get:function(){return r.Node}})}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var s=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](s,s.exports,__webpack_require__),s.exports}var __webpack_exports__={};return(()=>{var e=__webpack_exports__;Object.defineProperty(e,"__esModule",{value:!0});const t=__webpack_require__(882);class s extends t.NodeBase{constructor(e){super(e)}getConfig(){return{name:"AlertMessage",type:"AlertMessage",description:"Show alert message when execute the node",properties:[{label:"Message",name:"message",type:"text",required:!0,default:null}]}}async execute(e){const t=e.settings;return"undefined"!=typeof window?alert(this.parseExpression(t.message)):console.log(t.message),{ok:!0}}}e.default=s})(),__webpack_exports__})());
package/dist/index.d.ts DELETED
@@ -1,8 +0,0 @@
1
- import { NodeBase, NodeConfig, NodeInput, NodeReturn } from "core-package-mini-n8n";
2
- declare class AlertMessageNode extends NodeBase {
3
- constructor(state: any);
4
- getConfig(): NodeConfig;
5
- execute(node: NodeInput): Promise<NodeReturn>;
6
- }
7
- export default AlertMessageNode;
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,UAAU,EACV,SAAS,EACT,UAAU,EACX,MAAM,uBAAuB,CAAC;AAE/B,cAAM,gBAAiB,SAAQ,QAAQ;gBACzB,KAAK,EAAE,GAAG;IAItB,SAAS,IAAI,UAAU;IAiBjB,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC;CAUpD;AAED,eAAe,gBAAgB,CAAC"}