@slicemachine/adapter-next 0.0.2 → 0.0.3
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/SliceSimulator.d.ts +2 -2
- package/dist/hooks/customType-rename.cjs +6 -0
- package/dist/hooks/customType-rename.cjs.map +1 -0
- package/dist/hooks/customType-rename.d.ts +1 -0
- package/dist/hooks/customType-rename.js +6 -0
- package/dist/hooks/customType-rename.js.map +1 -0
- package/dist/hooks/customTypeLibrary-read.cjs +12 -4
- package/dist/hooks/customTypeLibrary-read.cjs.map +1 -1
- package/dist/hooks/customTypeLibrary-read.js +12 -4
- package/dist/hooks/customTypeLibrary-read.js.map +1 -1
- package/dist/hooks/slice-create.cjs +14 -24
- package/dist/hooks/slice-create.cjs.map +1 -1
- package/dist/hooks/slice-create.js +14 -24
- package/dist/hooks/slice-create.js.map +1 -1
- package/dist/hooks/slice-delete.cjs +3 -13
- package/dist/hooks/slice-delete.cjs.map +1 -1
- package/dist/hooks/slice-delete.js +3 -13
- package/dist/hooks/slice-delete.js.map +1 -1
- package/dist/hooks/slice-read.cjs +42 -6
- package/dist/hooks/slice-read.cjs.map +1 -1
- package/dist/hooks/slice-read.js +22 -6
- package/dist/hooks/slice-read.js.map +1 -1
- package/dist/hooks/slice-rename.cjs +45 -0
- package/dist/hooks/slice-rename.cjs.map +1 -0
- package/dist/hooks/slice-rename.d.ts +3 -0
- package/dist/hooks/slice-rename.js +26 -0
- package/dist/hooks/slice-rename.js.map +1 -0
- package/dist/hooks/slice-update.cjs +6 -33
- package/dist/hooks/slice-update.cjs.map +1 -1
- package/dist/hooks/slice-update.js +6 -13
- package/dist/hooks/slice-update.js.map +1 -1
- package/dist/hooks/sliceLibrary-read.cjs +12 -14
- package/dist/hooks/sliceLibrary-read.cjs.map +1 -1
- package/dist/hooks/sliceLibrary-read.js +12 -13
- package/dist/hooks/sliceLibrary-read.js.map +1 -1
- package/dist/lib/isSharedSliceModel.cjs +27 -0
- package/dist/lib/isSharedSliceModel.cjs.map +1 -0
- package/dist/lib/isSharedSliceModel.d.ts +2 -0
- package/dist/lib/isSharedSliceModel.js +8 -0
- package/dist/lib/isSharedSliceModel.js.map +1 -0
- package/dist/lib/updateSliceModelFile.cjs +33 -0
- package/dist/lib/updateSliceModelFile.cjs.map +1 -0
- package/dist/lib/updateSliceModelFile.d.ts +9 -0
- package/dist/lib/updateSliceModelFile.js +14 -0
- package/dist/lib/updateSliceModelFile.js.map +1 -0
- package/dist/lib/upsertGlobalContentTypes.d.ts +1 -1
- package/dist/lib/upsertSliceLibraryIndexFile.cjs +47 -0
- package/dist/lib/upsertSliceLibraryIndexFile.cjs.map +1 -0
- package/dist/lib/upsertSliceLibraryIndexFile.d.ts +7 -0
- package/dist/lib/upsertSliceLibraryIndexFile.js +28 -0
- package/dist/lib/upsertSliceLibraryIndexFile.js.map +1 -0
- package/dist/plugin.cjs +4 -0
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js +4 -0
- package/dist/plugin.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +14 -12
- package/src/hooks/customType-rename.ts +3 -0
- package/src/hooks/customTypeLibrary-read.ts +13 -4
- package/src/hooks/slice-create.ts +14 -32
- package/src/hooks/slice-delete.ts +3 -21
- package/src/hooks/slice-read.ts +37 -11
- package/src/hooks/slice-rename.ts +44 -0
- package/src/hooks/slice-update.ts +7 -31
- package/src/hooks/sliceLibrary-read.ts +13 -23
- package/src/lib/isSharedSliceModel.ts +14 -0
- package/src/lib/updateSliceModelFile.ts +32 -0
- package/src/lib/{buildSliceLibraryIndexFileContents.ts → upsertSliceLibraryIndexFile.ts} +14 -9
- package/src/plugin.ts +4 -0
- package/dist/lib/buildSliceLibraryIndexFileContents.cjs +0 -23
- package/dist/lib/buildSliceLibraryIndexFileContents.cjs.map +0 -1
- package/dist/lib/buildSliceLibraryIndexFileContents.d.ts +0 -10
- package/dist/lib/buildSliceLibraryIndexFileContents.js +0 -23
- package/dist/lib/buildSliceLibraryIndexFileContents.js.map +0 -1
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const commonTags = require("common-tags");
|
|
4
|
-
const pascalCase = require("./pascalCase.cjs");
|
|
5
|
-
const buildSliceLibraryIndexFileContents = async (args) => {
|
|
6
|
-
const filePath = args.helpers.joinPathFromRoot(args.libraryID, args.options.typescript ? "index.ts" : "index.js");
|
|
7
|
-
const sliceLibrary = await args.actions.readSliceLibrary({
|
|
8
|
-
libraryID: args.libraryID
|
|
9
|
-
});
|
|
10
|
-
let contents = commonTags.stripIndent`
|
|
11
|
-
import dynamic from 'next/dynamic'
|
|
12
|
-
|
|
13
|
-
export const components = {
|
|
14
|
-
${sliceLibrary.sliceIDs.map((id) => `${id}: dynamic(() => import('./${pascalCase.pascalCase(id)}')),`)}
|
|
15
|
-
}
|
|
16
|
-
`;
|
|
17
|
-
if (args.options.format) {
|
|
18
|
-
contents = await args.helpers.format(contents, filePath);
|
|
19
|
-
}
|
|
20
|
-
return { filePath, contents };
|
|
21
|
-
};
|
|
22
|
-
exports.buildSliceLibraryIndexFileContents = buildSliceLibraryIndexFileContents;
|
|
23
|
-
//# sourceMappingURL=buildSliceLibraryIndexFileContents.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildSliceLibraryIndexFileContents.cjs","sources":["../../src/lib/buildSliceLibraryIndexFileContents.ts"],"sourcesContent":["import { SliceMachineContext } from \"@slicemachine/plugin-kit\";\nimport { stripIndent } from \"common-tags\";\n\nimport { PluginOptions } from \"../types\";\n\nimport { pascalCase } from \"./pascalCase\";\n\ntype BuildSliceLibraryIndexFileContentsArgs = {\n\tlibraryID: string;\n} & SliceMachineContext<PluginOptions>;\n\nexport const buildSliceLibraryIndexFileContents = async (\n\targs: BuildSliceLibraryIndexFileContentsArgs,\n): Promise<{ filePath: string; contents: string }> => {\n\tconst filePath = args.helpers.joinPathFromRoot(\n\t\targs.libraryID,\n\t\targs.options.typescript ? \"index.ts\" : \"index.js\",\n\t);\n\tconst sliceLibrary = await args.actions.readSliceLibrary({\n\t\tlibraryID: args.libraryID,\n\t});\n\n\tlet contents = stripIndent`\n\t\timport dynamic from 'next/dynamic'\n\n\t\texport const components = {\n\t\t\t${sliceLibrary.sliceIDs.map(\n\t\t\t\t(id) => `${id}: dynamic(() => import('./${pascalCase(id)}')),`,\n\t\t\t)}\n\t\t}\n\t`;\n\n\tif (args.options.format) {\n\t\tcontents = await args.helpers.format(contents, filePath);\n\t}\n\n\treturn { filePath, contents };\n};\n"],"names":["stripIndent","pascalCase"],"mappings":";;;;AAWa,MAAA,qCAAqC,OACjD,SACoD;AAC9C,QAAA,WAAW,KAAK,QAAQ,iBAC7B,KAAK,WACL,KAAK,QAAQ,aAAa,aAAa,UAAU;AAElD,QAAM,eAAe,MAAM,KAAK,QAAQ,iBAAiB;AAAA,IACxD,WAAW,KAAK;AAAA,EAAA,CAChB;AAED,MAAI,WAAWA,WAAAA;AAAAA;AAAAA;AAAAA;AAAAA,KAIX,aAAa,SAAS,IACvB,CAAC,OAAO,GAAG,+BAA+BC,WAAAA,WAAW,EAAE,OAAO;AAAA;AAAA;AAK7D,MAAA,KAAK,QAAQ,QAAQ;AACxB,eAAW,MAAM,KAAK,QAAQ,OAAO,UAAU,QAAQ;AAAA,EACvD;AAEM,SAAA,EAAE,UAAU;AACpB;;"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { SliceMachineContext } from "@slicemachine/plugin-kit";
|
|
2
|
-
import { PluginOptions } from "../types";
|
|
3
|
-
declare type BuildSliceLibraryIndexFileContentsArgs = {
|
|
4
|
-
libraryID: string;
|
|
5
|
-
} & SliceMachineContext<PluginOptions>;
|
|
6
|
-
export declare const buildSliceLibraryIndexFileContents: (args: BuildSliceLibraryIndexFileContentsArgs) => Promise<{
|
|
7
|
-
filePath: string;
|
|
8
|
-
contents: string;
|
|
9
|
-
}>;
|
|
10
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { stripIndent } from "common-tags";
|
|
2
|
-
import { pascalCase } from "./pascalCase.js";
|
|
3
|
-
const buildSliceLibraryIndexFileContents = async (args) => {
|
|
4
|
-
const filePath = args.helpers.joinPathFromRoot(args.libraryID, args.options.typescript ? "index.ts" : "index.js");
|
|
5
|
-
const sliceLibrary = await args.actions.readSliceLibrary({
|
|
6
|
-
libraryID: args.libraryID
|
|
7
|
-
});
|
|
8
|
-
let contents = stripIndent`
|
|
9
|
-
import dynamic from 'next/dynamic'
|
|
10
|
-
|
|
11
|
-
export const components = {
|
|
12
|
-
${sliceLibrary.sliceIDs.map((id) => `${id}: dynamic(() => import('./${pascalCase(id)}')),`)}
|
|
13
|
-
}
|
|
14
|
-
`;
|
|
15
|
-
if (args.options.format) {
|
|
16
|
-
contents = await args.helpers.format(contents, filePath);
|
|
17
|
-
}
|
|
18
|
-
return { filePath, contents };
|
|
19
|
-
};
|
|
20
|
-
export {
|
|
21
|
-
buildSliceLibraryIndexFileContents
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=buildSliceLibraryIndexFileContents.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildSliceLibraryIndexFileContents.js","sources":["../../src/lib/buildSliceLibraryIndexFileContents.ts"],"sourcesContent":["import { SliceMachineContext } from \"@slicemachine/plugin-kit\";\nimport { stripIndent } from \"common-tags\";\n\nimport { PluginOptions } from \"../types\";\n\nimport { pascalCase } from \"./pascalCase\";\n\ntype BuildSliceLibraryIndexFileContentsArgs = {\n\tlibraryID: string;\n} & SliceMachineContext<PluginOptions>;\n\nexport const buildSliceLibraryIndexFileContents = async (\n\targs: BuildSliceLibraryIndexFileContentsArgs,\n): Promise<{ filePath: string; contents: string }> => {\n\tconst filePath = args.helpers.joinPathFromRoot(\n\t\targs.libraryID,\n\t\targs.options.typescript ? \"index.ts\" : \"index.js\",\n\t);\n\tconst sliceLibrary = await args.actions.readSliceLibrary({\n\t\tlibraryID: args.libraryID,\n\t});\n\n\tlet contents = stripIndent`\n\t\timport dynamic from 'next/dynamic'\n\n\t\texport const components = {\n\t\t\t${sliceLibrary.sliceIDs.map(\n\t\t\t\t(id) => `${id}: dynamic(() => import('./${pascalCase(id)}')),`,\n\t\t\t)}\n\t\t}\n\t`;\n\n\tif (args.options.format) {\n\t\tcontents = await args.helpers.format(contents, filePath);\n\t}\n\n\treturn { filePath, contents };\n};\n"],"names":[],"mappings":";;AAWa,MAAA,qCAAqC,OACjD,SACoD;AAC9C,QAAA,WAAW,KAAK,QAAQ,iBAC7B,KAAK,WACL,KAAK,QAAQ,aAAa,aAAa,UAAU;AAElD,QAAM,eAAe,MAAM,KAAK,QAAQ,iBAAiB;AAAA,IACxD,WAAW,KAAK;AAAA,EAAA,CAChB;AAED,MAAI,WAAW;AAAA;AAAA;AAAA;AAAA,KAIX,aAAa,SAAS,IACvB,CAAC,OAAO,GAAG,+BAA+B,WAAW,EAAE,OAAO;AAAA;AAAA;AAK7D,MAAA,KAAK,QAAQ,QAAQ;AACxB,eAAW,MAAM,KAAK,QAAQ,OAAO,UAAU,QAAQ;AAAA,EACvD;AAEM,SAAA,EAAE,UAAU;AACpB;"}
|