@common-stack/generate-plugin 6.0.8-alpha.37 → 6.0.8-alpha.39

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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [6.0.8-alpha.39](https://github.com/cdmbase/common-stack/compare/v6.0.8-alpha.38...v6.0.8-alpha.39) (2025-02-01)
7
+
8
+ **Note:** Version bump only for package @common-stack/generate-plugin
9
+
10
+ ## [6.0.8-alpha.38](https://github.com/cdmbase/common-stack/compare/v6.0.8-alpha.37...v6.0.8-alpha.38) (2025-02-01)
11
+
12
+ **Note:** Version bump only for package @common-stack/generate-plugin
13
+
6
14
  ## [6.0.8-alpha.37](https://github.com/cdmbase/common-stack/compare/v6.0.8-alpha.36...v6.0.8-alpha.37) (2025-02-01)
7
15
 
8
16
  **Note:** Version bump only for package @common-stack/generate-plugin
@@ -80,7 +80,7 @@
80
80
  },
81
81
  "devDependencies": {
82
82
  "@cdmbase/vite-plugin-i18next-loader": "^2.0.12",
83
- "@common-stack/rollup-vite-utils": "6.0.8-alpha.33",
83
+ "@common-stack/rollup-vite-utils": "6.0.8-alpha.38",
84
84
  "@remix-run/dev": "~2.10.1",
85
85
  "@remix-run/serve": "~2.10.1",
86
86
  "cross-env": "^7.0.3",
@@ -151,8 +151,8 @@
151
151
  "@babel/register": "^7.18.9",
152
152
  "@babel/runtime": "^7.20.1",
153
153
  "@common-stack/env-list-loader": "6.0.8-alpha.31",
154
- "@common-stack/generate-plugin": "6.0.8-alpha.36",
155
- "@common-stack/rollup-vite-utils": "6.0.8-alpha.33",
154
+ "@common-stack/generate-plugin": "6.0.8-alpha.38",
155
+ "@common-stack/rollup-vite-utils": "6.0.8-alpha.38",
156
156
  "@emotion/babel-plugin": "^11.11.0",
157
157
  "@graphql-codegen/add": "^5.0.2",
158
158
  "@graphql-codegen/cli": "^5.0.2",
@@ -9,7 +9,6 @@ import modifyLibFilesPlugin from '@common-stack/rollup-vite-utils/lib/rollup/rol
9
9
  import generateJsonFromObject from '@common-stack/rollup-vite-utils/lib/rollup/rollupPluginGenerateJson.js';
10
10
  import addJsExtensionToImportsPlugin from '@common-stack/rollup-vite-utils/lib/rollup/rollupPluginAddJsExtension.js';
11
11
  import { ignoreCssUrlPlugin } from '@common-stack/rollup-vite-utils/lib/rollup/pluginIgnore.js';
12
-
13
12
  // Define any additional plugins specific to this bundle
14
13
  const additionalPlugins = [
15
14
  copy({ patterns: ['**/cdm-locales/**/*', '**/*.gql', '**/**/*.graphql', '**/styles/**/*', '**/css/**/*'], rootDir: './src' }),
@@ -47,6 +46,7 @@ const baseConfig = {
47
46
  outputDir: 'lib', // Ensure this matches your actual output directory
48
47
  }),
49
48
  generateJsonFromObject({}),
49
+
50
50
  ...additionalPlugins,
51
51
  ],
52
52
  external: (id) => !/^[./]/.test(id),
@@ -54,101 +54,21 @@ const baseConfig = {
54
54
  };
55
55
 
56
56
  // Function to create a configuration by extending the base
57
- function createRollupConfig(overrides) {
58
- return deepMergeConfigs(baseConfig, overrides);
59
- }
60
- function watch(watchOptions, buildMode = '') {
61
- const filename = path.basename(watchOptions.input);
62
- message(
63
- 'note',
64
- `${dt()} Rollup: Watcher Starting - watching for changes starting with: "${filename}" buildMode="${buildMode}"...`,
65
- 'WATCH ',
66
- true,
67
- );
68
- const watcher = rollup.watch(watchOptions);
69
-
70
- watcher.on('event', (event) => {
71
- // event.code can be one of:
72
- // START — the watcher is (re)starting
73
- // BUNDLE_START — building an individual bundle
74
- // * event.input will be the input options object if present
75
- // * event.output contains an array of the "file" or
76
- // "dir" option values of the generated outputs
77
- // BUNDLE_END — finished building a bundle
78
- // * event.input will be the input options object if present
79
- // * event.output contains an array of the "file" or
80
- // "dir" option values of the generated outputs
81
- // * event.duration is the build duration in milliseconds
82
- // * event.result contains the bundle object that can be
83
- // used to generate additional outputs by calling
84
- // bundle.generate or bundle.write. This is especially
85
- // important when the watch.skipWrite option is used.
86
- // You should call "event.result.close()" once you are done
87
- // generating outputs, or if you do not generate outputs.
88
- // This will allow plugins to clean up resources via the
89
- // "closeBundle" hook.
90
- // END — finished building all bundles
91
- // ERROR — encountered an error while bundling
92
- // * event.error contains the error that was thrown
93
- // * event.result is null for build errors and contains the
94
- // bundle object for output generation errors. As with
95
- // "BUNDLE_END", you should call "event.result.close()" if
96
- // present once you are done.
97
- // If you return a Promise from your event handler, Rollup will wait until the
98
- // Promise is resolved before continuing.
99
- // console.log(`rollup: ${event.code}`)
100
- if (event.code === 'BUNDLE_END') {
101
- const outputFiles = event.output.map((o) => path.basename(o)).join(', .../');
102
- const msg = `${dt()} Rollup: wrote bundle${event.output.length > 1 ? 's' : ''}: ".../${outputFiles}"`;
103
- if (NOTIFY) {
104
- notifier.notify({
105
- title: 'React Component Build',
106
- message: msg,
107
- });
108
- }
109
- // messenger: success, warn, critical, note, log
110
- message('success', msg, 'SUCCESS', true);
111
- } else if (event.code === 'ERROR') {
112
- message('critical', `!!!!!!!!!!!!!!!\nRollup ${event.error}\n!!!!!!!!!!!!!!!\n`, 'ERROR', true);
113
- if (NOTIFY) {
114
- notifier.notify({
115
- title: 'NotePlan Plugins Build',
116
- message: `An error occurred during build process.\nSee console for more information`,
117
- });
118
- }
119
- }
120
- });
57
+ function createRollupConfig(overrides, isWatchMode = false) {
58
+ const config = deepMergeConfigs(baseConfig, overrides);
121
59
 
122
- // This will make sure that bundles are properly closed after each run
123
- watcher.on('event', ({ result }) => {
124
- if (result) {
125
- result.close();
60
+ // Adjust TypeScript plugin based on watch mode
61
+ config.plugins = config.plugins.map((plugin) => {
62
+ if (plugin.name === 'typescript') {
63
+ return typescript({
64
+ ...plugin.options,
65
+ noEmitOnError: !isWatchMode, // Set to false only in watch mode
66
+ });
126
67
  }
68
+ return plugin;
127
69
  });
128
70
 
129
- // Additionally, you can hook into the following. Again, return a Promise to
130
- // make Rollup wait at that stage:
131
- watcher.on('change', (id /* , { event } */) => {
132
- const filename = path.basename(id);
133
- message('info', `${dt()} Rollup: file: "${filename}" changed`, 'CHANGE', true);
134
- /* a file was modified */
135
- });
136
- watcher.on('restart', () => {
137
- // console.log(`rollup: restarting`)
138
- /* a new run was triggered (usually a watched file change) */
139
- });
140
- watcher.on('close', () => {
141
- console.log(`rollup: closing`);
142
- /* the watcher was closed, see below */
143
- });
144
- process.on('SIGINT', async function () {
145
- console.log('\n\n');
146
- console.log(colors.yellow('Quitting...\n'));
147
- if (watcher) {
148
- await watcher.close();
149
- }
150
- process.exit();
151
- });
71
+ return config;
152
72
  }
153
73
 
154
74
  export { createRollupConfig, baseConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@common-stack/generate-plugin",
3
- "version": "6.0.8-alpha.37",
3
+ "version": "6.0.8-alpha.39",
4
4
  "type": "module",
5
5
  "main": "./lib/index.mjs",
6
6
  "typings": "./lib/index.d.ts",
@@ -17,7 +17,7 @@
17
17
  "watch": "yarn build:lib:watch"
18
18
  },
19
19
  "dependencies": {
20
- "@common-stack/rollup-vite-utils": "6.0.8-alpha.37",
20
+ "@common-stack/rollup-vite-utils": "6.0.8-alpha.38",
21
21
  "tslib": "^2.3.0"
22
22
  },
23
23
  "publishConfig": {
@@ -25,5 +25,5 @@
25
25
  },
26
26
  "executors": "./executors.json",
27
27
  "generators": "./generators.json",
28
- "gitHead": "d35ca66d58ef400304d37e106051970a70d11ed2"
28
+ "gitHead": "abba2fa12d6860b41a76d668a817cea36d5c8624"
29
29
  }
@@ -151,8 +151,8 @@
151
151
  "@babel/register": "^7.18.9",
152
152
  "@babel/runtime": "^7.20.1",
153
153
  "@common-stack/env-list-loader": "6.0.8-alpha.31",
154
- "@common-stack/generate-plugin": "6.0.8-alpha.36",
155
- "@common-stack/rollup-vite-utils": "6.0.8-alpha.33",
154
+ "@common-stack/generate-plugin": "6.0.8-alpha.38",
155
+ "@common-stack/rollup-vite-utils": "6.0.8-alpha.38",
156
156
  "@emotion/babel-plugin": "^11.11.0",
157
157
  "@graphql-codegen/add": "^5.0.2",
158
158
  "@graphql-codegen/cli": "^5.0.2",
@@ -9,7 +9,6 @@ import modifyLibFilesPlugin from '@common-stack/rollup-vite-utils/lib/rollup/rol
9
9
  import generateJsonFromObject from '@common-stack/rollup-vite-utils/lib/rollup/rollupPluginGenerateJson.js';
10
10
  import addJsExtensionToImportsPlugin from '@common-stack/rollup-vite-utils/lib/rollup/rollupPluginAddJsExtension.js';
11
11
  import { ignoreCssUrlPlugin } from '@common-stack/rollup-vite-utils/lib/rollup/pluginIgnore.js';
12
-
13
12
  // Define any additional plugins specific to this bundle
14
13
  const additionalPlugins = [
15
14
  copy({ patterns: ['**/cdm-locales/**/*', '**/*.gql', '**/**/*.graphql', '**/styles/**/*', '**/css/**/*'], rootDir: './src' }),
@@ -47,6 +46,7 @@ const baseConfig = {
47
46
  outputDir: 'lib', // Ensure this matches your actual output directory
48
47
  }),
49
48
  generateJsonFromObject({}),
49
+
50
50
  ...additionalPlugins,
51
51
  ],
52
52
  external: (id) => !/^[./]/.test(id),
@@ -54,101 +54,21 @@ const baseConfig = {
54
54
  };
55
55
 
56
56
  // Function to create a configuration by extending the base
57
- function createRollupConfig(overrides) {
58
- return deepMergeConfigs(baseConfig, overrides);
59
- }
60
- function watch(watchOptions, buildMode = '') {
61
- const filename = path.basename(watchOptions.input);
62
- message(
63
- 'note',
64
- `${dt()} Rollup: Watcher Starting - watching for changes starting with: "${filename}" buildMode="${buildMode}"...`,
65
- 'WATCH ',
66
- true,
67
- );
68
- const watcher = rollup.watch(watchOptions);
69
-
70
- watcher.on('event', (event) => {
71
- // event.code can be one of:
72
- // START — the watcher is (re)starting
73
- // BUNDLE_START — building an individual bundle
74
- // * event.input will be the input options object if present
75
- // * event.output contains an array of the "file" or
76
- // "dir" option values of the generated outputs
77
- // BUNDLE_END — finished building a bundle
78
- // * event.input will be the input options object if present
79
- // * event.output contains an array of the "file" or
80
- // "dir" option values of the generated outputs
81
- // * event.duration is the build duration in milliseconds
82
- // * event.result contains the bundle object that can be
83
- // used to generate additional outputs by calling
84
- // bundle.generate or bundle.write. This is especially
85
- // important when the watch.skipWrite option is used.
86
- // You should call "event.result.close()" once you are done
87
- // generating outputs, or if you do not generate outputs.
88
- // This will allow plugins to clean up resources via the
89
- // "closeBundle" hook.
90
- // END — finished building all bundles
91
- // ERROR — encountered an error while bundling
92
- // * event.error contains the error that was thrown
93
- // * event.result is null for build errors and contains the
94
- // bundle object for output generation errors. As with
95
- // "BUNDLE_END", you should call "event.result.close()" if
96
- // present once you are done.
97
- // If you return a Promise from your event handler, Rollup will wait until the
98
- // Promise is resolved before continuing.
99
- // console.log(`rollup: ${event.code}`)
100
- if (event.code === 'BUNDLE_END') {
101
- const outputFiles = event.output.map((o) => path.basename(o)).join(', .../');
102
- const msg = `${dt()} Rollup: wrote bundle${event.output.length > 1 ? 's' : ''}: ".../${outputFiles}"`;
103
- if (NOTIFY) {
104
- notifier.notify({
105
- title: 'React Component Build',
106
- message: msg,
107
- });
108
- }
109
- // messenger: success, warn, critical, note, log
110
- message('success', msg, 'SUCCESS', true);
111
- } else if (event.code === 'ERROR') {
112
- message('critical', `!!!!!!!!!!!!!!!\nRollup ${event.error}\n!!!!!!!!!!!!!!!\n`, 'ERROR', true);
113
- if (NOTIFY) {
114
- notifier.notify({
115
- title: 'NotePlan Plugins Build',
116
- message: `An error occurred during build process.\nSee console for more information`,
117
- });
118
- }
119
- }
120
- });
57
+ function createRollupConfig(overrides, isWatchMode = false) {
58
+ const config = deepMergeConfigs(baseConfig, overrides);
121
59
 
122
- // This will make sure that bundles are properly closed after each run
123
- watcher.on('event', ({ result }) => {
124
- if (result) {
125
- result.close();
60
+ // Adjust TypeScript plugin based on watch mode
61
+ config.plugins = config.plugins.map((plugin) => {
62
+ if (plugin.name === 'typescript') {
63
+ return typescript({
64
+ ...plugin.options,
65
+ noEmitOnError: !isWatchMode, // Set to false only in watch mode
66
+ });
126
67
  }
68
+ return plugin;
127
69
  });
128
70
 
129
- // Additionally, you can hook into the following. Again, return a Promise to
130
- // make Rollup wait at that stage:
131
- watcher.on('change', (id /* , { event } */) => {
132
- const filename = path.basename(id);
133
- message('info', `${dt()} Rollup: file: "${filename}" changed`, 'CHANGE', true);
134
- /* a file was modified */
135
- });
136
- watcher.on('restart', () => {
137
- // console.log(`rollup: restarting`)
138
- /* a new run was triggered (usually a watched file change) */
139
- });
140
- watcher.on('close', () => {
141
- console.log(`rollup: closing`);
142
- /* the watcher was closed, see below */
143
- });
144
- process.on('SIGINT', async function () {
145
- console.log('\n\n');
146
- console.log(colors.yellow('Quitting...\n'));
147
- if (watcher) {
148
- await watcher.close();
149
- }
150
- process.exit();
151
- });
71
+ return config;
152
72
  }
153
73
 
154
74
  export { createRollupConfig, baseConfig };