ultimate-jekyll-manager 0.0.201 → 0.0.203

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.
@@ -203,6 +203,7 @@ async function sendUserSignupMetadata(user, webManager) {
203
203
  const response = await authorizedFetch(serverApiURL, {
204
204
  method: 'POST',
205
205
  response: 'json',
206
+ tries: 3,
206
207
  body: payload,
207
208
  });
208
209
 
@@ -25,7 +25,7 @@ export async function authorizedFetch(url, options = {}) {
25
25
  }
26
26
 
27
27
  // Get the ID token - let it throw if it fails
28
- const idToken = await user.getIdToken();
28
+ const idToken = await user.getIdToken(true);
29
29
 
30
30
  // Ensure headers object exists
31
31
  if (!requestOptions.headers) {
@@ -33,7 +33,7 @@ export async function authorizedFetch(url, options = {}) {
33
33
  }
34
34
 
35
35
  // Set the Authorization header with Bearer token
36
- requestOptions.headers['Authorization'] = 'Bearer ' + idToken;
36
+ requestOptions.headers['Authorization'] = `Bearer ${idToken}`;
37
37
 
38
38
  // Make the request using wonderful-fetch
39
39
  return fetch(url, requestOptions);
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Webpack Loader: strip-dev-blocks-loader
3
+ * Strips code between /* @dev-only:start * / and /* @dev-only:end * / markers
4
+ * Runs before webpack bundles, so the source code is still clean
5
+ */
6
+
7
+ const START_MARKER = '/* @dev-only:start */';
8
+ const END_MARKER = '/* @dev-only:end */';
9
+
10
+ function escapeRegex(str) {
11
+ return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
12
+ }
13
+
14
+ module.exports = function stripDevBlocksLoader(source) {
15
+ // Only strip in build mode
16
+ if (process.env.UJ_BUILD_MODE !== 'true') {
17
+ return source;
18
+ }
19
+
20
+ // Strip everything between start and end markers
21
+ const pattern = new RegExp(
22
+ `${escapeRegex(START_MARKER)}[\\s\\S]*?${escapeRegex(END_MARKER)}`,
23
+ 'g'
24
+ );
25
+
26
+ return source.replace(pattern, '');
27
+ };
@@ -12,7 +12,7 @@ const filter = require('gulp-filter').default;
12
12
  const { template } = require('node-powertools');
13
13
  const yaml = require('js-yaml');
14
14
  const postcss = require('gulp-postcss');
15
- const purgeCss = require('@fullhuman/postcss-purgecss').default;
15
+ const purgeCss = require('@fullhuman/postcss-purgecss');
16
16
  const through2 = require('through2');
17
17
 
18
18
  // Load package
@@ -7,7 +7,7 @@ const path = require('path');
7
7
  const jetpack = require('fs-jetpack');
8
8
  const wp = require('webpack');
9
9
  const ReplacePlugin = require('../plugins/webpack/replace.js');
10
- const StripDevBlocksPlugin = require('../plugins/webpack/strip-dev-blocks.js');
10
+ const stripDevBlocksLoader = require.resolve('../loaders/webpack/strip-dev-blocks.js');
11
11
  const yaml = require('js-yaml');
12
12
  const version = require('wonderful-version');
13
13
 
@@ -113,7 +113,6 @@ function getSettings() {
113
113
  // devtool: 'source-map',
114
114
  // devtool: false,
115
115
  plugins: [
116
- new StripDevBlocksPlugin(),
117
116
  new ReplacePlugin(getTemplateReplaceOptions(), { type: 'template' }),
118
117
  // new wp.IgnorePlugin({
119
118
  // resourceRegExp: /^\.\/locale$/,
@@ -221,24 +220,27 @@ function getSettings() {
221
220
  {
222
221
  test: /\.js$/,
223
222
  exclude: /node_modules/,
224
- use: {
225
- loader: 'babel-loader',
226
- options: {
227
- // sourceMaps: false,
223
+ use: [
224
+ {
225
+ loader: 'babel-loader',
226
+ options: {
228
227
  sourceMaps: !Manager.actLikeProduction(),
229
- presets: [
230
- [require.resolve('@babel/preset-env', {
231
- paths: [path.resolve(process.cwd(), 'node_modules', package.name, 'node_modules')]
232
- }), {
233
- exclude: [
234
- // Prevent lighthouse error in 2025 about Legacy JavaScript
235
- // 'es.array.from',
236
- ]
237
- }]
238
- ],
239
- compact: Manager.isBuildMode(),
240
- }
241
- }
228
+ presets: [
229
+ [require.resolve('@babel/preset-env', {
230
+ paths: [path.resolve(process.cwd(), 'node_modules', package.name, 'node_modules')]
231
+ }), {
232
+ exclude: [
233
+ // Prevent lighthouse error in 2025 about Legacy JavaScript
234
+ // 'es.array.from',
235
+ ]
236
+ }]
237
+ ],
238
+ compact: Manager.isBuildMode(),
239
+ }
240
+ },
241
+ // Strip dev-only blocks before babel processes the file
242
+ stripDevBlocksLoader,
243
+ ]
242
244
  },
243
245
  // {
244
246
  // test: /\.js$/,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultimate-jekyll-manager",
3
- "version": "0.0.201",
3
+ "version": "0.0.203",
4
4
  "description": "Ultimate Jekyll dependency manager",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
@@ -1,53 +0,0 @@
1
- // Plugin: StripDevBlocksPlugin
2
- class StripDevBlocksPlugin {
3
- constructor(options = {}) {
4
- this.options = Object.assign(
5
- {
6
- fileTest: /\.js$/,
7
- startMarker: '/* @dev-only:start */',
8
- endMarker: '/* @dev-only:end */',
9
- },
10
- options
11
- )
12
- this.enabled = process.env.UJ_BUILD_MODE === 'true'
13
- }
14
-
15
- apply(compiler) {
16
- if (!this.enabled) return
17
-
18
- compiler.hooks.compilation.tap('StripDevBlocksPlugin', (compilation) => {
19
- compilation.hooks.processAssets.tap(
20
- {
21
- name: 'StripDevBlocksPlugin',
22
- stage: compilation.PROCESS_ASSETS_STAGE_OPTIMIZE,
23
- },
24
- (assets) => {
25
- for (const filename in assets) {
26
- if (!this.options.fileTest.test(filename)) continue
27
-
28
- let source = assets[filename].source()
29
-
30
- // Strip everything between start and end marker
31
- const pattern = new RegExp(
32
- `${this.escape(this.options.startMarker)}[\\s\\S]*?${this.escape(this.options.endMarker)}`,
33
- 'g'
34
- )
35
- source = source.replace(pattern, '')
36
-
37
- compilation.updateAsset(
38
- filename,
39
- new compiler.webpack.sources.RawSource(source)
40
- )
41
- }
42
- }
43
- )
44
- })
45
- }
46
-
47
- escape(str) {
48
- return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
49
- }
50
- }
51
-
52
- // Export
53
- module.exports = StripDevBlocksPlugin