xploitscan-shared-rules 2.4.15 → 2.4.16

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 CHANGED
@@ -162,7 +162,7 @@ __export(index_exports, {
162
162
  module.exports = __toCommonJS(index_exports);
163
163
 
164
164
  // src/version.ts
165
- var SCANNER_VERSION = "2.4.15";
165
+ var SCANNER_VERSION = "2.4.16";
166
166
 
167
167
  // src/snippet.ts
168
168
  var cacheContent = null;
@@ -6827,15 +6827,17 @@ function isExcludedPath(path) {
6827
6827
  if (/(?:^|\/)(?:migrations?|seeds?|scripts?)\//i.test(path)) return true;
6828
6828
  return false;
6829
6829
  }
6830
+ var USE_CLIENT_DIRECTIVE = /^[^\S\n\r\u2028\u2029]*["']use client["']/m;
6831
+ var USE_SERVER_DIRECTIVE = /^[^\S\n\r\u2028\u2029]*["']use server["']/m;
6830
6832
  function looksClient(code) {
6831
- if (/^\s*["']use client["']/m.test(code)) return true;
6833
+ if (USE_CLIENT_DIRECTIVE.test(code)) return true;
6832
6834
  return /\b(?:useState|useEffect|useTransition|useReducer)\s*\(/.test(code);
6833
6835
  }
6834
6836
  function looksServer(path, code) {
6835
6837
  if (/(?:^|\/)route\.(?:ts|js)$/.test(path)) return true;
6836
6838
  if (/(?:^|\/)middleware\.(?:ts|js)$/.test(path)) return true;
6837
6839
  if (/(?:^|\/)(?:api|server|functions|edge-functions)\//.test(path)) return true;
6838
- if (/^\s*["']use server["']/m.test(code)) return true;
6840
+ if (USE_SERVER_DIRECTIVE.test(code)) return true;
6839
6841
  if (/\bDeno\s*\.\s*serve\s*\(/.test(code)) return true;
6840
6842
  if (/\bserve\s*\(\s*(?:async\s*)?\(/.test(code) && /deno\.land|@std\/http/i.test(code)) return true;
6841
6843
  if (/\bexport\s+(?:async\s+)?function\s+(?:GET|POST|PUT|PATCH|DELETE|HEAD)\s*\(/.test(code)) return true;
@@ -7319,7 +7321,7 @@ var silentFailedWrite = {
7319
7321
  if (!file.isClient) continue;
7320
7322
  if (file.isServer) continue;
7321
7323
  if (NEVER_CLIENT_PATH.test(file.path)) continue;
7322
- if (/^\s*["']use server["']/m.test(file.code)) continue;
7324
+ if (USE_SERVER_DIRECTIVE.test(file.code)) continue;
7323
7325
  const parsed = file.parsed;
7324
7326
  if (!parsed) continue;
7325
7327
  const { reachable } = collectFunctions(file);
@@ -9273,7 +9275,7 @@ var failedReadEmptyState = {
9273
9275
  if (file.excluded) continue;
9274
9276
  if (!file.isClient) continue;
9275
9277
  if (file.isServer) continue;
9276
- if (/^\s*["']use server["']/m.test(file.code)) continue;
9278
+ if (USE_SERVER_DIRECTIVE.test(file.code)) continue;
9277
9279
  if (!file.code.includes("fetch")) continue;
9278
9280
  const parsed = file.parsed;
9279
9281
  if (!parsed) continue;