@rimelight/config 0.0.9 → 0.0.11
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/astro.d.ts +0 -1
- package/package.json +6 -12
- package/tsconfig/astro.json +1 -3
- package/vite-plus/base.js +52 -4
- package/vite-plus/base.ts +52 -4
package/astro.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rimelight/config",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Rimelight Entertainment's shared configuration package",
|
|
6
6
|
"homepage": "https://rimelight.com/docs",
|
|
@@ -47,12 +47,6 @@
|
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@astrojs/cloudflare": "14.3.1",
|
|
50
|
-
"@rimelight/auth": "0.0.6",
|
|
51
|
-
"@rimelight/cms": "0.0.9",
|
|
52
|
-
"@rimelight/i18n": "0.0.12",
|
|
53
|
-
"@rimelight/security": "0.0.12",
|
|
54
|
-
"@rimelight/seo": "0.0.7",
|
|
55
|
-
"@rimelight/ui": "0.0.51",
|
|
56
50
|
"astro": "7.3.2",
|
|
57
51
|
"drizzle-kit": "0.31.10",
|
|
58
52
|
"typescript": "6.0.3",
|
|
@@ -61,11 +55,11 @@
|
|
|
61
55
|
"peerDependencies": {
|
|
62
56
|
"@astrojs/cloudflare": ">=14.0.0",
|
|
63
57
|
"@astrojs/solid-js": ">=7.0.0",
|
|
64
|
-
"@rimelight/cms": "
|
|
65
|
-
"@rimelight/i18n": "
|
|
66
|
-
"@rimelight/security": "
|
|
67
|
-
"@rimelight/seo": "
|
|
68
|
-
"@rimelight/ui": "
|
|
58
|
+
"@rimelight/cms": "0.0.11",
|
|
59
|
+
"@rimelight/i18n": "0.0.13",
|
|
60
|
+
"@rimelight/security": "0.0.15",
|
|
61
|
+
"@rimelight/seo": "0.0.8",
|
|
62
|
+
"@rimelight/ui": "0.0.52",
|
|
69
63
|
"astro": ">=7.0.0",
|
|
70
64
|
"drizzle-kit": ">=0.30.0"
|
|
71
65
|
},
|
package/tsconfig/astro.json
CHANGED
package/vite-plus/base.js
CHANGED
|
@@ -59,6 +59,13 @@ export function rimelightConfig() {
|
|
|
59
59
|
},
|
|
60
60
|
test: {
|
|
61
61
|
environment: "node"
|
|
62
|
+
},
|
|
63
|
+
run: {
|
|
64
|
+
tasks: {
|
|
65
|
+
test: {
|
|
66
|
+
command: "vp test"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
62
69
|
}
|
|
63
70
|
}
|
|
64
71
|
}
|
|
@@ -116,6 +123,34 @@ export function verifyPackageExports(pkgJsonPath = "package.json", srcDir = "src
|
|
|
116
123
|
}
|
|
117
124
|
}
|
|
118
125
|
|
|
126
|
+
export function findVirtualExternals(baseDir = "src") {
|
|
127
|
+
if (!fs.existsSync(baseDir)) {
|
|
128
|
+
return []
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const externals = new Set()
|
|
132
|
+
|
|
133
|
+
function walk(currentDir) {
|
|
134
|
+
const files = fs.readdirSync(currentDir, { withFileTypes: true })
|
|
135
|
+
for (const file of files) {
|
|
136
|
+
const fullPath = path.join(currentDir, file.name)
|
|
137
|
+
if (file.isDirectory()) {
|
|
138
|
+
walk(fullPath)
|
|
139
|
+
} else if (file.isFile() && /\.(ts|tsx|js|jsx|astro|vue)$/.test(file.name)) {
|
|
140
|
+
const content = fs.readFileSync(fullPath, "utf8")
|
|
141
|
+
const regex = /["']((?:virtual|cloudflare):[^"']+)["']/g
|
|
142
|
+
let match
|
|
143
|
+
while ((match = regex.exec(content)) !== null) {
|
|
144
|
+
externals.add(match[1])
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
walk(baseDir)
|
|
151
|
+
return Array.from(externals)
|
|
152
|
+
}
|
|
153
|
+
|
|
119
154
|
export function rimelightPackConfig(options = {}) {
|
|
120
155
|
const { entry, autoEntry, pack = {}, autoExternal = true, ...rest } = options
|
|
121
156
|
|
|
@@ -134,22 +169,35 @@ export function rimelightPackConfig(options = {}) {
|
|
|
134
169
|
}
|
|
135
170
|
|
|
136
171
|
const discoveredExternals = autoExternal ? findPackageExternals() : []
|
|
172
|
+
const discoveredVirtualExternals = autoExternal ? findVirtualExternals() : []
|
|
137
173
|
const userExternal = pack["external"] || []
|
|
138
174
|
const userExternalList = Array.isArray(userExternal) ? userExternal : [userExternal]
|
|
139
|
-
const
|
|
175
|
+
const userDeps = pack["deps"] || {}
|
|
176
|
+
const userNeverBundle = userDeps["neverBundle"] || []
|
|
140
177
|
const userNeverBundleList = Array.isArray(userNeverBundle) ? userNeverBundle : [userNeverBundle]
|
|
141
178
|
const mergedExternal = Array.from(
|
|
142
|
-
new Set([
|
|
179
|
+
new Set([
|
|
180
|
+
...userExternalList,
|
|
181
|
+
...userNeverBundleList,
|
|
182
|
+
...discoveredExternals,
|
|
183
|
+
...discoveredVirtualExternals
|
|
184
|
+
])
|
|
143
185
|
).filter(Boolean)
|
|
144
186
|
|
|
187
|
+
const hasUserDeps = pack["deps"] !== undefined
|
|
188
|
+
const hasExternals = mergedExternal.length > 0
|
|
189
|
+
|
|
145
190
|
return {
|
|
146
191
|
...rimelightConfig(),
|
|
147
192
|
...rest,
|
|
148
193
|
pack: {
|
|
149
194
|
entry: resolvedEntry,
|
|
150
195
|
dts: true,
|
|
151
|
-
|
|
152
|
-
...pack
|
|
196
|
+
checks: { pluginTimings: false },
|
|
197
|
+
...pack,
|
|
198
|
+
...(hasUserDeps || hasExternals
|
|
199
|
+
? { deps: { ...userDeps, ...(hasExternals ? { neverBundle: mergedExternal } : {}) } }
|
|
200
|
+
: {})
|
|
153
201
|
}
|
|
154
202
|
}
|
|
155
203
|
}
|
package/vite-plus/base.ts
CHANGED
|
@@ -60,6 +60,13 @@ export function rimelightConfig(): UserConfig {
|
|
|
60
60
|
},
|
|
61
61
|
test: {
|
|
62
62
|
environment: "node"
|
|
63
|
+
},
|
|
64
|
+
run: {
|
|
65
|
+
tasks: {
|
|
66
|
+
test: {
|
|
67
|
+
command: "vp test"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
63
70
|
}
|
|
64
71
|
}
|
|
65
72
|
}
|
|
@@ -126,6 +133,34 @@ export function verifyPackageExports(
|
|
|
126
133
|
}
|
|
127
134
|
}
|
|
128
135
|
|
|
136
|
+
export function findVirtualExternals(baseDir = "src"): string[] {
|
|
137
|
+
if (!fs.existsSync(baseDir)) {
|
|
138
|
+
return []
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const externals = new Set<string>()
|
|
142
|
+
|
|
143
|
+
function walk(currentDir: string) {
|
|
144
|
+
const files = fs.readdirSync(currentDir, { withFileTypes: true })
|
|
145
|
+
for (const file of files) {
|
|
146
|
+
const fullPath = path.join(currentDir, file.name)
|
|
147
|
+
if (file.isDirectory()) {
|
|
148
|
+
walk(fullPath)
|
|
149
|
+
} else if (file.isFile() && /\.(ts|tsx|js|jsx|astro|vue)$/.test(file.name)) {
|
|
150
|
+
const content = fs.readFileSync(fullPath, "utf8")
|
|
151
|
+
const regex = /["']((?:virtual|cloudflare):[^"']+)["']/g
|
|
152
|
+
let match: RegExpExecArray | null
|
|
153
|
+
while ((match = regex.exec(content)) !== null) {
|
|
154
|
+
externals.add(match[1]!)
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
walk(baseDir)
|
|
161
|
+
return Array.from(externals)
|
|
162
|
+
}
|
|
163
|
+
|
|
129
164
|
export interface RimelightPackOptions {
|
|
130
165
|
entry?: string[] | "auto"
|
|
131
166
|
autoEntry?: boolean | string
|
|
@@ -152,22 +187,35 @@ export function rimelightPackConfig(options: RimelightPackOptions = {}): any {
|
|
|
152
187
|
}
|
|
153
188
|
|
|
154
189
|
const discoveredExternals = autoExternal ? findPackageExternals() : []
|
|
190
|
+
const discoveredVirtualExternals = autoExternal ? findVirtualExternals() : []
|
|
155
191
|
const userExternal = pack["external"] || []
|
|
156
192
|
const userExternalList = Array.isArray(userExternal) ? userExternal : [userExternal]
|
|
157
|
-
const
|
|
193
|
+
const userDeps = (pack["deps"] as Record<string, any> | undefined) || {}
|
|
194
|
+
const userNeverBundle = userDeps["neverBundle"] || []
|
|
158
195
|
const userNeverBundleList = Array.isArray(userNeverBundle) ? userNeverBundle : [userNeverBundle]
|
|
159
196
|
const mergedExternal = Array.from(
|
|
160
|
-
new Set([
|
|
197
|
+
new Set([
|
|
198
|
+
...userExternalList,
|
|
199
|
+
...userNeverBundleList,
|
|
200
|
+
...discoveredExternals,
|
|
201
|
+
...discoveredVirtualExternals
|
|
202
|
+
])
|
|
161
203
|
).filter(Boolean)
|
|
162
204
|
|
|
205
|
+
const hasUserDeps = pack["deps"] !== undefined
|
|
206
|
+
const hasExternals = mergedExternal.length > 0
|
|
207
|
+
|
|
163
208
|
return {
|
|
164
209
|
...rimelightConfig(),
|
|
165
210
|
...rest,
|
|
166
211
|
pack: {
|
|
167
212
|
entry: resolvedEntry,
|
|
168
213
|
dts: true,
|
|
169
|
-
|
|
170
|
-
...pack
|
|
214
|
+
checks: { pluginTimings: false },
|
|
215
|
+
...pack,
|
|
216
|
+
...(hasUserDeps || hasExternals
|
|
217
|
+
? { deps: { ...userDeps, ...(hasExternals ? { neverBundle: mergedExternal } : {}) } }
|
|
218
|
+
: {})
|
|
171
219
|
}
|
|
172
220
|
}
|
|
173
221
|
}
|