browser-extension-manager 1.3.48 → 1.3.49

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.
@@ -2,7 +2,7 @@
2
2
  const Manager = new (require('../../build.js'));
3
3
  const logger = Manager.logger('defaults');
4
4
  const { src, dest, watch, series } = require('gulp');
5
- const through2 = require('through2');
5
+ const { Transform } = require('node:stream');
6
6
  const jetpack = require('fs-jetpack');
7
7
  const path = require('path');
8
8
  const { minimatch } = require('minimatch');
@@ -347,7 +347,9 @@ function defaults(complete, changedFile) {
347
347
  }
348
348
 
349
349
  function customTransform() {
350
- return through2.obj(function (file, _, callback) {
350
+ return new Transform({
351
+ objectMode: true,
352
+ transform(file, _, callback) {
351
353
  // Skip if it's a directory
352
354
  if (file.isDirectory()) {
353
355
  return callback(null, file);
@@ -477,6 +479,7 @@ function customTransform() {
477
479
 
478
480
  // Complete
479
481
  return callback();
482
+ },
480
483
  });
481
484
  }
482
485
  function defaultsWatcher(complete) {
@@ -2,7 +2,7 @@
2
2
  const Manager = new (require('../../build.js'));
3
3
  const logger = Manager.logger('distribute');
4
4
  const { src, dest, watch, series } = require('gulp');
5
- const through2 = require('through2');
5
+ const { Transform } = require('node:stream');
6
6
  const path = require('path');
7
7
  const jetpack = require('fs-jetpack');
8
8
  const createTemplateTransform = require('./utils/template-transform');
@@ -101,38 +101,41 @@ function distribute() {
101
101
  }
102
102
 
103
103
  function customTransform() {
104
- return through2.obj(function (file, _, callback) {
105
- // Skip if it's a directory
106
- if (file.isDirectory()) {
107
- return callback(null, file);
108
- }
109
-
110
- // Get relative path from src base
111
- const relativePath = path.relative(file.base, file.path).replace(/\\/g, '/');
112
-
113
- // Log
114
- if (LOUD) {
115
- logger.log(`Processing file: ${relativePath}`);
116
- }
117
-
118
- // Change path if it starts with 'pages/'
119
- // if (relativePath.startsWith('pages/')) {
120
- // // Remove 'pages/' prefix
121
- // const newRelativePath = relativePath.replace(/^pages\//, '');
122
-
123
- // // Update file path to remove pages directory
124
- // // This will make src/pages/index.html -> dist/index.html
125
- // file.path = path.join(file.base, newRelativePath);
126
-
127
- // // Log
128
- // logger.log(` -> Moving from pages/ to root: ${newRelativePath}`);
129
- // }
130
-
131
- // Push the file
132
- this.push(file);
133
-
134
- // Continue
135
- callback();
104
+ return new Transform({
105
+ objectMode: true,
106
+ transform(file, _, callback) {
107
+ // Skip if it's a directory
108
+ if (file.isDirectory()) {
109
+ return callback(null, file);
110
+ }
111
+
112
+ // Get relative path from src base
113
+ const relativePath = path.relative(file.base, file.path).replace(/\\/g, '/');
114
+
115
+ // Log
116
+ if (LOUD) {
117
+ logger.log(`Processing file: ${relativePath}`);
118
+ }
119
+
120
+ // Change path if it starts with 'pages/'
121
+ // if (relativePath.startsWith('pages/')) {
122
+ // // Remove 'pages/' prefix
123
+ // const newRelativePath = relativePath.replace(/^pages\//, '');
124
+
125
+ // // Update file path to remove pages directory
126
+ // // This will make src/pages/index.html -> dist/index.html
127
+ // file.path = path.join(file.base, newRelativePath);
128
+
129
+ // // Log
130
+ // logger.log(` -> Moving from pages/ to root: ${newRelativePath}`);
131
+ // }
132
+
133
+ // Push the file
134
+ this.push(file);
135
+
136
+ // Continue
137
+ callback();
138
+ },
136
139
  });
137
140
  }
138
141
 
@@ -2,7 +2,7 @@
2
2
  const Manager = new (require('../../build.js'));
3
3
  const logger = Manager.logger('html');
4
4
  const { src, dest, watch, series } = require('gulp');
5
- const through2 = require('through2');
5
+ const { Transform } = require('node:stream');
6
6
  const jetpack = require('fs-jetpack');
7
7
  const path = require('path');
8
8
  const { template } = require('node-powertools');
@@ -51,86 +51,89 @@ function html(complete) {
51
51
 
52
52
  // Process HTML transform
53
53
  function processHtml(templateContent) {
54
- return through2.obj(function (file, _, callback) {
55
- // Skip if it's a directory
56
- if (file.isDirectory()) {
57
- return callback(null, file);
58
- }
59
-
60
- try {
61
- // Get the view name from the file path
62
- const viewName = path.basename(file.path, '.html');
63
- const relativePath = path.relative(path.join(rootPathProject, 'src/views'), file.dirname);
64
- const viewNameWithPath = relativePath ? `${relativePath}/${viewName}` : viewName;
65
-
66
- // Read the content (body HTML)
67
- const bodyContent = file.contents.toString();
68
-
69
- // Determine the component name for CSS/JS loading
70
- // Template already includes /components/ prefix, so just provide the component path
71
- // Pages can have multiple files (index, pricing, login, etc.)
72
- // Other components (popup, options, etc.) only have index.html
73
- let componentName;
74
- if (relativePath.startsWith('pages/') || relativePath === 'pages') {
75
- // Pages directory: include full path with filename
76
- // pages/index.html -> pages/index
77
- // pages/pricing.html -> pages/pricing
78
- componentName = viewNameWithPath;
79
- } else if (relativePath && viewName === 'index') {
80
- // Other components with index.html: use just the directory name
81
- // popup/index.html -> popup
82
- // options/index.html -> options
83
- componentName = relativePath;
84
- } else if (relativePath) {
85
- // Non-index files in other directories: use full path
86
- componentName = viewNameWithPath;
87
- } else {
88
- // No path: use viewName
89
- componentName = viewName;
54
+ return new Transform({
55
+ objectMode: true,
56
+ transform(file, _, callback) {
57
+ // Skip if it's a directory
58
+ if (file.isDirectory()) {
59
+ return callback(null, file);
90
60
  }
91
61
 
92
- // Prepare template data
93
- const data = {
94
- content: bodyContent,
95
- page: {
96
- name: componentName,
97
- path: viewNameWithPath,
98
- title: config.brand?.name || 'Extension',
99
- },
100
- theme: {
101
- appearance: config.theme?.appearance || 'dark',
102
- },
103
- brand: config.brand || {},
104
- cacheBust: Date.now(),
105
- };
106
-
107
- // Apply template with custom brackets
108
- // First, template the body content to replace any {{ }} placeholders in the view
109
- const templatedBody = template(bodyContent, data, {
110
- brackets: ['{{', '}}'],
111
- });
112
-
113
- // Update data with templated body
114
- data.content = templatedBody;
115
-
116
- // Then template the outer page template
117
- const rendered = template(templateContent, data, {
118
- brackets: ['{{', '}}'],
119
- });
120
-
121
- // Update file contents
122
- file.contents = Buffer.from(rendered);
123
-
124
- // Log
125
- logger.log(`Processed: ${viewNameWithPath}.html`);
126
-
127
- // Push the file
128
- this.push(file);
129
- return callback();
130
- } catch (error) {
131
- logger.error('Error processing HTML:', error);
132
- return callback(error);
133
- }
62
+ try {
63
+ // Get the view name from the file path
64
+ const viewName = path.basename(file.path, '.html');
65
+ const relativePath = path.relative(path.join(rootPathProject, 'src/views'), file.dirname);
66
+ const viewNameWithPath = relativePath ? `${relativePath}/${viewName}` : viewName;
67
+
68
+ // Read the content (body HTML)
69
+ const bodyContent = file.contents.toString();
70
+
71
+ // Determine the component name for CSS/JS loading
72
+ // Template already includes /components/ prefix, so just provide the component path
73
+ // Pages can have multiple files (index, pricing, login, etc.)
74
+ // Other components (popup, options, etc.) only have index.html
75
+ let componentName;
76
+ if (relativePath.startsWith('pages/') || relativePath === 'pages') {
77
+ // Pages directory: include full path with filename
78
+ // pages/index.html -> pages/index
79
+ // pages/pricing.html -> pages/pricing
80
+ componentName = viewNameWithPath;
81
+ } else if (relativePath && viewName === 'index') {
82
+ // Other components with index.html: use just the directory name
83
+ // popup/index.html -> popup
84
+ // options/index.html -> options
85
+ componentName = relativePath;
86
+ } else if (relativePath) {
87
+ // Non-index files in other directories: use full path
88
+ componentName = viewNameWithPath;
89
+ } else {
90
+ // No path: use viewName
91
+ componentName = viewName;
92
+ }
93
+
94
+ // Prepare template data
95
+ const data = {
96
+ content: bodyContent,
97
+ page: {
98
+ name: componentName,
99
+ path: viewNameWithPath,
100
+ title: config.brand?.name || 'Extension',
101
+ },
102
+ theme: {
103
+ appearance: config.theme?.appearance || 'dark',
104
+ },
105
+ brand: config.brand || {},
106
+ cacheBust: Date.now(),
107
+ };
108
+
109
+ // Apply template with custom brackets
110
+ // First, template the body content to replace any {{ }} placeholders in the view
111
+ const templatedBody = template(bodyContent, data, {
112
+ brackets: ['{{', '}}'],
113
+ });
114
+
115
+ // Update data with templated body
116
+ data.content = templatedBody;
117
+
118
+ // Then template the outer page template
119
+ const rendered = template(templateContent, data, {
120
+ brackets: ['{{', '}}'],
121
+ });
122
+
123
+ // Update file contents
124
+ file.contents = Buffer.from(rendered);
125
+
126
+ // Log
127
+ logger.log(`Processed: ${viewNameWithPath}.html`);
128
+
129
+ // Push the file
130
+ this.push(file);
131
+ return callback();
132
+ } catch (error) {
133
+ logger.error('Error processing HTML:', error);
134
+ return callback(error);
135
+ }
136
+ },
134
137
  });
135
138
  }
136
139
 
@@ -1,49 +1,49 @@
1
1
  // Libraries
2
- const through2 = require('through2');
2
+ const { Transform } = require('node:stream');
3
3
  const { template } = require('node-powertools');
4
4
  const path = require('path');
5
5
 
6
6
  /**
7
- * Creates a through2 transform stream that processes template variables in files
7
+ * Creates a transform stream that processes template variables in files
8
8
  **/
9
9
  function createTemplateTransform(data) {
10
10
  const extensions = ['html', 'md', 'liquid', 'json', 'yml', 'yaml']
11
11
 
12
- return through2.obj(function(file, encoding, callback) {
13
- // Skip directories
14
- if (file.isDirectory()) {
15
- return callback(null, file);
16
- }
17
-
18
- // Check if file extension matches
19
- const ext = path.extname(file.path).toLowerCase().slice(1);
20
- if (!extensions.includes(ext)) {
21
- return callback(null, file);
22
- }
23
-
24
- // Log
25
- // console.log(`Processing file: ${file.path}`);
26
-
27
- // Process the file contents
28
- try {
29
- const contents = file.contents.toString();
30
-
31
- // Process templates
32
- const templated = template(contents, data, {
33
- brackets: ['[', ']'],
34
- });
35
-
36
- // Update file contents if changed
37
- if (contents !== templated) {
38
- file.contents = Buffer.from(templated);
39
- const relativePath = file.relative || file.path;
12
+ return new Transform({
13
+ objectMode: true,
14
+ transform(file, encoding, callback) {
15
+ // Skip directories
16
+ if (file.isDirectory()) {
17
+ return callback(null, file);
40
18
  }
41
- } catch (error) {
42
- console.error(`Error processing templates in ${file.path}:`, error);
43
- }
44
19
 
45
- // Pass the file through
46
- callback(null, file);
20
+ // Check if file extension matches
21
+ const ext = path.extname(file.path).toLowerCase().slice(1);
22
+ if (!extensions.includes(ext)) {
23
+ return callback(null, file);
24
+ }
25
+
26
+ // Process the file contents
27
+ try {
28
+ const contents = file.contents.toString();
29
+
30
+ // Process templates
31
+ const templated = template(contents, data, {
32
+ brackets: ['[', ']'],
33
+ });
34
+
35
+ // Update file contents if changed
36
+ if (contents !== templated) {
37
+ file.contents = Buffer.from(templated);
38
+ const relativePath = file.relative || file.path;
39
+ }
40
+ } catch (error) {
41
+ console.error(`Error processing templates in ${file.path}:`, error);
42
+ }
43
+
44
+ // Pass the file through
45
+ callback(null, file);
46
+ },
47
47
  });
48
48
  }
49
49
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browser-extension-manager",
3
- "version": "1.3.48",
3
+ "version": "1.3.49",
4
4
  "description": "Browser Extension Manager dependency manager",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
@@ -39,7 +39,8 @@
39
39
  "input": "./src",
40
40
  "output": "./dist",
41
41
  "replace": {},
42
- "type": "copy"
42
+ "type": "copy",
43
+ "hooks": {}
43
44
  },
44
45
  "projectScripts": {
45
46
  "start": "npx mgr clean && npx mgr setup && npm run gulp --",
@@ -72,17 +73,17 @@
72
73
  },
73
74
  "homepage": "https://template.itwcreativeworks.com",
74
75
  "dependencies": {
75
- "@anthropic-ai/claude-agent-sdk": "^0.2.90",
76
+ "@anthropic-ai/claude-agent-sdk": "^0.2.138",
76
77
  "@babel/core": "^7.29.0",
77
- "@babel/preset-env": "^7.29.2",
78
+ "@babel/preset-env": "^7.29.5",
78
79
  "@popperjs/core": "^2.11.8",
79
80
  "babel-loader": "^10.1.1",
80
81
  "chalk": "^5.6.2",
81
- "dotenv": "^17.4.0",
82
+ "dotenv": "^17.4.2",
82
83
  "fs-jetpack": "^5.1.0",
83
84
  "glob": "^13.0.6",
84
85
  "gulp-clean-css": "^4.3.0",
85
- "gulp-filter": "^9.0.1",
86
+ "gulp-filter": "^10.0.0",
86
87
  "gulp-rename": "^2.1.0",
87
88
  "gulp-responsive-modern": "^1.0.0",
88
89
  "gulp-sass": "^6.0.1",
@@ -92,11 +93,10 @@
92
93
  "minimatch": "^10.2.5",
93
94
  "node-powertools": "^3.0.0",
94
95
  "npm-api": "^1.0.1",
95
- "sass": "^1.98.0",
96
- "through2": "^4.0.2",
97
- "web-manager": "^4.1.36",
98
- "webpack": "^5.105.4",
99
- "wonderful-fetch": "^2.0.4",
96
+ "sass": "^1.99.0",
97
+ "web-manager": "^4.1.41",
98
+ "webpack": "^5.106.2",
99
+ "wonderful-fetch": "^2.0.5",
100
100
  "wonderful-version": "^1.3.2",
101
101
  "ws": "^8.20.0",
102
102
  "yargs": "^18.0.0"
@@ -105,6 +105,6 @@
105
105
  "gulp": "^5.0.1"
106
106
  },
107
107
  "devDependencies": {
108
- "prepare-package": "^2.0.7"
108
+ "prepare-package": "^2.1.0"
109
109
  }
110
110
  }