@cedarjs/vite 0.4.1-next.0 → 0.5.1-next.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/index.js +51 -132
- package/dist/cjs/plugins/vite-plugin-cedar-entry-injection.js +92 -0
- package/dist/cjs/plugins/vite-plugin-cedar-html-env.js +67 -0
- package/dist/cjs/plugins/vite-plugin-cedar-node-polyfills.js +43 -0
- package/dist/cjs/plugins/vite-plugin-cedar-remove-from-bundle.js +76 -0
- package/dist/cjs/plugins/vite-plugin-jsx-loader.js +3 -3
- package/dist/cjs/plugins/vite-plugin-merged-config.js +39 -0
- package/dist/cjs/plugins/vite-plugin-swap-apollo-provider.js +8 -3
- package/dist/index.d.ts +14 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +40 -135
- package/dist/plugins/vite-plugin-cedar-cell.d.ts +1 -1
- package/dist/plugins/vite-plugin-cedar-entry-injection.d.ts +3 -0
- package/dist/plugins/vite-plugin-cedar-entry-injection.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-entry-injection.js +58 -0
- package/dist/plugins/vite-plugin-cedar-html-env.d.ts +8 -0
- package/dist/plugins/vite-plugin-cedar-html-env.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-html-env.js +43 -0
- package/dist/plugins/vite-plugin-cedar-node-polyfills.d.ts +3 -0
- package/dist/plugins/vite-plugin-cedar-node-polyfills.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-node-polyfills.js +19 -0
- package/dist/plugins/vite-plugin-cedar-remove-from-bundle.d.ts +16 -0
- package/dist/plugins/vite-plugin-cedar-remove-from-bundle.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-remove-from-bundle.js +41 -0
- package/dist/plugins/vite-plugin-jsx-loader.d.ts +1 -3
- package/dist/plugins/vite-plugin-jsx-loader.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-jsx-loader.js +2 -2
- package/dist/plugins/vite-plugin-merged-config.d.ts +3 -0
- package/dist/plugins/vite-plugin-merged-config.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-merged-config.js +15 -0
- package/dist/plugins/vite-plugin-swap-apollo-provider.d.ts +4 -6
- package/dist/plugins/vite-plugin-swap-apollo-provider.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-swap-apollo-provider.js +7 -2
- package/package.json +12 -16
- package/dist/cjs/plugins/index.js +0 -43
- package/dist/cjs/plugins/vite-plugin-remove-from-bundle.js +0 -56
- package/dist/plugins/index.d.ts +0 -7
- package/dist/plugins/index.d.ts.map +0 -1
- package/dist/plugins/index.js +0 -14
- package/dist/plugins/vite-plugin-remove-from-bundle.d.ts +0 -17
- package/dist/plugins/vite-plugin-remove-from-bundle.d.ts.map +0 -1
- package/dist/plugins/vite-plugin-remove-from-bundle.js +0 -31
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var vite_plugin_remove_from_bundle_exports = {};
|
|
20
|
-
__export(vite_plugin_remove_from_bundle_exports, {
|
|
21
|
-
excludeOnMatch: () => excludeOnMatch,
|
|
22
|
-
removeFromBundle: () => removeFromBundle
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(vite_plugin_remove_from_bundle_exports);
|
|
25
|
-
function removeFromBundle(modulesToExclude, exportNames) {
|
|
26
|
-
const isMissingIdToExclude = modulesToExclude.some(
|
|
27
|
-
(module2) => module2.id === void 0
|
|
28
|
-
);
|
|
29
|
-
if (isMissingIdToExclude) {
|
|
30
|
-
throw new Error("You must specify an id to exclude");
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
name: "remove-from-bundle",
|
|
34
|
-
apply: "build",
|
|
35
|
-
// <-- @MARK important
|
|
36
|
-
load: (id) => {
|
|
37
|
-
return excludeOnMatch(modulesToExclude, id, exportNames);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
function generateModuleWithExports(exportNames) {
|
|
42
|
-
return {
|
|
43
|
-
code: `export default {}; ${exportNames.map((name) => `export const ${name} = undefined;`).join("\n")}`
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
function excludeOnMatch(modulesToExclude, id, exportNames = []) {
|
|
47
|
-
if (modulesToExclude.some((module2) => module2.id.test(id))) {
|
|
48
|
-
return generateModuleWithExports(exportNames);
|
|
49
|
-
}
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
-
0 && (module.exports = {
|
|
54
|
-
excludeOnMatch,
|
|
55
|
-
removeFromBundle
|
|
56
|
-
});
|
package/dist/plugins/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { cedarCellTransform } from './vite-plugin-cedar-cell.js';
|
|
2
|
-
export { cedarjsDirectoryNamedImportPlugin } from './vite-plugin-cedarjs-directory-named-import.js';
|
|
3
|
-
export { cedarjsJobPathInjectorPlugin } from './vite-plugin-cedarjs-job-path-injector.js';
|
|
4
|
-
export { handleJsAsJsx } from './vite-plugin-jsx-loader.js';
|
|
5
|
-
export { removeFromBundle } from './vite-plugin-remove-from-bundle.js';
|
|
6
|
-
export { swapApolloProvider } from './vite-plugin-swap-apollo-provider.js';
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAE,iCAAiC,EAAE,MAAM,iDAAiD,CAAA;AACnG,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAA;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAA;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAA"}
|
package/dist/plugins/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { cedarCellTransform } from "./vite-plugin-cedar-cell.js";
|
|
2
|
-
import { cedarjsDirectoryNamedImportPlugin } from "./vite-plugin-cedarjs-directory-named-import.js";
|
|
3
|
-
import { cedarjsJobPathInjectorPlugin } from "./vite-plugin-cedarjs-job-path-injector.js";
|
|
4
|
-
import { handleJsAsJsx } from "./vite-plugin-jsx-loader.js";
|
|
5
|
-
import { removeFromBundle } from "./vite-plugin-remove-from-bundle.js";
|
|
6
|
-
import { swapApolloProvider } from "./vite-plugin-swap-apollo-provider.js";
|
|
7
|
-
export {
|
|
8
|
-
cedarCellTransform,
|
|
9
|
-
cedarjsDirectoryNamedImportPlugin,
|
|
10
|
-
cedarjsJobPathInjectorPlugin,
|
|
11
|
-
handleJsAsJsx,
|
|
12
|
-
removeFromBundle,
|
|
13
|
-
swapApolloProvider
|
|
14
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { PluginOption } from 'vite';
|
|
2
|
-
type ModulesToExclude = {
|
|
3
|
-
id: RegExp;
|
|
4
|
-
}[];
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* This is a vite plugin to remove modules from the bundle.
|
|
8
|
-
*
|
|
9
|
-
* Only applies on build, not on dev.
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
export declare function removeFromBundle(modulesToExclude: ModulesToExclude, exportNames?: string[]): PluginOption;
|
|
13
|
-
export declare function excludeOnMatch(modulesToExclude: ModulesToExclude, id: string, exportNames?: string[]): {
|
|
14
|
-
code: string;
|
|
15
|
-
} | null;
|
|
16
|
-
export {};
|
|
17
|
-
//# sourceMappingURL=vite-plugin-remove-from-bundle.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-remove-from-bundle.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-remove-from-bundle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAExC,KAAK,gBAAgB,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,CAAA;AAExC;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,gBAAgB,EAAE,gBAAgB,EAClC,WAAW,CAAC,EAAE,MAAM,EAAE,GACrB,YAAY,CAgBd;AAQD,wBAAgB,cAAc,CAC5B,gBAAgB,EAAE,gBAAgB,EAClC,EAAE,EAAE,MAAM,EACV,WAAW,GAAE,MAAM,EAAO;;SAQ3B"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
function removeFromBundle(modulesToExclude, exportNames) {
|
|
2
|
-
const isMissingIdToExclude = modulesToExclude.some(
|
|
3
|
-
(module) => module.id === void 0
|
|
4
|
-
);
|
|
5
|
-
if (isMissingIdToExclude) {
|
|
6
|
-
throw new Error("You must specify an id to exclude");
|
|
7
|
-
}
|
|
8
|
-
return {
|
|
9
|
-
name: "remove-from-bundle",
|
|
10
|
-
apply: "build",
|
|
11
|
-
// <-- @MARK important
|
|
12
|
-
load: (id) => {
|
|
13
|
-
return excludeOnMatch(modulesToExclude, id, exportNames);
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function generateModuleWithExports(exportNames) {
|
|
18
|
-
return {
|
|
19
|
-
code: `export default {}; ${exportNames.map((name) => `export const ${name} = undefined;`).join("\n")}`
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
function excludeOnMatch(modulesToExclude, id, exportNames = []) {
|
|
23
|
-
if (modulesToExclude.some((module) => module.id.test(id))) {
|
|
24
|
-
return generateModuleWithExports(exportNames);
|
|
25
|
-
}
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
export {
|
|
29
|
-
excludeOnMatch,
|
|
30
|
-
removeFromBundle
|
|
31
|
-
};
|