@nizza/devkit 0.1.0-alpha.9 → 0.1.0-beta.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/dist/cjs/executors/update-executors-file/index.cjs +2 -2
- package/dist/cjs/index.cjs +7 -7
- package/dist/cjs/node_modules/.pnpm/@vitejs_plugin-basic-ssl@1.0.2_vite@5.0.4/node_modules/@vitejs/plugin-basic-ssl/dist/chunks/certificate.cjs +19578 -0
- package/dist/cjs/node_modules/.pnpm/@vitejs_plugin-basic-ssl@1.0.2_vite@5.0.4/node_modules/@vitejs/plugin-basic-ssl/dist/index.cjs +40 -0
- package/dist/cjs/shared/utils.cjs +2 -2
- package/dist/cjs/{vite → vitejs}/config-builder/configs/base.cjs +3 -3
- package/dist/cjs/{vite → vitejs}/config-builder/configs/lib.cjs +2 -1
- package/dist/cjs/{vite → vitejs}/config-builder/plugins.cjs +16 -3
- package/dist/cjs/{vite → vitejs}/config-builder/shared/types.cjs +1 -0
- package/dist/cjs/{vite → vitejs}/config-builder/shared/utils/helpers.cjs +2 -2
- package/dist/cjs/{vite → vitejs}/plugins/third-party-css-inject/utils.cjs +1 -3
- package/dist/esm/executors/update-executors-file/index.mjs +2 -2
- package/dist/esm/index.mjs +7 -7
- package/dist/esm/node_modules/.pnpm/@vitejs_plugin-basic-ssl@1.0.2_vite@5.0.4/node_modules/@vitejs/plugin-basic-ssl/dist/chunks/certificate.mjs +19576 -0
- package/dist/esm/node_modules/.pnpm/@vitejs_plugin-basic-ssl@1.0.2_vite@5.0.4/node_modules/@vitejs/plugin-basic-ssl/dist/index.mjs +35 -0
- package/dist/esm/{vite → vitejs}/config-builder/configs/base.mjs +4 -4
- package/dist/esm/{vite → vitejs}/config-builder/configs/lib.mjs +2 -1
- package/dist/esm/{vite → vitejs}/config-builder/plugins.mjs +16 -4
- package/dist/esm/{vite → vitejs}/config-builder/shared/types.mjs +1 -0
- package/dist/esm/{vite → vitejs}/config-builder/shared/utils/helpers.mjs +2 -2
- package/dist/esm/{vite → vitejs}/plugins/third-party-css-inject/utils.mjs +1 -3
- package/dist/index.d.ts +367 -0
- package/package.json +4 -6
- package/dist/cjs/executors/deploy/helpers.d.cts +0 -4
- package/dist/cjs/executors/deploy/index.d.cts +0 -11
- package/dist/cjs/executors/environments/helpers.d.cts +0 -25
- package/dist/cjs/executors/environments/index.d.cts +0 -16
- package/dist/cjs/executors/publish/helpers.d.cts +0 -19
- package/dist/cjs/executors/publish/index.d.cts +0 -12
- package/dist/cjs/executors/shared/utils.d.cts +0 -27
- package/dist/cjs/executors/update-executors-file/helpers.d.cts +0 -17
- package/dist/cjs/executors/update-executors-file/index.d.cts +0 -12
- package/dist/cjs/executors/vtex-link/constants.d.cts +0 -4
- package/dist/cjs/executors/vtex-link/helpers.d.cts +0 -77
- package/dist/cjs/executors/vtex-link/index.d.cts +0 -5
- package/dist/cjs/index-0ce2daf7.d.ts +0 -2
- package/dist/cjs/index-17143e35.d.ts +0 -2
- package/dist/cjs/index-3080371d.d.ts +0 -3
- package/dist/cjs/index-f6330edc.d.ts +0 -2
- package/dist/cjs/index.d.cts +0 -9
- package/dist/cjs/index.d.cts.map +0 -1
- package/dist/cjs/scripts/changeset-pre-mode.d.cts +0 -2
- package/dist/cjs/scripts/index.d.cts +0 -1
- package/dist/cjs/shared/logger.d.cts +0 -33
- package/dist/cjs/shared/utils.d.cts +0 -18
- package/dist/cjs/types-1282e639.d.ts +0 -12
- package/dist/cjs/types-7377dcc9.d.ts +0 -4
- package/dist/cjs/types-763439e4.d.ts +0 -14
- package/dist/cjs/vite/config-builder/configs/app.d.cts +0 -4
- package/dist/cjs/vite/config-builder/configs/base.d.cts +0 -4
- package/dist/cjs/vite/config-builder/configs/index.d.cts +0 -7
- package/dist/cjs/vite/config-builder/configs/lib.d.cts +0 -4
- package/dist/cjs/vite/config-builder/configs/script.d.cts +0 -4
- package/dist/cjs/vite/config-builder/main.d.cts +0 -10
- package/dist/cjs/vite/config-builder/plugins.d.cts +0 -30
- package/dist/cjs/vite/config-builder/shared/types.d.cts +0 -155
- package/dist/cjs/vite/config-builder/shared/utils/helpers.d.cts +0 -71
- package/dist/cjs/vite/config-builder/shared/utils/projectConfig.d.cts +0 -60
- package/dist/cjs/vite/config-builder/shared/utils/viteCommand.d.cts +0 -24
- package/dist/cjs/vite/plugins/shadow-dom-inject-css/index.d.cts +0 -7
- package/dist/cjs/vite/plugins/third-party-css-inject/main.d.cts +0 -17
- package/dist/cjs/vite/plugins/third-party-css-inject/utils.d.cts +0 -5
- package/dist/esm/executors/deploy/helpers.d.mts +0 -4
- package/dist/esm/executors/deploy/index.d.mts +0 -11
- package/dist/esm/executors/environments/helpers.d.mts +0 -25
- package/dist/esm/executors/environments/index.d.mts +0 -16
- package/dist/esm/executors/publish/helpers.d.mts +0 -19
- package/dist/esm/executors/publish/index.d.mts +0 -12
- package/dist/esm/executors/shared/utils.d.mts +0 -27
- package/dist/esm/executors/update-executors-file/helpers.d.mts +0 -17
- package/dist/esm/executors/update-executors-file/index.d.mts +0 -12
- package/dist/esm/executors/vtex-link/constants.d.mts +0 -4
- package/dist/esm/executors/vtex-link/helpers.d.mts +0 -77
- package/dist/esm/executors/vtex-link/index.d.mts +0 -5
- package/dist/esm/index-0ce2daf7.d.ts +0 -2
- package/dist/esm/index-17143e35.d.ts +0 -2
- package/dist/esm/index-3080371d.d.ts +0 -3
- package/dist/esm/index-f6330edc.d.ts +0 -2
- package/dist/esm/index.d.mts +0 -9
- package/dist/esm/index.d.mts.map +0 -1
- package/dist/esm/scripts/changeset-pre-mode.d.mts +0 -2
- package/dist/esm/scripts/index.d.mts +0 -1
- package/dist/esm/shared/logger.d.mts +0 -33
- package/dist/esm/shared/utils.d.mts +0 -18
- package/dist/esm/types-1282e639.d.ts +0 -12
- package/dist/esm/types-7377dcc9.d.ts +0 -4
- package/dist/esm/types-763439e4.d.ts +0 -14
- package/dist/esm/vite/config-builder/configs/app.d.mts +0 -4
- package/dist/esm/vite/config-builder/configs/base.d.mts +0 -4
- package/dist/esm/vite/config-builder/configs/index.d.mts +0 -7
- package/dist/esm/vite/config-builder/configs/lib.d.mts +0 -4
- package/dist/esm/vite/config-builder/configs/script.d.mts +0 -4
- package/dist/esm/vite/config-builder/main.d.mts +0 -10
- package/dist/esm/vite/config-builder/plugins.d.mts +0 -30
- package/dist/esm/vite/config-builder/shared/types.d.mts +0 -155
- package/dist/esm/vite/config-builder/shared/utils/helpers.d.mts +0 -71
- package/dist/esm/vite/config-builder/shared/utils/projectConfig.d.mts +0 -60
- package/dist/esm/vite/config-builder/shared/utils/viteCommand.d.mts +0 -24
- package/dist/esm/vite/plugins/shadow-dom-inject-css/index.d.mts +0 -7
- package/dist/esm/vite/plugins/third-party-css-inject/main.d.mts +0 -17
- package/dist/esm/vite/plugins/third-party-css-inject/utils.d.mts +0 -5
- package/dist/executors.json +0 -29
- /package/dist/cjs/{vite → vitejs}/config-builder/configs/app.cjs +0 -0
- /package/dist/cjs/{vite → vitejs}/config-builder/configs/index.cjs +0 -0
- /package/dist/cjs/{vite → vitejs}/config-builder/configs/script.cjs +0 -0
- /package/dist/cjs/{vite → vitejs}/config-builder/main.cjs +0 -0
- /package/dist/cjs/{vite → vitejs}/config-builder/shared/utils/projectConfig.cjs +0 -0
- /package/dist/cjs/{vite → vitejs}/config-builder/shared/utils/viteCommand.cjs +0 -0
- /package/dist/cjs/{vite → vitejs}/plugins/shadow-dom-inject-css/index.cjs +0 -0
- /package/dist/cjs/{vite → vitejs}/plugins/third-party-css-inject/main.cjs +0 -0
- /package/dist/esm/{vite → vitejs}/config-builder/configs/app.mjs +0 -0
- /package/dist/esm/{vite → vitejs}/config-builder/configs/index.mjs +0 -0
- /package/dist/esm/{vite → vitejs}/config-builder/configs/script.mjs +0 -0
- /package/dist/esm/{vite → vitejs}/config-builder/main.mjs +0 -0
- /package/dist/esm/{vite → vitejs}/config-builder/shared/utils/projectConfig.mjs +0 -0
- /package/dist/esm/{vite → vitejs}/config-builder/shared/utils/viteCommand.mjs +0 -0
- /package/dist/esm/{vite → vitejs}/plugins/shadow-dom-inject-css/index.mjs +0 -0
- /package/dist/esm/{vite → vitejs}/plugins/third-party-css-inject/main.mjs +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var path = require('node:path');
|
|
6
|
+
var node_fs = require('node:fs');
|
|
7
|
+
|
|
8
|
+
const defaultCacheDir = "node_modules/.vite";
|
|
9
|
+
function viteBasicSslPlugin() {
|
|
10
|
+
return {
|
|
11
|
+
name: "vite:basic-ssl",
|
|
12
|
+
async configResolved(config) {
|
|
13
|
+
const certificate = await getCertificate((config.cacheDir ?? defaultCacheDir) + "/basic-ssl");
|
|
14
|
+
const https = () => ({ cert: certificate, key: certificate });
|
|
15
|
+
config.server.https = Object.assign({}, config.server.https, https());
|
|
16
|
+
config.preview.https = Object.assign({}, config.preview.https, https());
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
async function getCertificate(cacheDir) {
|
|
21
|
+
const cachePath = path.join(cacheDir, "_cert.pem");
|
|
22
|
+
try {
|
|
23
|
+
const [stat, content] = await Promise.all([
|
|
24
|
+
node_fs.promises.stat(cachePath),
|
|
25
|
+
node_fs.promises.readFile(cachePath, "utf8")
|
|
26
|
+
]);
|
|
27
|
+
if (Date.now() - stat.ctime.valueOf() > 30 * 24 * 60 * 60 * 1e3) {
|
|
28
|
+
throw new Error("cache is outdated.");
|
|
29
|
+
}
|
|
30
|
+
return content;
|
|
31
|
+
} catch {
|
|
32
|
+
const content = (await Promise.resolve().then(function () { return require('./chunks/certificate.cjs'); })).createCertificate();
|
|
33
|
+
node_fs.promises.mkdir(cacheDir, { recursive: true }).then(() => node_fs.promises.writeFile(cachePath, content)).catch(() => {
|
|
34
|
+
});
|
|
35
|
+
return content;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
exports.default = viteBasicSslPlugin;
|
|
40
|
+
exports.getCertificate = getCertificate;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var devkit = require('@nx/devkit');
|
|
4
|
-
var
|
|
4
|
+
var require$$1 = require('crypto');
|
|
5
5
|
var fs = require('fs');
|
|
6
6
|
var path = require('path');
|
|
7
7
|
|
|
@@ -29,7 +29,7 @@ var path = require('path');
|
|
|
29
29
|
* @returns {string} - A string representing a unique identifier.
|
|
30
30
|
*/ function shortId(length = 8) {
|
|
31
31
|
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
32
|
-
return Array.from(
|
|
32
|
+
return Array.from(require$$1.randomBytes(length), (b)=>chars[b % chars.length]).join('');
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
exports.getPkgJson = getPkgJson;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var fs = require('fs');
|
|
4
|
+
var path = require('path');
|
|
3
5
|
var plugins = require('../plugins.cjs');
|
|
4
6
|
var types = require('../shared/types.cjs');
|
|
5
7
|
var helpers = require('../shared/utils/helpers.cjs');
|
|
@@ -7,8 +9,6 @@ require('minimatch');
|
|
|
7
9
|
require('../../../shared/logger.cjs');
|
|
8
10
|
require('@nx/devkit');
|
|
9
11
|
require('crypto');
|
|
10
|
-
var fs = require('fs');
|
|
11
|
-
var path = require('path');
|
|
12
12
|
require('chalk');
|
|
13
13
|
require('mri');
|
|
14
14
|
require('vite');
|
|
@@ -32,7 +32,7 @@ const getBaseConfig = (ctx)=>{
|
|
|
32
32
|
const envFilePath = fs.existsSync(path.resolve(path$1, 'src', envPath)) ? envPath : fallbackEnvPath;
|
|
33
33
|
return {
|
|
34
34
|
envPrefix,
|
|
35
|
-
plugins: helpers.getPlugins(ctx, plugins.basePlugins, plugins.bundleAnalysisPlugin),
|
|
35
|
+
plugins: helpers.getPlugins(ctx, plugins.basePlugins, plugins.httpsServerPlugin, plugins.bundleAnalysisPlugin),
|
|
36
36
|
resolve: {
|
|
37
37
|
alias: {
|
|
38
38
|
...helpers.when(resolveEnvs.default && !omittedStages.includes(stage), {
|
|
@@ -19,6 +19,7 @@ require('crypto');
|
|
|
19
19
|
require('fs');
|
|
20
20
|
require('chalk');
|
|
21
21
|
require('mri');
|
|
22
|
+
var index$1 = require('../../node_modules/.pnpm/@vitejs_plugin-basic-ssl@1.0.2_vite@5.0.4/node_modules/@vitejs/plugin-basic-ssl/dist/index.cjs');
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Base plugins configuration for apps and libs.
|
|
@@ -65,13 +66,13 @@ require('mri');
|
|
|
65
66
|
filename: 'bundle-analysis.html'
|
|
66
67
|
})
|
|
67
68
|
],
|
|
68
|
-
condition: ({ viteCmd })=>viteCmd.flags?.[types.Flag.ANALYZE]
|
|
69
|
+
condition: ({ viteCmd })=>viteCmd.flags?.[types.Flag.ANALYZE]
|
|
69
70
|
};
|
|
70
71
|
/**
|
|
71
72
|
* Plugin configuration for injecting CSS into JS files
|
|
72
73
|
* using vite-plugin-css-injected-by-js.
|
|
73
74
|
*/ const injectCssByJsPlugin = {
|
|
74
|
-
generate: (
|
|
75
|
+
generate: ()=>[
|
|
75
76
|
cssInjectedByJsPlugin()
|
|
76
77
|
],
|
|
77
78
|
condition: ({ projectConfig })=>!projectConfig.shadowDom
|
|
@@ -80,14 +81,26 @@ require('mri');
|
|
|
80
81
|
* Plugin configuration for injecting CSS into Shadow Dom.
|
|
81
82
|
* using local plugin.
|
|
82
83
|
*/ const injectCssIntoShadowDomPlugin = {
|
|
83
|
-
generate: (
|
|
84
|
+
generate: ()=>[
|
|
84
85
|
index.injectCssIntoShadowDom()
|
|
85
86
|
],
|
|
86
87
|
condition: ({ projectConfig })=>projectConfig.shadowDom
|
|
87
88
|
};
|
|
89
|
+
/**
|
|
90
|
+
* Use the plugin @vitejs/plugin-basic-ssl to create a SSL
|
|
91
|
+
* certificate and create https server.
|
|
92
|
+
*/ const httpsServerPlugin = {
|
|
93
|
+
generate: ()=>[
|
|
94
|
+
index$1.default()
|
|
95
|
+
],
|
|
96
|
+
condition: ({ viteCmd })=>{
|
|
97
|
+
return viteCmd.flags?.[types.Flag.HTTPS];
|
|
98
|
+
}
|
|
99
|
+
};
|
|
88
100
|
|
|
89
101
|
exports.basePlugins = basePlugins;
|
|
90
102
|
exports.bundleAnalysisPlugin = bundleAnalysisPlugin;
|
|
91
103
|
exports.dtsPlugin = dtsPlugin;
|
|
104
|
+
exports.httpsServerPlugin = httpsServerPlugin;
|
|
92
105
|
exports.injectCssByJsPlugin = injectCssByJsPlugin;
|
|
93
106
|
exports.injectCssIntoShadowDomPlugin = injectCssIntoShadowDomPlugin;
|
|
@@ -76,8 +76,8 @@ var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
|
|
|
76
76
|
*
|
|
77
77
|
* @param {Context} ctx - The main configuration object.
|
|
78
78
|
* @returns {any[]} - An array of generated plugin configurations.
|
|
79
|
-
*/ const getPlugins = (ctx, ...pluginConfigs)=>pluginConfigs
|
|
80
|
-
.filter((p)=>!p.condition || p.condition(ctx))
|
|
79
|
+
*/ const getPlugins = (ctx, ...pluginConfigs)=>pluginConfigs// Filters the plugins based on conditions
|
|
80
|
+
.filter((p)=>!p.condition || p.condition(ctx))// Generates the configuration of each plugin and flattens the resulting array
|
|
81
81
|
.flatMap((p)=>p.generate(ctx));
|
|
82
82
|
/**
|
|
83
83
|
* Gets the paths to the tsconfig files for all relevant projects.
|
|
@@ -66,13 +66,11 @@ async function buildCSSInjectionCode(execute) {
|
|
|
66
66
|
*/ function injectionCSSCodePlugin(execute) {
|
|
67
67
|
return {
|
|
68
68
|
name: 'vite:third-party-css-inject',
|
|
69
|
-
// @ts-ignore
|
|
70
69
|
resolveId (id) {
|
|
71
70
|
if (id == cssInjectedByJsId) {
|
|
72
71
|
return id;
|
|
73
72
|
}
|
|
74
73
|
},
|
|
75
|
-
// @ts-ignore
|
|
76
74
|
load (id) {
|
|
77
75
|
if (id == cssInjectedByJsId) {
|
|
78
76
|
let executeJs = [];
|
|
@@ -86,7 +84,7 @@ async function buildCSSInjectionCode(execute) {
|
|
|
86
84
|
return `try{if(typeof document != 'undefined'){
|
|
87
85
|
const waitForElement=${waitForElement.toString()};
|
|
88
86
|
${executeJs.join(' ')}
|
|
89
|
-
}}catch(e){console.error('vite
|
|
87
|
+
}}catch(e){console.error('vite:third-party-css-inject', e);}`;
|
|
90
88
|
}
|
|
91
89
|
}
|
|
92
90
|
};
|
|
@@ -15,7 +15,7 @@ const { readFile } = promises;
|
|
|
15
15
|
const projectConfig = getProjectConfig(ctx);
|
|
16
16
|
const rootDir = projectConfig.root;
|
|
17
17
|
const executorsFilePath = join(rootDir, 'executors.json');
|
|
18
|
-
const distExecutorsFilePath = join(rootDir, 'dist', 'executors.json');
|
|
18
|
+
// const distExecutorsFilePath = join(rootDir, 'dist', 'executors.json');
|
|
19
19
|
const originalContent = JSON.parse(await readFile(executorsFilePath, 'utf8'));
|
|
20
20
|
// Update paths to point to './dist/' and add '.js'
|
|
21
21
|
const updatedExecutors = updateExecutorPaths(originalContent.executors, false);
|
|
@@ -27,7 +27,7 @@ const { readFile } = promises;
|
|
|
27
27
|
executors: updatedExecutors
|
|
28
28
|
})
|
|
29
29
|
]);
|
|
30
|
-
return ok(
|
|
30
|
+
return ok();
|
|
31
31
|
} catch (error) {
|
|
32
32
|
return err(error, `❌ Error processing file: ${error}`);
|
|
33
33
|
}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -3,10 +3,10 @@ export { default as environmentsExecutor } from './executors/environments/index.
|
|
|
3
3
|
export { default as publishExecutor } from './executors/publish/index.mjs';
|
|
4
4
|
export { default as updateExecutorsFileExecutor } from './executors/update-executors-file/index.mjs';
|
|
5
5
|
export { default as vtexLinkExecutor } from './executors/vtex-link/index.mjs';
|
|
6
|
-
export { createConfigBuilder } from './
|
|
7
|
-
export { Flag, ProjectType, Stage, Target, ViteMode } from './
|
|
8
|
-
export { chunkName, deepMerge, getNxTsConfigPaths, getPlugins, when } from './
|
|
9
|
-
export { getExternalDependencies, getInitials, initializeConfig, mergeConfigs } from './
|
|
10
|
-
export { getViteCmdFlags, getViteCommand } from './
|
|
11
|
-
export { thirdPartyCssInjectPlugin } from './
|
|
12
|
-
export { injectCssIntoShadowDom } from './
|
|
6
|
+
export { createConfigBuilder } from './vitejs/config-builder/main.mjs';
|
|
7
|
+
export { Flag, ProjectType, Stage, Target, ViteMode } from './vitejs/config-builder/shared/types.mjs';
|
|
8
|
+
export { chunkName, deepMerge, getNxTsConfigPaths, getPlugins, when } from './vitejs/config-builder/shared/utils/helpers.mjs';
|
|
9
|
+
export { getExternalDependencies, getInitials, initializeConfig, mergeConfigs } from './vitejs/config-builder/shared/utils/projectConfig.mjs';
|
|
10
|
+
export { getViteCmdFlags, getViteCommand } from './vitejs/config-builder/shared/utils/viteCommand.mjs';
|
|
11
|
+
export { thirdPartyCssInjectPlugin } from './vitejs/plugins/third-party-css-inject/main.mjs';
|
|
12
|
+
export { injectCssIntoShadowDom } from './vitejs/plugins/shadow-dom-inject-css/index.mjs';
|