@copilotkit/react-textarea 1.83.0 → 1.84.1
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/index.cjs +7 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +15 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +7 -0
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +7 -0
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -5
- package/scripts/check-deprecation-declarations.mjs +40 -0
- package/src/components/copilot-textarea/copilot-textarea.tsx +15 -0
- package/src/copilot-textarea.deprecation.test.ts +71 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@copilotkit/react-textarea",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.84.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"slate-history": "^0.93.0",
|
|
60
60
|
"slate-react": "^0.98.1",
|
|
61
61
|
"tailwind-merge": "^1.13.2",
|
|
62
|
-
"@copilotkit/react-core": "1.
|
|
63
|
-
"@copilotkit/runtime-client-gql": "1.
|
|
64
|
-
"@copilotkit/shared": "1.
|
|
62
|
+
"@copilotkit/react-core": "1.84.1",
|
|
63
|
+
"@copilotkit/runtime-client-gql": "1.84.1",
|
|
64
|
+
"@copilotkit/shared": "1.84.1"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/lodash.merge": "^4.6.7",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"react-dom": "^18 || ^19 || ^19.0.0-rc"
|
|
87
87
|
},
|
|
88
88
|
"scripts": {
|
|
89
|
-
"build": "tsdown && node ../../scripts/deprecations/v1-dist-notices.mjs --entrypoint react-textarea",
|
|
89
|
+
"build": "tsdown && node ../../scripts/deprecations/v1-dist-notices.mjs --entrypoint react-textarea && node --test scripts/check-deprecation-declarations.mjs",
|
|
90
90
|
"size": "size-limit",
|
|
91
91
|
"compat-check": "es-check es2022 --module 'dist/**/!(*.umd).{mjs,cjs,js}' && es-check es2018 'dist/**/*.umd.js'",
|
|
92
92
|
"dev": "tsdown --watch",
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { test } from "node:test";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import ts from "typescript";
|
|
5
|
+
|
|
6
|
+
for (const filename of ["index.d.mts", "index.d.cts"]) {
|
|
7
|
+
test(`${filename} retains textarea deprecation guidance`, () => {
|
|
8
|
+
const file = fileURLToPath(new URL(`../dist/${filename}`, import.meta.url));
|
|
9
|
+
const program = ts.createProgram([file], {
|
|
10
|
+
module: ts.ModuleKind.NodeNext,
|
|
11
|
+
types: [],
|
|
12
|
+
});
|
|
13
|
+
const checker = program.getTypeChecker();
|
|
14
|
+
const source = program.getSourceFile(file);
|
|
15
|
+
assert.ok(source, `${filename} is missing`);
|
|
16
|
+
const moduleSymbol = checker.getSymbolAtLocation(source);
|
|
17
|
+
assert.ok(moduleSymbol, `${filename} has no module exports`);
|
|
18
|
+
const exports = checker.getExportsOfModule(moduleSymbol);
|
|
19
|
+
|
|
20
|
+
for (const name of ["CopilotTextarea", "CopilotTextareaProps"]) {
|
|
21
|
+
const symbol = exports.find((candidate) => candidate.name === name);
|
|
22
|
+
assert.ok(symbol, `${filename} does not export ${name}`);
|
|
23
|
+
const tags = symbol
|
|
24
|
+
.getJsDocTags(checker)
|
|
25
|
+
.filter((tag) => tag.name === "deprecated");
|
|
26
|
+
assert.equal(tags.length, 1, `${filename}: ${name}`);
|
|
27
|
+
const warning = ts.displayPartsToString(tags[0].text);
|
|
28
|
+
for (const text of [
|
|
29
|
+
"Since 1.68.2. The v1 SDK is deprecated. Use v2 instead.",
|
|
30
|
+
"No 1:1 v2 replacement is available.",
|
|
31
|
+
"@copilotkit/react-core/v2",
|
|
32
|
+
"https://docs.copilotkit.ai/",
|
|
33
|
+
"https://docs.copilotkit.ai/reference/v2",
|
|
34
|
+
"https://docs.copilotkit.ai/migrate/v2",
|
|
35
|
+
]) {
|
|
36
|
+
assert.ok(warning.includes(text), `${filename}: ${name}: ${text}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
@@ -123,6 +123,14 @@ import type { AutosuggestionsConfigUserSpecified } from "../../types/autosuggest
|
|
|
123
123
|
|
|
124
124
|
// Like the base copilot textarea props,
|
|
125
125
|
// but with baseAutosuggestionsConfig replaced with autosuggestionsConfig.
|
|
126
|
+
/**
|
|
127
|
+
* @deprecated Since 1.68.2. The v1 SDK is deprecated. Use v2 instead.
|
|
128
|
+
* No 1:1 v2 replacement is available.
|
|
129
|
+
* Start with `@copilotkit/react-core/v2`.
|
|
130
|
+
* V2 docs: https://docs.copilotkit.ai/
|
|
131
|
+
* V2 reference docs: https://docs.copilotkit.ai/reference/v2
|
|
132
|
+
* Migration guide: https://docs.copilotkit.ai/migrate/v2
|
|
133
|
+
*/
|
|
126
134
|
export interface CopilotTextareaProps extends Omit<
|
|
127
135
|
BaseCopilotTextareaProps,
|
|
128
136
|
"baseAutosuggestionsConfig"
|
|
@@ -191,6 +199,13 @@ export interface CopilotTextareaProps extends Omit<
|
|
|
191
199
|
|
|
192
200
|
/**
|
|
193
201
|
* A copilot textarea that uses the standard autosuggestions function.
|
|
202
|
+
*
|
|
203
|
+
* @deprecated Since 1.68.2. The v1 SDK is deprecated. Use v2 instead.
|
|
204
|
+
* No 1:1 v2 replacement is available.
|
|
205
|
+
* Start with `@copilotkit/react-core/v2`.
|
|
206
|
+
* V2 docs: https://docs.copilotkit.ai/
|
|
207
|
+
* V2 reference docs: https://docs.copilotkit.ai/reference/v2
|
|
208
|
+
* Migration guide: https://docs.copilotkit.ai/migrate/v2
|
|
194
209
|
*/
|
|
195
210
|
export const CopilotTextarea = React.forwardRef(
|
|
196
211
|
(props: CopilotTextareaProps, ref: React.Ref<HTMLCopilotTextAreaElement>) => {
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
import { assert, expect, it } from "vitest";
|
|
4
|
+
|
|
5
|
+
it.each([
|
|
6
|
+
"./src/index",
|
|
7
|
+
"./src/components",
|
|
8
|
+
"./src/components/copilot-textarea/copilot-textarea",
|
|
9
|
+
])("exposes editor deprecation guidance through %s", (entrypoint) => {
|
|
10
|
+
const packageRoot = path.resolve(__dirname, "..");
|
|
11
|
+
const consumerFile = path.join(packageRoot, "deprecation-consumer.tsx");
|
|
12
|
+
const source = `
|
|
13
|
+
import { CopilotTextarea, type CopilotTextareaProps } from "${entrypoint}";
|
|
14
|
+
CopilotTextarea;
|
|
15
|
+
type Props = CopilotTextareaProps;
|
|
16
|
+
`;
|
|
17
|
+
const service = ts.createLanguageService({
|
|
18
|
+
...ts.sys,
|
|
19
|
+
useCaseSensitiveFileNames: () => ts.sys.useCaseSensitiveFileNames,
|
|
20
|
+
getCompilationSettings: () => ({
|
|
21
|
+
module: ts.ModuleKind.ESNext,
|
|
22
|
+
moduleResolution: ts.ModuleResolutionKind.Bundler,
|
|
23
|
+
jsx: ts.JsxEmit.ReactJSX,
|
|
24
|
+
target: ts.ScriptTarget.ESNext,
|
|
25
|
+
types: [],
|
|
26
|
+
}),
|
|
27
|
+
getScriptFileNames: () => [consumerFile],
|
|
28
|
+
getScriptVersion: () => "0",
|
|
29
|
+
getScriptSnapshot: (file) => {
|
|
30
|
+
const text = file === consumerFile ? source : ts.sys.readFile(file);
|
|
31
|
+
return text === undefined
|
|
32
|
+
? undefined
|
|
33
|
+
: ts.ScriptSnapshot.fromString(text);
|
|
34
|
+
},
|
|
35
|
+
getCurrentDirectory: () => packageRoot,
|
|
36
|
+
getDefaultLibFileName: ts.getDefaultLibFilePath,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
for (const name of ["CopilotTextarea", "CopilotTextareaProps"]) {
|
|
41
|
+
const info = service.getQuickInfoAtPosition(
|
|
42
|
+
consumerFile,
|
|
43
|
+
source.lastIndexOf(`${name};`),
|
|
44
|
+
);
|
|
45
|
+
assert(info, `${entrypoint}: ${name} has no quick info`);
|
|
46
|
+
expect(
|
|
47
|
+
source.slice(
|
|
48
|
+
info.textSpan.start,
|
|
49
|
+
info.textSpan.start + info.textSpan.length,
|
|
50
|
+
),
|
|
51
|
+
).toBe(name);
|
|
52
|
+
const tag = info.tags?.find(
|
|
53
|
+
(candidate) => candidate.name === "deprecated",
|
|
54
|
+
);
|
|
55
|
+
expect(tag, `${entrypoint}: ${name}`).toBeDefined();
|
|
56
|
+
const warning = ts.displayPartsToString(tag?.text);
|
|
57
|
+
for (const text of [
|
|
58
|
+
"Since 1.68.2. The v1 SDK is deprecated. Use v2 instead.",
|
|
59
|
+
"No 1:1 v2 replacement is available.",
|
|
60
|
+
"@copilotkit/react-core/v2",
|
|
61
|
+
"https://docs.copilotkit.ai/",
|
|
62
|
+
"https://docs.copilotkit.ai/reference/v2",
|
|
63
|
+
"https://docs.copilotkit.ai/migrate/v2",
|
|
64
|
+
]) {
|
|
65
|
+
expect(warning).toContain(text);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
} finally {
|
|
69
|
+
service.dispose();
|
|
70
|
+
}
|
|
71
|
+
});
|